onfido-sdk-react-native-sample-app icon indicating copy to clipboard operation
onfido-sdk-react-native-sample-app copied to clipboard

Attempt to invoke interface method 'void com.facebook.react.bridge.Callback.invoke(java.lang.Object[])' on a null object reference

Open hinciler opened this issue 6 years ago • 3 comments

When I add Onfido Sdk for my react native project app crashes when I send the app on back state. I found that error gives because of ActivityEventListener on error callback function, it send nullpointer exception error.

hinciler avatar Nov 01 '19 11:11 hinciler

App not crashing if comment

mErrorCallback.invoke(exception.getMessage());

exception.getMessage():

Unexpected result Intent. It might be a result of incorrect integration, make sure you only pass Onfido intent to handleActivityResult. It might be due to unpredictable crash or error. Please report the problem to [email protected]. Intent: Intent { dat=content://com.android.contacts/contacts/lookup/0r1-343A4C4E50402A4E50/1 flg=0x1 } 
     resultCode: -1

Bardiamist avatar Apr 14 '21 12:04 Bardiamist

It can be fixed

if (mErrorCallback != null) {
    mErrorCallback.invoke(exception.getMessage());
}

But why BaseActivityEventListener creating even if I not started Onfido? Can BaseActivityEventListener be created only on Onfido start and released on Onfido close?

Bardiamist avatar Apr 15 '21 06:04 Bardiamist

Steps to reproduce:

  1. yarn add react-native-select-contact
import { selectContact } from 'react-native-select-contact';
selectContact();
  1. Close contacts picker

Bardiamist avatar Apr 15 '21 09:04 Bardiamist