Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native support #20

Open
tyrauber opened this issue Jan 20, 2022 · 1 comment
Open

react-native support #20

tyrauber opened this issue Jan 20, 2022 · 1 comment

Comments

@tyrauber
Copy link

I am interested in exploring the use valtio in react-native and expo, using valitio-yjs and y-websocket. I've started by porting the valtio-yjs-demo to react-native. Here is a an expo snack for the purpose of developing and testing the implementation.

Unfortunately, there are some issues with importing yjs in react-native, specifically related to the dependency lib0. I believe this is an issue upstream in yjs or lib0, but I thought I'd report it here first as it pertains to the valtio-yjs example.

The snack fails to resolve yjs as a dependency due to lib0:

Failed to resolve dependency 'yjs@^13.5.24' (export 'Observable' (imported as 'Observable') was not found in 'lib0/observable' (module has no exports)

If you download the example and run it locally, the metro.config.js file, when configured to resolve .mjs and .cjs files, successfully imports and runs in the web browser. But runs into some errors when trying to run it in the iOS simulator:

While trying to resolve module `isomorphic.js` from file `~/valtio-yjs-expo/node_modules/lib0/dist/random.cjs`, the package `~/valtio-yjs-expo/node_modules/isomorphic.js/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`~/valtio-yjs-expo/node_modules/isomorphic.js/browser.mjs`. Indeed, none of these files exist:

Steps to reproduce the issue:

  1. Download the zip
  2. install the dependencies yarn
  3. run in the browser yarn web - success
  4. run in the iOS simulator yarn ios - fail
@dai-shi
Copy link
Member

dai-shi commented Jan 20, 2022

Yeah, it sounds like upstream issues. Please report it there too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants