Repository navigation
[MOO-2499]: Upgrade React 19.3 and React Native 0.88 - #236
MxKevinBeqo wants to merge 8 commits into
Conversation
Upgrade the Pluggable Widgets Tools and the widget generator templates to React Native 0.88 (RC) and React 19.3. (MOO-2499) - bump react-native, @react-native/babel-preset, react, react-dom, react-test-renderer and the React types - use @react-native/jest-preset for native tests, since React Native no longer ships its own Jest preset - resolve modules with "bundler" in the base tsconfig, since React Native only exposes its types through package exports - add react-native-worklets and @react-native-vector-icons/common to the native externals and stop terser from removing directives - update the migration script, generator templates and command tests BREAKING CHANGE: widgets are upgraded to React Native 0.88 and React 19.3. The deprecated react-native-vector-icons package is no longer an external of native widgets; use the scoped @react-native-vector-icons/* packages.
On Windows runners the temp directory can be an 8.3 short path (RUNNER~1). Node resolved modules through that short path while Jest resolved them through the long path, so React was loaded twice and the generated native widget tests failed with "Cannot read properties of null (reading 'useReducer')".
| "paths": { | ||
| "react-hot-loader/root": ["./configs/hot-typescript.ts"], | ||
| "react-native": ["./node_modules/react-native/types_generated/index.d.ts"] | ||
| } |
There was a problem hiding this comment.
I guess react-hot-loader is added here because the arrays are not merged?
I do find it suspicious that we need to explicitly include the types this way. Is this really necessary?
There was a problem hiding this comment.
- Yes, paths isn't merged and the hot loader indeed is not needed. Removing it.
- For the types though, in RN 0.88 the types are exposed via exports and then the tools are compiled as CommonJS which needs node10 resolution.
We could opt for node16 resolution and not need the type mapping, but that one most likely will break other things.
With the current node10 and no explicit type mapping, we get ts error:
|
|
||
| module.exports = { | ||
| preset: "react-native", | ||
| preset: dirname(require.resolve("@react-native/jest-preset")), |
There was a problem hiding this comment.
Shouldn't jest be able to resolve the preset on its own with just the name?
There was a problem hiding this comment.
You are right, I retested with name and it is building ok. Will have to retest on the Windows pipeline again after changing this, since I had some resolution issues there. Thank you!
@rollup/plugin-typescript requires tslib at build time but only lists it as an optional peer dependency. It used to be installed by chance through another package, which is no longer the case, so building a TypeScript widget could fail with "Could not find module 'tslib'".
- drop the unused react-hot-loader path mapping from the tools tsconfig - resolve the native Jest preset by name instead of by absolute path
This reverts commit f263b1b. Resolving the native Jest preset by name lets Jest load it from the real path, which should also avoid loading React twice when the temp directory is an 8.3 short path on Windows runners.
Restore the react-native-vector-icons external and drop its breaking change note from the changelog. Removing the old package name is unrelated to the React Native 0.88 upgrade and can be done separately.
|
Thanks for reviewing this @weirdwater , I appreciate it! I addressed the notes. As the PR description mentions, we will wait for the 12th of October until RN v0.88 releases and then update the dependencies -> rerunning the CI. Until then, I am moving this to Draft at the moment. |
This PR upgrades to React 19.3 and React Native 0.88.
TODO:
It currently uses RC for RN until 12 October release.
1- re-pin from 0.88.0-rc.3 to stable RN 0.88 after the 12 Oct release