# 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.

```sh
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.

1. [Getting Started (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/getting-started.md)
2. [Getting Started (Android)](/firework-for-developers/android-sdk/integration-guide/getting-started.md)

#### 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.

```js
FireworkSDK.getInstance().markInitCalled({ directlyCallNativeInit: true });
```

## Use React Native Components

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

1. [Video Feed (React Native)](/firework-for-developers/react-native-sdk/integration-guide-v2/video-feed-react-native.md)
2. [Story Block (React Native)](/firework-for-developers/react-native-sdk/integration-guide-v2/story-block.md)

## Use native components

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

1. [Video Feed (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/video-feed.md)
2. [Story Block (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/storyblock.md)
3. [Video Feed (Android)](https://github.com/loopsocial/gitbook-docs/blob/master/android-sdk/integration-guide/video-feed/README.md)
4. [StoryBlock (Android)](/firework-for-developers/android-sdk/integration-guide/storyblock.md)

## Analytics

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

1. [Analytics (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/analytics.md)
2. [Analytics (Android)](/firework-for-developers/android-sdk/integration-guide/analytics.md)

## Shopping

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

1. [Shopping (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/shopping-ios.md)
2. [Shoppable Videos (Android)](/firework-for-developers/android-sdk/integration-guide/shoppable-videos.md)

## Live Stream Support

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

1. [Live Stream Support (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/live-stream-support.md)
2. [Live Stream Support (Android)](https://github.com/loopsocial/gitbook-docs/blob/master/android-sdk/integration-guide/live-stream-support-android.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.firework.com/firework-for-developers/react-native-sdk/integration-guide-v2/integrate-sdks-in-hybrid-react-native-and-native-apps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
