Make sure to follow these directions carefully.
First,
npm install react-native-mapbox-gl --save
In the Xcode's Project navigator
, right click on project's name ➜ Add Files to <...>
. Add node_modules/react-native-mapbox-gl/ios/RCTMapboxGL.xcodeproj
Select your project in the Project navigator
. Click General
tab then add node_modules/react-native-mapbox-gl/ios/Mapbox.framework
to Embedded Binaries
. 💥 Important, make sure you're adding it to general -> Embedded Binaries
💥
Click 'Add other' to open the file browser and select Mapbox.framework.
Select the 'Copy items if needed' checkbox.
In the Build Phases
tab, click the plus sign and then New Run Script Phase
Open the newly added Run Script
and paste:
"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mapbox.framework/strip-frameworks.sh"
In Build Phases
tab, click Link Binaries With Libraries
and add libRCTMapboxGL.a
React Native Mapbox GL doesn't support iOS version less than 8.0. Under Targets ⇢ Deployment Info, set the minimum version to 8.0.
6: Add to project, see example
If you already have an iOS Simulator running from before you followed these steps, you'll need to rebuild the project from XCode - automatic refresh won't bring in the changes you made to this build process.