react-native-contacts icon indicating copy to clipboard operation
react-native-contacts copied to clipboard

TypeError: Cannot read property 'getAll' of null

Open toarvindpatel opened this issue 9 months ago • 12 comments

React Native : 0.77.1

Package version is "react-native-contacts": "^8.0.4",

This issues only with android platform, ios is working fine.

Object is there, but when try to call getAll or any other methis it return error in android platform

Image Image

toarvindpatel avatar Mar 27 '25 11:03 toarvindpatel

I am also getting the same issue. Also downgraded the version still the issue is persistent.

sr-sameer avatar Apr 01 '25 09:04 sr-sameer

@sr-sameer you can use https://www.npmjs.com/package/@s77rt/react-native-contacts package

toarvindpatel avatar Apr 01 '25 09:04 toarvindpatel

@sr-sameer you can use https://www.npmjs.com/package/@s77rt/react-native-contacts package

Thanks! For now, what I did is import Contacts from react-native-contacts/src/NativeContacts instead of react-native-contacts because I don't know why the condition in node_modules/react-native-contacts/index.ts is failing. The condition is:

const isTurboModuleEnabled = global.__turboModuleProxy != null;

The issue is that global.__turboModuleProxy is undefined. Since I'm new to React Native, I don't know the actual fix for this.

I directly imported the NativeContacts

sr-sameer avatar Apr 01 '25 10:04 sr-sameer

Same issue on new arch.

faljabi avatar Apr 05 '25 22:04 faljabi

@sr-sameer Your fix worked, however, this issue came with the react native new architecture. since new rn projects have the new arch enabled by default, you might encounter some issues with other react native libraries due to this new arch.

madjique avatar Apr 07 '25 14:04 madjique

@sr-sameer you can use https://www.npmjs.com/package/@s77rt/react-native-contacts package

Thanks! For now, what I did is import Contacts from react-native-contacts/src/NativeContacts instead of react-native-contacts because I don't know why the condition in node_modules/react-native-contacts/index.ts is failing. The condition is:

const isTurboModuleEnabled = global.__turboModuleProxy != null;

The issue is that global.__turboModuleProxy is undefined. Since I'm new to React Native, I don't know the actual fix for this.

I directly imported the NativeContacts

@sr-sameer Your fix worked for me. Thanks

Nazim-hasan avatar Apr 21 '25 05:04 Nazim-hasan

I think we fixed it with this patch https://github.com/morenoh149/react-native-contacts/commit/d927fecbc06465f67180dd5b7b2b52296c5808c3

morenoh149 avatar Apr 23 '25 23:04 morenoh149

Still not fixed @morenoh149 on version 8.0.5

Tested on IOS only for now

Error fetching contacts: TypeError: 0, _$$_REQUIRE(_dependencyMap[12(...) "react-native-contacts").getAll is not a function (it is undefined)

RN version 0.79.0 using the new arch.

apostols1 avatar May 09 '25 12:05 apostols1

Hello,

I'm having the same issue with React Native 0.77.2. Any update on this bug ?

Thanks

Melkius avatar May 21 '25 08:05 Melkius

Someone find a fix on Reddit : changing the import.

import Contacts from "react-native-contacts/src/NativeContacts"

https://www.reddit.com/r/reactnative/comments/1kdoy4a/comment/mqcvq19/?tl=fr&utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

Melkius avatar May 21 '25 08:05 Melkius

For me, both

const Contacts = NativeModules.Contacts ?? NativeContacts;

and

import Contacts from "react-native-contacts/src/NativeContacts"

works . . thanks

neilanthonyte avatar May 30 '25 15:05 neilanthonyte

any news here?? i tried the import Contacts from "react-native-contacts/src/NativeContacts" but to no success only on android

kimrborja avatar Jun 02 '25 14:06 kimrborja

This issue is stale, please provide more information about the status

github-actions[bot] avatar Aug 02 '25 00:08 github-actions[bot]

No fix comming, so I choose the expo one solution and migrate.

Melkius avatar Aug 02 '25 04:08 Melkius

Hope a fix is coming since this is the only solid contacts module for bare projects.

faljabi avatar Aug 02 '25 12:08 faljabi