-
-
Notifications
You must be signed in to change notification settings - Fork 747
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
Support react-native (view-only) #363
Comments
seems like the 2nd point is not actually needed, if react-dom is shimmed in react-native project. |
here's an example repo with react-native project: https://github.com/Shaddix/craft_js_native |
aforementioned repo contains JSON 'markup': https://github.com/Shaddix/craft_js_native/blob/master/craft/content.json which is rendered via craftjs in react-native. If you wish, I could come up with a better looking example and add it to |
Actually I started to build a web-based react-native designer based on craftjs. |
@ggunti that's quite interesting! My idea was a bit different, I wanted to actually use the same component within React-Native app, providing it with the same config that was generated on the web. E.g. to be able to use within react-native something like this (taken from Readme):
My final goal is very similar to what you are doing - to provide a web UI for designing react-native screens. And actually usage of While PR is not accepted, I plan to actually use a patch-package to apply this change and move on. |
@Shaddix Btw, I did not face the 'nanoid' problem, this is all what I did and craftjs preview worked also on react-native:
|
nice, I haven't found this feature while quickly going through your website, probably missed it. I'm gonna try again with latest version, maybe it's gonna work, thanks for the advice! |
Highly recommend looking into react-native-web for your native preview needs. It's a pretty healthy renderer so it most likely has viable solutions to make the task more of an integration and less of a feature implementation task for craft.js support. |
Any info on this? We are trying to run this in expo on web for editing, didn't get yet to native side, because we are having trouble creating the editor ui within react native web. The drag and drop works, but indicator is missing, it is quite slow compared to the examples on web and we often get the following error
any ideas? A working example repository? Thank you in advance! |
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:
getRandomId
should usenanoid/non-secure
('nanoid' doesn't work in react-native)RenderIndicator
should importreact-dom
conditionally. Something likeAnd 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 :)
The text was updated successfully, but these errors were encountered: