Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async componentDidMount() {
if (!GITHUB_VERSION) {
try {
const products = await RNIap.getProducts(itemSkus);
// Do this just to ensure that all IAPs are available
await RNIap.consumeAllItems();
products.sort((a, b) => a.price.localeCompare(b.price));
this.setState({products});
} catch(err) {
console.warn(err); // standardized err.code and err.message available
}
}
}