Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update React Native to 0.66.1 #340

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

irminakacz
Copy link
Contributor

@irminakacz irminakacz commented Nov 1, 2021

Hi :) It's this time of the year again! Time to update React Native :D
I used the React Native upgrade helper to edit all the ios/android files.

I updated only the dependencies that seemed crucial to React & React Native update.
The iOS simulator starts and loads rebox - everything looks fine there.
The Android emulator starts and loads rebox - everything looks fine there as well.
Linting and unit tests pass.
I had to add some weird tweaks to accommodate for xcode 12, but I'll point that out in the comments in the PR.

…ive, r11y, rebox/native-utils, rebox/web, refps, refun, revert/*, siza, syntx, x-ray/*: update RN to v0.66.1 and React to v17.0.2
"tsfn": "*",
"typescript": "^4.0.0",
"ws": "^7.3.1"
},
"scripts": {
"start": "packages/nextools/start-preset/src/cli/index.js"
"start": "packages/nextools/start-preset/src/cli/index.js",
"postinstall": "perl -pi -e \"s/'React'/'React-Core'/g\" ./node_modules/react-native-svg/RNSVG.podspec ./node_modules/react-native-view-shot/react-native-view-shot.podspec && perl -pi -e \"s|}.*node_modules/react-native/cli.js|}/../../../../../node_modules/react-native/cli.js|g\" ./node_modules/react-native/react.gradle"
Copy link
Contributor Author

@irminakacz irminakacz Nov 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed to manipulate content of some dependencies, so I introduced the "postinstall" script.
I'm doing two things here:

perl -pi -e \"s/'React'/'React-Core'/g\" ./node_modules/react-native-svg/RNSVG.podspec ./node_modules/react-native-view-shot/react-native-view-shot.podspec

Here I'm replacing "React" with "React-Core" in podspec of "react-native-svg" and "react-native-view-shot" dependencies. For "react-native-svg" that change is merged since July, but it was not released yet and the same is for "react-native-view-shot" merged, but not released yet :/

perl -pi -e \"s|}.*node_modules/react-native/cli.js|}/../../../../../node_modules/react-native/cli.js|g\" ./node_modules/react-native/react.gradle

Then I'm adding some "../../" in "react-native/react.gradle". This is related to this change in React Native.
They stopped executing def cliPath = ["node", "-e", "console.log(require('react-native/cli').bin);"].execute([], projectDir).text.trim() and rely only on relative path and we started getting an error, because our Android project folder is not in the root, but also inside node_modules.

Why in perl? Because it's fast, I could fit it in one line and it's preinstalled on every machine compatible with POSIX standard.

@@ -23,3 +23,6 @@ org.gradle.parallel=true
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.99.0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this, because React Native upgrade helper showed it should be updated, but I'm not sure if it's needed here?

@@ -31,7 +31,6 @@ export const buildIosAppDebug = async (options: TBuildIosAppDebugOptions): Promi
})

await dleet(derivedDataPath)
await makeDir(derivedDataPath)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this line, because from xcode 12.5, the build was failing with error message *** CLEAN FAILED ***. It seems that since xcode 12.5 the xcodebuild command prefers to create the folder itself.
Without it everything works fine, even after removing node_modules and rebox folders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant