streem / react-native-select-contact

A cross-platform contact selection library for react-native
MIT License
114 stars 50 forks source link

Unhandled promise rejection, null is not an object (v1.6.2, iOS) #45

Closed jarredt closed 3 years ago

jarredt commented 3 years ago

Getting this error on iOS on v1.6.2 when trying to selectContactEmail or selectContactPhone: Screen Shot 2021-06-02 at 12 59 44 PM

Confirmed it's working OK on v1.5.0. Deleted ios/Pods and reinstalled pods just to be sure.

Android seems to be working OK.

Bardiamist commented 3 years ago

Same error

import { selectContact } from 'react-native-select-contact';

try {
  await selectContact();
} catch (error) {
  console.log(error.message); // Cannot read property 'openContactSelection' of null
}
Bardiamist commented 3 years ago

@seanadkinson 1.6.2 don't work on iOS

seanadkinson commented 3 years ago

Hmmm, that is very strange. The only commits of any substance in 1.6.x were this and this. I wouldn't expect either to impact iOS in this way.

It sounds like SelectContact is simply not available from NativeModules, based on the errors you both have posted. If you console.log(NativeModules) on startup, can you confirm SelectContact is not there?

Can you think of any reasons the same code would work properly on 1.5 and not 1.6, based on the above changes? Did you make sure to pod install after yarn?

We moved away from react-native a long time ago, so we aren't currently using this library anymore, so need to rely on the community to diagnose and provide fixes. Thanks!

Bardiamist commented 3 years ago

If you console.log(NativeModules) on startup, can you confirm SelectContact is not there?

'use strict';

import {
    Alert,
    ActionSheetIOS,
    NativeModules,
    Platform
} from 'react-native';

console.log({ NativeModules }); // {"NativeModules": {}}

const { SelectContact, ActionSheetAndroid } = NativeModules;

NativeModules is empty object

Can you think of any reasons the same code would work properly on 1.5 and not 1.6, based on the above changes?

I tried this but not helped. So not sure, maybe you changed deploy process.

Bardiamist commented 3 years ago

@seanadkinson I noticed that I tried with wrong podspec file. I edited RCTSelectContact.podspec but now react native using react-native-select-contact.podspe. So I fixed source_files path in react-native-select-contact.podspec: https://github.com/streem/react-native-select-contact/pull/46

Also maybe need to delete RCTSelectContact.podspec.

seanadkinson commented 3 years ago

Merged #46, and released 1.6.3. Can y'all try again to see if the problem is resolved? Thanks!

jarredt commented 3 years ago

Yep, looks like this is working for me now. Thanks @Bardiamist and @seanadkinson!