Repository navigation
Conversation
…w-loader flow-remove-types only erases type annotations, so on React Native 0.81+ flow-loader (and getJsTransformRules) emitted invalid JS for `component` / `hook` declarations, Flow enums and `match` expressions. Files using them now go through the project's React Native parser (hermes-parser or flow-parser) and @babel/plugin-transform-flow-strip-types; all other files still use flow-remove-types. Enums are lowered to flow-enums-runtime, resolved from the project or from react-native so it works with isolated installs. Source maps are emitted for lowered files. Also fix flow-loader crashing under webpack: getOptions() received the loader context as a schema. Part of callstack#1422
Flow `component` declarations with a `ref` are lowered to `forwardRef` on React 18 and pass `ref` as a prop on React 19. Pick the target from the project's `react` version instead of always assuming React 19. Part of callstack#1422
@react-native/babel-preset strips Flow enum declarations before its enum plugin runs, so references such as React Native's VirtualViewMode.cast() were undefined at runtime. Parse @flow sources with the shared parseReactNativeSource helper, which lowers enums to flow-enums-runtime and picks the component lowering target from the project's React version (hermesParserOverrides still take precedence). Related to callstack#1422
- detect multi-line `match (...)` in flow-loader's prefilter and cover the routing with unit tests - strip class fields of lowered files like flow-remove-types does: allow `declare` fields and honour `ignoreUninitializedFields` - require @babel/core only when a file needs lowering - cache flow-enums-runtime and React version lookups per project root - share the preset lookup and wrap its resolution errors - pin unused import preservation in a file that is not lowered Part of callstack#1422
🦋 Changeset detectedLatest commit: ea31d9b The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@whydidoo is attempting to deploy a commit to the Callstack Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1422 (v5 patch).
Summary
On RN 0.81+,
flow-loader(and sogetJsTransformRules) emitted invalid JS, becauseflow-remove-typesleaves Flowcomponent/hook/enum/matchin place. Separately,@react-native/babel-presetdrops Flow enums inbabel-loaderandbabel-swc-loader, so RN'sVirtualViewMode.cast()threw at runtime.flow-enums-runtime, resolved from the project orreact-native, so it works with pnpm.componentlowering follows the project's React version:forwardRefon 18,refas a prop on 19.flow-loadercrashing under webpack.Test plan
tests/integration, presets 0.87/0.88 × rspack/webpack: component, hook, enum, match, class fields, source maps, React 18/19, enums in both Babel loaders,getJsTransformRuleswith a pnpm Flow dependency.rspack-swcconfig in tester-app bundles real RN 0.86.3. It failed before this change onView.js.