react-three-fiber: [react-native]: main module dist/native.js does not exists

Hello everyone!

I just started facing an issue with the installation on react-native, after fresh install when I try to import something from @react-three/fiber, it throws an error that dist/native.js does not exists

I found out that it does not exist indeed: https://prnt.sc/11ah6lh

Also if I remove main field from @react-three/fiber package.json, then it stops crashing, but still not sure if everything will work as expected after that, any advice is appreciated, thank you

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 16 (9 by maintainers)

Most upvoted comments

Sorry for the late reply people, been pretty busy. I’ll open a PR, but please bear with the weird folder structure. I couldn’t figure out how to package the react-native part properly.

Edit : PR opened at https://github.com/pmndrs/react-three-fiber/pull/1384

react-native support is live in @react-three/fiber@beta alongside react@beta (installation instructions here).

Closing since we resolved targets in that release, but feel free to respond to re-open or create another issue if you do run into trouble.

Do we have any updates on that or maybe some help with PR is required? Noticed that PR is open for almost a month already and one of the pipelines failed

I will be glad to help since we are using react-three-fiber in our project and would be nice to use the latest version

@oleksiikiselov I got this working in React Native here https://github.com/swittk/react-three-fiber/tree/reactnative, seems to render fine as far as I’ve tested. But the events are all commented out right now, just in case you’d like to continue with that.

make it a pr pls, i can help you get events working

there is no react-native in v6, it has been removed completely. it would be very easy to put back by someone that knows RN - but we’re still waiting for a contrib. but until then you must stay on v5 until this is resolved. we have broken the lib down into clean modules in hopes that a situation like this wont happen again, in v5 RN target was deeply interwired into library innards.

I can look at a helping add some tests too 👍🏼

sure. so basically when you look under packages/fiber/src you see the web folder. make a native folder. then copy web/index and web/events in there and adapt. index will be 95% the same, so at that point we could also abstract it so that we’re not duplicating code, what you would need to change is the expo renderer - by that point it would already work, and then try to make cast RN events into regular dom shaped events.

if you get to making it render we can go through events.

yes, keep on using v5. but a pr would be very appreciated so that we can finally move on.