Top
Integrate Whatfix Mobile SDK with React Native iOS
  • 18 Nov 2024
  • 2 Minutes To Read
  • Dark
    Light
  • PDF

Integrate Whatfix Mobile SDK with React Native iOS

  • Dark
    Light
  • PDF

Article summary

To create Whatfix Mobile in-app experiences on your React Native apps, you need to first set up Whatfix Mobile. You can add the Whatfix Mobile SDK provided for React Native apps to the source code of your app and then create and publish content.

Prerequisites

  • API Key
  • Add tags to views. For more information, see tag views.
  • Whatfix Mobile React Native SDK is incompatible with managed workflow. If you are using expo to start your react-native project, make sure to eject to the bare workflow.
  • The minimum deployment target of Whatfix Mobile SDK is iOS 10. But Whatfix Mobile works only for devices running on iOS 11 and above.

Integration steps for React Native iOS app

Use the following steps to integrate the Whatfix Mobile SDK with your React Native iOS project:

your title goes here

Ensure that you complete both the steps, to create and test the in-app experience in your integrated build.

Step 1: Integrate Whatfix Mobile SDK

a. Add the Whatfix Mobile SDK dependency

Download the leap-react-native package from npm using the following command:

// Using npm
npm install leap-react-native@2.0.5 --save

// Using yarn
yarn add leap-react-native@2.0.5

cd ios && pod install

// To update Leap iOS SDK once installed, run the following command
pod update
your title goes here

For more information on the latest version of the React Native project, see React Native Changelog.

b. Start the Whatfix Mobile SDK

To start Whatfix Mobile, add the following code inside componentDidMount() {} in your App.js file.

import LeapReactNative from 'leap-react-native';

export class App extends React.Component {
	componentDidMount() {
		Platform.select({
			ios: () => LeapReactNative.start('API_KEY')
		})()
	}
}

Step 2: Enable Creator mode in your app

To create in-app experiences in the Whatfix Mobile Studio, you have to enable the Creator mode in your app. This is done by integrating the Whatfix Mobile Creator SDK.

a. Add dependencies

your title goes here
  • The Whatfix Mobile Creator SDK must be removed before the app goes live on the App Store.
  • While both Whatfix Mobile Creator SDK and Whatfix Mobile SDK need to be integrated in the development and testing versions, the production version should only have the Whatfix Mobile SDK.

Download the leap-creator-react-native package from npm using the following command:

// Using npm
npm install leap-creator-react-native@2.0.5 --save

// Using yarn
yarn add leap-creator-react-native@2.0.5

cd ios && pod install

// To update Leap creator iOS SDK once installed, run the following command
pod update
your title goes here

For more information on the latest version of the React Native project, see React Native Changelog.

b. Start the Whatfix Mobile Creator SDK

To start the Whatfix Mobile Creator, add the following code inside componentDidMount() {} in your App.js file.

import LeapCreatorReactNative from 'leap-creator-react-native';

export class App extends React.Component {
	componentDidMount() {
		Platform.select({
			ios: () => LeapCreatorReactNative.start('API_KEY'),
		})()
	}
}

After integrating the code, you can start creating your in-app experience using Whatfix Mobile.


Was this article helpful?


Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.