facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.39k stars 24.36k forks source link

`@react-native/assets` ships Flow instead of JS #36343

Open nandorojo opened 1 year ago

nandorojo commented 1 year ago

Description

The assets package is shipping flow JS directly, making it break when importing on Next.js. It should build prior to publishing and remove types.

See: https://github.com/facebook/react-native/blob/main/packages/assets/registry.js

Let me know if I should PR, though I know TypeScript and not flow. Could also migrate it.

React Native Version

0.71

Output of npx react-native info

N/A

Steps to reproduce

See https://github.com/facebook/react-native/blob/main/packages/assets/registry.js

Snack, code example, screenshot, or link to a repository

If you need a repro, you can try importing @react-native/assets in Next.js. It's pretty self-explanatory though.

Thanks!

github-actions[bot] commented 1 year ago
:warning: Add or Reformat Version Info
:information_source: We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.70.2
cortinico commented 1 year ago

Related to this other issue: https://github.com/facebook/react-native/issues/35263#issuecomment-1432010425

(cc @necolas @lunaleaps)

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 7 days with no activity.

sergioisidoro commented 3 weeks ago

Any or work arround for this. For using webpack this is documented and mentioned -- https://necolas.github.io/react-native-web/docs/multi-platform/#compiling-and-bundling -- but we're using Vite, and this issue started to pop up on react native 0.74

Update: For using Vite, I've found a vite plugin that includes an EsBuild plugin using flow-remove-types package to transform the source and remove flow types - https://github.com/Bram-dc/vite-plugin-react-native-web. I was able to bypass this issue and get the application to build, although with some ongoing issues with testing setup.