React Native iOS doc¶
Requirements¶
This setup assumes you have already setup your App Key on the Dashboard
See requirements.
Please see our sample app with Pointzi IOS.
Clone the repo and checkout ios-react-native branch.
Integration Steps¶
Step 1 - Native Integration¶
Setup the IOS native side requirements.
Step 2 - Install¶
For React Native >= 0.60¶
Install npm module.
1 |
|
Go to ProjectName/ios folder.
1 |
|
For React Native =< 0.59¶
Install npm module.
1 |
|
Compilation Fix
1 |
|
Link the dependency.
1 |
|
Step 3 - Import Native Modules¶
Import the Native Modules into project.
1 2 |
|
Step 4 - JS Initialization¶
React Native only has one ACTIVITY
. When user switches from page 1 to page 2 on your App
the native side will be confused on what to name Page 1 and Page 2.
Add:
PointziReact.viewWillRender('<Page Name>');
//Above pointzi-react npm package 1.4.18
Call this method when there there is a page transition, this will allow the SDK to know there is a View change and it's name, by what you have set.
A Few Examples
Tab pages:
1 2 3 4 5 6 7 |
|
Or
In some React Native projects, when a page has changed
componentWillMount()
is called upon page enter.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Identify your app users¶
- Tagging customer's unique ID
1 2 |
|
- Tagging user's email address
1 2 |
|
- Tagging user's first name
1 2 |
|
Step 5 - Running in Xcode¶
React Native defaults to Objective C, but since Pointzi SDK 1.6.6 and above has swift code we need to create a bridging header
Steps for creating bridging header¶
- Open ios/YourAppName.xcodeproj in Xcode
- Right-click on Your App Name in the Project Navigator on the left, and click New Fileā¦
- Create a single empty Swift file to the project (make sure that Your App Name target is selected when adding)
- When Xcode asks, press Create Bridging Header and do not remove Swift file then. re-run your build.