-
-
Notifications
You must be signed in to change notification settings - Fork 819
Open
Description
It'd be great to support react-native!
Use case: web-based react-native designer, render the results (view-only) in react-native.
View-only mode (<Editor enabled={false}>) doesn't actually depend on anything dom-related, so it seems easy to make it work under react-native.
I tried it as a proof-of-concept, and it seems that there are only 2 things that needs to be changed:
getRandomIdshould usenanoid/non-secure('nanoid' doesn't work in react-native)RenderIndicatorshould importreact-domconditionally. Something like
const isReactNative =
typeof window !== 'undefined' &&
window.navigator &&
window.navigator.product &&
window.navigator.product === 'ReactNative';
const ReactDOM = !isReactNative ? require('react-dom') : null;
And that's it! After only these two changes it works on React-Native!
I could provide a PR if you are ok with the idea :)
mav10 and Andy-lm
Metadata
Metadata
Assignees
Labels
No labels