If you were using react-native-mapbox-gl before we moved it into the mapbox npm org. You will need to unlink react-native-mapbox-gl and link @mapbox/react-native-mapbox-gl
Make sure to follow these directions carefully.
First,
npm install @mapbox/react-native-mapbox-gl --save
In the Xcode's Project navigator
, right click on the Libraries
folder ➜ Add Files to <...>
. Add node_modules/@mapbox/react-native-mapbox-gl/ios/RCTMapboxGL.xcodeproj
Select your project in the Project navigator
. Click General
tab then add node_modules/@mapbox/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.