-
Notifications
You must be signed in to change notification settings - Fork 140
Upgrading to Flagship 4 (React Native 0.59)
Flagship 4 upgrades React Native to version 0.59. This release includes the following features:
- React Hooks
- Modernized JavaScriptCore implementation for Android including 64-bit support
- Update Android builds to use SDK 28 (Pie)
- Utilize JavaScriptCore framework for iOS devices
Contents
- Resources
- A Note About Xcode 10.2
- Dependency Changes
- react-native-code-push
- Module Scripts
- Android on Travis CI
- Errors & Solutions
Flagship 4 supports XCode 10.2 and it is recommended that you upgrade to this version in order to stay up-to-date with Apple's build chain.
Installing XCode 10.2 will rename all of the simulators on your computer. This may cause issues running iOS through the command line as prior versions of React Native do not support this naming scheme.
If you receive an error similar to "Could not find [simulator name] simulator", there are a couple options:
-
Run your project through XCode by running
flagship init
, opening the project in XCode, and then clicking the run button -
Run this command to patch the react-native CLI:
sed -i '' 's/startsWith/includes/g' node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
This feature is resolved in Flagship 4.0 via React Native 0.59.
In addition to upgrading your Flagship dependencies to version 4, you should upgrade the following dependencies to the specified version:
- "react-native": "0.59.10"
- "react": "16.8.3"
If your project already has any of the following dependencies, they should be updated to the specified versions:
- "react-native-navigation": "https://github.com/brandingbrand/react-native-navigation#v1"
- "@babel/core": "^7.4.5"
- "babel-jest": "^24.8.0"
- "metro-react-native-babel-preset": "^0.54.1"
- "jsc-android": "241213.x.x"
- "react-native-webview": "^4.1.0"
If you receive an error similar to "Undefined is not an object (evaluating 'RNI18n.languages')", you need to manually specify react-native-i18n in your package.json file so it gets linked at the init stage:
- "react-native-i18n": "2.0.15",
If your project implements react-native-code-push, please note that Flagship no longer supports injecting Code Push credentials through the command line. In order to utilize the new way to pass credentials to Code Push, make sure your project is configured as follows:
-
Update react-native-code-push dependency to "5.6.0"
-
Verify that your environment configuration is set up as follows:
codepush: {
appCenterToken: 'XXX',
ios: {
appKey: 'XXX',
deploymentKey: 'XXX'
},
android: {
appKey: 'XXX',
deploymentKey: 'XXX'
}
}
Flagship will then copy your credentials into strings.xml (Android) and Info.plist (iOS) where they'll be picked up by RN Code Push.
Flagship contains an internal set of scripts used to add missing native code for third party libries that do not work propertly with react-native init.
If your project adds additional scripts (these are copied into node_modules/@brandingbrand/flagship/dist/lib/modules
), please note that the format for these scripts has changed:
- The modules directory has been split into
ios
andandroid
subdirectories - Each script can export a
preLink
and/orpostLink
function which will run before and after react-native link, respectively.
In order to migrate your scripts, you'll need to break them into iOS and Android versions and then have them export preLink or postLink functions instead of ios
and android
functions.
Travis CI has documented problems with its built-in Android components, especially when dealing with the newer versions of the Android SDK introduced in this version of React Native.
Should you receive an error in your Android tests similar to "no emulators available", we'd recommend using the solution used by .travis.yml in the Flagship repository. The before_install
block should stay the same, while the script
block should be the steps used to run Android for your application.
You likely specified a different version of react-native-navigation than used in Flagship. Make sure you have the same version in your package.json: "react-native-navigation": "https://github.com/brandingbrand/react-native-navigation#v1"
Solution 1: Add react-native-i18n
as a dependency to package.json to make sure it gets linked appropriately: "react-native-i18n": "2.0.15"
Solution 2: Make sure you're using the correct version of react-native-codepush
(see section above) as older versions may cause react-native link to fail silently
Getting Started
- Flagship Technical Introduction
- Setting up Your Development Environment
- Getting Started with Flagship
- Creating a Flagship App
How To
- Running Flagship Apps
- Managing Environments
- Creating App Icons
- Creating Launch Screens
- Signing Your Apps
- Using React Native Permissions v2
- Using SSL Certificate Pinning
- Initializing Multiple Xcode Targets
Major Releases