-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
build: Upgrade to React Native 0.73 #58475
Conversation
Result of running the following: ``` npx @rnx-kit/align-deps@latest --write --requirements react-native@0.73 ```
Revert changes that are incompatible with the Gutenberg project because they are a undesired downgrade or erroneously modify usage of the `^` version annotation.
These packages were renamed, the old names are deprecated.
The result of `npm install` after update React Native-related dependencies for 0.73.
The result of running `npx patch-package react-native`. This patch exists as a workaround for the following RN core issue: facebook/react-native#36465
Size Change: -120 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
The previous lock file was incorrect, as it was the result of running `npm install` after merely bumping package version numbers. In order to capture the correct lock file results, one must follow the Gutenberg project's guidelines for updating dependencies, which involves removing and re-adding each dependency. This now captures the result of `npm install` after following that process. https://github.com/WordPress/gutenberg/tree/c7cf2f74f38ae4c1f325e3238e61270a801f183c/packages#updating-existing-dependencies
These packages were renamed, the old names are deprecated.
This patch was originally created to prevent an warning caused by the project's use of `jsdom-jscore-rn`. #47616
This should improve React Devtool support for the React Native project. Likely enabling features like highlighting a UI element when hovering its component in the devtools.
Metro changed its approach for extending the default configuration.
This logic threw the following error after upgrading to React Native 0.73. We should follow up to fix the error or remove the logic. https://github.com/facebook/metro/blob/877933ddc03672a00214d26afe620b79479d6489/packages/metro-file-map/src/lib/TreeFS.js#L417 ``` Unexpectedly escaped traversal ```
var overlay = null; | ||
function hideOverlay(agent) { | ||
- if (window.document == null) { | ||
+ if (window.document == null || window.document.__isJsdom) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional window.document.__isJsdom
references were added to this recreated patch in hopes of improving the compatibility with the dev tools. E.g., possibly enabling features like highlighting UI when hovering an element in the dev tools.
…Gutenberg Mobile, to appened the right directory path
This was done to address the following error when installing Pods: ``` [!] CocoaPods could not find compatible versions for pod "React-FabricImage": In Podfile: React-FabricImage (from `../../../node_modules/react-native/ReactCommon`) Specs satisfying the `React-FabricImage (from `../../../node_modules/react-native/ReactCommon`)` dependency were found, but they required a higher minimum deployment target. ```
Required to address the following error. https://stackoverflow.com/a/77257722/378228 ``` No template named 'optional' in namespace 'std'; did you mean 'folly::Optional'? ```
Align with the latest React Native template to avoid future conflicts.
This existing warning was reworded.
Restore mock to its original implementation rather than resetting it to an empty function. It is not entirely clear why this test began failing after upgrading to React Native 0.73.
We already invoke `jest.mock()` for this module within the Jest environment setup file. We do so as _not_ mocking this module causes widespread failures in tests due to its relationship to native modules. So, in a way, it makes sense to globally mock it. For whatever reason, attempting to invoke `jest.mock()` twice for this module stopped working after upgrading to React Native 0.73. The mock function passed to the second invocation was ignored. This change now updates the existing mock instead.
The specific cause for this update was not determined, but seemingly the ref is no longer passed to the navigation `Stack.Screen` component. There is no reason to believe this is an issue at this time.
This was done to fix failing automated tests. The guard was originally added to prevent invoking the animation end callback, so this should be safe to change.
Without fake timers, the callbacks are never invoked as the animation never completes. This outcome started happening after upgrading to `react-native-reanimated@3.x`.
Addresses an act warning during the test run that started after upgrading to React Native 0.73.
The navigation container test failed due to `act` warnings and broken mocked timers. Wrapping timer runs with `act` address the former. The latter is addressed by no longer relying upon "legacy" mock timers, simplifying the approach for advancing the timers for animations, and removing the global `requestAnimationFrame` override. All of these same actions were applied to the Reanimated library in a refactor: software-mansion/react-native-reanimated@99573c3
Align the implementation with the Reanimated version. It is worth noting the Reanimated utility is marked as deprecated.
The previous approach using `jest.isMockFunction` failed after upgrading to React Native 0.73. While it is not clear why it began failing, the new approach is sourced from the `@testing-library/react-native` source. https://github.com/callstack/react-native-testing-library/blob/a670b2d4c1fb4df5326a63cb2852f4d6e37756da/src/helpers/timers.ts#L24-L58
// TODO: Reinstate the optional setup configuration once we identify why | ||
// it throws an error after the latest RN 0.73 upgrade. | ||
// https://github.com/facebook/metro/blob/877933ddc03672a00214d26afe620b79479d6489/packages/metro-file-map/src/lib/TreeFS.js#L417 | ||
// Apply optional setup configuration, enabling modification via hooks. | ||
if ( __DEV__ && typeof require.context === 'function' ) { | ||
const req = require.context( './', false, /setup-local\.js$/ ); | ||
req.keys().forEach( ( key ) => req( key ).default() ); | ||
} | ||
// if ( __DEV__ && typeof require.context === 'function' ) { | ||
// const req = require.context( './', false, /setup-local\.js$/ ); | ||
// req.keys().forEach( ( key ) => req( key ).default() ); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: follow up to fix or remove this logic (and related documentation).
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
…s to 8.1.1. We can't have different AGP versions and if we do this change the main host app will ned to update as well as their dependencies. For now we'll fix all dependencies AGP versions in the React Native demo app.
Mitigate Ci instability or insecurity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the changes LGTM. 🚀
# Conflicts: # packages/react-native-editor/android/app/src/main/java/com/gutenberg/MainActivity.java # packages/react-native-editor/android/app/src/main/java/com/gutenberg/MainApplication.java # packages/react-native-editor/ios/Podfile.lock
Related
0.73.3
Upgrade wordpress-mobile/WordPress-Android#20167What?
Upgrade the React Native dependency to version 0.73.
Why?
Improve product stability and quality by receiving the latest bug fixes and features from newer versions of the React Native dependency. Keep the project code up-to-date to improve compatibility with the latest OS versions, build tooling, third-party dependencies, etc.
How?
Upgrade the dependency version and implement required code changes for compatibility.
Testing Instructions
Testing Instructions for Keyboard
General regression testing of a11y features:
Screenshots or screencast
N/A, no user-facing changes.