Replies: 1 comment
-
|
You are using an older version (v12 or v13). Please upgrade to v14+ which uses the new MigrationIn v14+, use the import { useIAP } from 'react-native-iap';
const MyComponent = () => {
const { connected, products } = useIAP({
onPurchaseError: (error) => {
// Handle errors here - no unhandled promise rejections
console.log('Purchase error:', error);
},
});
// Your component logic
};Benefits of v14+
Migration GuidePlease follow the migration guide to upgrade: NoteVersions below v14 are no longer supported. Use at your own risk. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Thanks for the great library!
Every time I open the app in the Android emulator, I see this warning: "Possible unhandled promise rejection..." (see more details in the screenshot). I understand that this library is not expected to work on the Android emulator without installed Google Play services.
The issue isn't that the library isn't working, but rather the warning itself. It's not possible to catch and conditionally ignore it.
The error is thrown in withIAPContext.ts file. There is no way to pass on error handlers to this HOC.
purchaseUpdatedListenerexpects the second argument to be a function, if a function is not given it throws an error which causes the mentioned warning.Of course, we can conditionally wrap with this HOC, for example detect Android emulator and don't wrap at all, but in this case the library won't work on emulators with installed GooglePlay services.
Another possible solution is to allow passing on error handler to
withIAPContextHOC.Are there any other ways to ignore this error?
Beta Was this translation helpful? Give feedback.
All reactions