-
Notifications
You must be signed in to change notification settings - Fork 0
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
Render react native text component #3
Comments
I rather use a high level approach and go from there. There should be matching functionality in rns and rn. But you know this realm better than me. Some weird way of doing it just to see something would be to create a react native android ui element and replace with a nativescript |
The
All of these problems have been solved, however, by react-native-web. For one thing, they use a Babel preset metro-react-native-babel-preset to polyfill some modern JS functionality like optional chaining. For another thing, they use a Babel plugin, babel-plugin-react-native-web, to rewrite imports from Evan Bacon (on the Expo team) has also managed to build React Native Android/iOS using Webpack rather than Metro, so that would be interesting to study, too (as it removes React Native Web from the equation).
To be clear, porting React Native to NativeScript from the top down would be an enormous project. It is a project on exactly the same scale as React Native Web, which took years to build and required serious special expertise. Even just to get View and Text components working, you'd need to implement the Bridge, StyleSheet, Pressable, Accessibility, UIManager, logging, error handling, event bubbling, perhaps codegen, and the list goes on. I think it would be a never-ending rabbit hole and we might never get to see the component working. I think porting it from the bottom-up, just taking the bits we're interested in (e.g. starting with View and Text), would be more realistic as a spare-time project with few contributors. It's certainly the faster way to get to a proof-of-concept stage. To do that, one would have to look at how React Native's View is implemented in JS, and try to implement something like NativeScript's FlexboxLayout, but using React Native Obj-C/Java View component as the native view for it. |
That said, it's probably worth looking at how React Native Web implemented View and Text, and looking at the project's earliest commits, to see if a top-down approach, focusing on only one or two components, could be viable. I don't totally understand what would be involved yet. EDIT: Hah – it looks like the earliest commits of React Native Web didn't even include I think that (the bottom-up approach) would thus be far simpler and quicker to do, as well as far more realistic. |
I've successfully made a React Native plugin for NativeScript now! https://github.com/nativescript-community/react-native-in-nativescript/tree/master/apps/demo-react It fully supports both Android and iOS, and includes typings for both, too. No need to change your |
This if the first problem encountered when using anything in the react-native npm directly:
You may need an additional loader to handle the result of these loaders.
|
|
I guess i'ts related to flow and webpack
@shirakaba
The text was updated successfully, but these errors were encountered: