Closed nnslvp closed 3 years ago
does the example throw the same error? https://github.com/morenoh149/react-native-contacts/tree/master/example
does the example throw the same error? https://github.com/morenoh149/react-native-contacts/tree/master/example
which example ?
Version: 6.0.3
Code:
return PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.READ_CONTACTS, { 'title': 'Contacts', 'message': 'This app would like to view your contacts.', 'buttonPositive': 'Allow' } ) .then(Contacts.getAll);
Error on running
com.facebook.react.bridge.NativeArgumentsParseException: Contacts.getAll got 3 arguments, expected 2
change .then(Contacts.getAll); by .then(() => Contacts.getAll()); solves for me
very odd, feels like getAll
is getting 3 args but it only needs 2. Shouldn't javascript ignore the third arg? maybe its the native bridge that can't ignore the third arg.
very odd, feels like
getAll
is getting 3 args but it only needs 2. Shouldn't javascript ignore the third arg? maybe its the native bridge that can't ignore the third arg.
It's the Java part that complains, not javascript, i believe
The following changes fixed this issue for me, write await before Contacts.getAll and change this to:
Contacts.getAll
to
await Contact.getAll()
@SalvaHasan that looks right. The current api is async.
.then(() => Contacts.getAll());
I tried this but my app closes when i run that
@ibelgin need more code. Did you try?
.then(async () => {
await Contacts.getAll();
});
Version: 6.0.3
Code:
Error on running
com.facebook.react.bridge.NativeArgumentsParseException: Contacts.getAll got 3 arguments, expected 2