How to use react-native-dom in snack?

Hello I want to build a 2D or 3D game and I’ve read about three.js for expo and matter.js. But I am having bad time to learn because all the tutorials and the documentations are using DOM which is can find in react js and react native but not work on expo or expo snack.

I tried to copy and paste in snack from this tutorial https://medium.com/better-programming/how-to-use-matter-js-in-a-react-app-bbd43b71efcc but it gave me error because I can’t load the react-native-dom.

I did some search and found that react-native-dom-expo, which is expo created for supporting dom. But I don’t know how to use it and it dose not load in snack even when I add it into package.json manually.

I know that expo is just a tool to improve the react native but I feel it is another framework eveytime I start a new area with it.

Snacks run in a pretty solid and secure environment which also means that there are limitations. One of the limitations is that you can’t run arbitrary scripts or have files write to the file tree.

One of the installation steps of react-native-dom is to run this file as a binary. That file sets up the expo-integration, by editing the file tree (creating a symlink) and editing the package.json to run an additional command. Neither is supported on snacks, nor is runnning this script in the first place.

However, this should work locally, if you follow those steps as listed on the README.md:

npx expo-cli init -t tabs --name expo-rndom --non-interactive expo-rndom
cd expo-rndom
npm install react-native-dom react-native-dom-expo
npx init-rndom-expo
npm run rndom

That said, note that this library has not been updated for 17 months and thus might not work with the current expo SDK.


Check out this package (gl-view) on this official docs, which in turn mentions:

The expo-gl package does have Web support out of the box!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.