For the complete documentation index, see llms.txt. This page is also available as Markdown.

Integrate SDKs in Hybrid React Native and native Apps

We support the integration of SDK components in hybrid React Native and native applications. You can utilize React Native components on React Native pages and native components on native pages. SDK global handlers and callbacks are implemented on the native side, so your existing native integration code continues to drive shopping behavior, analytics, and other global events across both React Native and native pages.

This guide is written for the common case: you have an existing native app with the Firework iOS/Android SDK integrated, and you are adding React Native pages to it. With this approach, all your existing native SDK integration code (handlers, callbacks, shopping configurations, analytics listeners, etc.) keeps working as-is — you only need to add the React Native SDK on top.

Initialization

Install SDKs

Since the React Native SDK depends on the native SDKs, installing the React Native SDK will automatically install the native SDKs as well. Please use the following code to install the React Native SDK, after which the native SDKs will also be installed.

npm install react-native-firework-sdk
# Or
yarn add react-native-firework-sdk

iOS

Run pod install in the root directory of the iOS project. If you encounter the error CocoaPods could not find compatible versions for pod "FireworkVideo", run pod update FireworkVideo instead.

Configure and initialize native SDKs

Follow the native SDK guides below to configure and initialize the SDK on each platform. The native SDKs are already installed via the React Native SDK in the previous step, so you can skip the installation sections in these guides.

Call markInitCalled in JS side

As shown in the following code snippet, we need to invoke markInitCalled with directlyCallNativeInit set to true on the JS side.

Use React Native Components

You can utilize React Native components on React Native pages. Please consult the following docs for further details:

Use native components

You can utilize native components on the native page. Please consult the following docs for further details:

Analytics

Receive analytics events on the native side. Please consult the following docs for further details:

Shopping

Customize shopping configurations and click behaviors on the native side. Please consult the following docs for further details:

Live Stream Support

To enable support for livestream, please consult the following docs:

Last updated

Was this helpful?