sidebar_position |
---|
6 |
- You have to wrap your app with the
withIAPContext
HOC
import {withIAPContext} from 'react-native-iap';
const App = () => <View />;
export default withIAPContext(App);
- Later then, somewhere in your components
import {useIAP} from 'react-native-iap';
const YourComponent = () => {
const {
connected,
products,
promotedProductsIOS,
subscriptions,
purchaseHistories,
availablePurchases,
currentPurchase,
currentPurchaseError,
initConnectionError,
finishTransaction,
getProducts,
getSubscriptions,
getAvailablePurchases,
getPurchaseHistories,
} = useIAP();
return <View />;
};
From [email protected]+
we support the useIAP hook that handles purchases better.
Check this Medium post for usage instructions.