Skip to content

Instantly share code, notes, and snippets.

@tcodes0
Last active March 31, 2020 12:17
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcodes0/cb52859277be240e177022a122a6a3ec to your computer and use it in GitHub Desktop.
Save tcodes0/cb52859277be240e177022a122a6a3ec to your computer and use it in GitHub Desktop.
react-native 0.62 upgrade tips
BLOCKERS:
If you use react-native-fbads, it doesn't build on android 0.62.
Either wait fix or remove.
I've openned an issue already: https://github.com/callstack/react-native-fbads/issues/244
Some libs are also giving the Error "Super expression must either be null or a function"
You should open an issue and look for a PR that fixes it, or fix it yourself.
Example of a PR fixing this issue: https://github.com/expo/react-native-action-sheet/pull/162
To install a dep from a github PR, add to package.json:
```
"@expo/react-native-action-sheet": "git://github.com/Mitch528/react-native-action-sheet#fix-android"
```
Just an example with the react-native-action-sheet fork, but could be any lib
HOW TO:
Upgrade using diff here: https://github.com/react-native-community/rn-diff-purge/compare/release/0.61.5..release/0.62.0
run `yarn why @react-native-community/art` to see if you have any deps under version 1.2.
@react-native-community/art needs to be on version 1.2 to work with rn 0.62
If you depend on it directly, you can bump it.
But if one of your deps depends on it, you can open an issue and fork that dep to bump the version on your fork, and send a PR if possible.
Android should work at this point.
IOS:
Check the diff carefully for new xcode build flags: https://github.com/react-native-community/rn-diff-purge/compare/release/0.61.5..release/0.62.0#diff-47688e69ba4c83d925cb62d0b3fb3528.
How I solved it:
You should have a block of code in your podfile looking like this (that you copied from the diff):
```
# Post Install processing for Flipper
def flipper_post_install(installer)
installer.pods_project.targets.each do |target|
if target.name == 'YogaKit'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end
end
```
replace it with:
```
# Post Install processing for Flipper
def flipper_post_install(installer)
installer.pods_project.targets.each do |target|
if target.name == 'YogaKit'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.0'
end
end
end
# This post_install hook adds the -DFB_SONARKIT_ENABLED=1 flag to OTHER_CFLAGS, necessary to expose Flipper classes in the header files
file_name = Dir.glob("*.xcodeproj")[0]
app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target|
target.build_configurations.each do |config|
cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '
unless cflags.include? '-DFB_SONARKIT_ENABLED=1'
puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'
cflags << '-DFB_SONARKIT_ENABLED=1'
end
config.build_settings['OTHER_CFLAGS'] = cflags
end
app_project.save
end
installer.pods_project.save
end
```
I took that from the flipper setup instructions.
Apparently it needs an xcode flag set to work.
Lastly, follow these instructions to add a Swift Bridging Header to your xcode workspace:
https://github.com/react-native-community/lottie-react-native/issues/575#issuecomment-541315444
Ios should now build and Flipper should be working on both platforms.
You can download Flipper for mac using brew `brew cask install Flipper`
If you run into ios issues refer to the lottie-react-native thread for some ideas on fixes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment