react-native-builder-bob icon indicating copy to clipboard operation
react-native-builder-bob copied to clipboard

How does one use a different react native package (separate for android and ios)

Open sandys opened this issue 5 years ago • 8 comments

hi we are looking to build a SDK using react native that is usable on ios and android.

one of the functionality we want to include is the Razorpay payment gateway - https://razorpay.com/docs/payment-gateway/react-native-integration/standard/

how do we integrate this kind of a package into a Bob build ?

sandys avatar Sep 16 '20 11:09 sandys

did you find any solution ?

onurcskun avatar Sep 24 '20 09:09 onurcskun

We need to document best practices how to do so for both platforms.

krizzu avatar Sep 30 '20 16:09 krizzu

We are currently using the mapbox-gl, for a component. We are customizing the component as required and export our component in index. For the example App for make it work, we have added the mapbox-gl package in example project too. Is it required to add the mapbox-gl package in the Application where we install our library ,since the mapbox-gl is mentioned in the library dependencies ? This should be automatically installed while we installed the library right ?

AmalMenachery avatar Oct 22 '20 07:10 AmalMenachery

I'm struggling with this too; I want to create a rn package that uses 3rd party sdk but I'm pretty lost on how to approach it :(

betoharres avatar Oct 30 '20 17:10 betoharres

Anyone found a solution to this? Seems like a very common issue (also asked in https://github.com/callstack/react-native-builder-bob/issues/83 I believe).

P.S. I tried doing pod init and using CocoaPods to get the 3rd party sdk working but to no avail. 😞

AfrazHussain avatar Dec 05 '20 16:12 AfrazHussain

I ended up adding the dependencies that require linking to my devDependencies and peerDependencies, effectively leaving the installation part of those dependencies to the user of my package.

MorelSerge avatar Dec 06 '20 13:12 MorelSerge

@sandys From what I'm understanding from your question - you would like 2 different implementations for a single use SDK that is used dynamically by Android and iOS. You could simply create a higher-order-component or higher-order-function that renders the specific implementation that you want based on Platform.OS. Even better would be to have an abstract or interface class so that both implementations have a common contract that your bridge client can call over the bridge.

A good example would be react-native-maps that utilizes apple maps for iOS and google maps for Android. You could look at their source code to see what they did as a good practice.

crherman7 avatar Jan 30 '21 18:01 crherman7

@Vlu Thanks !

AmalMenachery avatar Feb 14 '21 17:02 AmalMenachery