I'm looking to add StoreKit's SKStoreProductViewController into a React Native project (without using a third-party library). Would like the Store view to show up as a modal when the user taps a "get app" button, which will pass the iTunesID of the product to be displayed.
While RN's documentation explains how to integrate a native view component into a project, I'm not sure I'm understanding how this would translate to a view controller.
While I prefer a solution in objective-c, I can accept a solution that uses Swift.
CodePudding user response:
I was able to parse what I needed from https://github.com/rh389/react-native-store-view. Though I had tried installing the package, it had some breaking issues - but I extracted the key elements and documented them in this Gist:
https://gist.github.com/raffibag/213de82365166e647af975e85076e2ff
In a nutshell:
- Pull in native libraries and StoreKit component in new header and Obj-C files in your root app directory (
RCTStoreViewManager.mandRCTStoreViewManager.h); - Create a bridge file to connect js methods with the Obj-C / native methods (
index.ts); - Pull the js methods into your RN component (
Component.js)
