-
Notifications
You must be signed in to change notification settings - Fork 90
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
Approaching React Native #120
Comments
@priand Hi and thanks for giving Anvil a try! Anvil has gone a long way moving away from React (and Mithril) concepts because of the Android limitations. Unfortunately, if we rely on a virtual tree diff - we will end up with lots of garbage produced, and the whole rendering process will be much slower (comparing to the incremental DOM approach). And we only look at the syntax - I believe Anvil has certain benefits. For example, lambdas are not as compact in JS as they are in Kotlin, and it looks like that have bigger cost. Anyway, they are not part of the React API, which forces developers to write ugly ternary operators instead of if/else and totally avoid for-loops, using
Anvil's approach does not create temporary collections (unlike Speaking of the iOS support - I'm all for it, and I believe Swift is a nice little language with plenty of syntax sugar to build Anvil DSL upon. The problems here are on a much deeper level - I have close to zero knowledge of iOS, and it looks like there is no easy way to do reflection (e.g. to collect a list of all views and their properties). Generated DSL seems to be the most critical component of Anvil, and unlike HTML DOM where all elements share the same, small set of properties, in iOS views differ a lot and their properties can be set in a number of different ways. Multi-os-engine looks interesting, and I will have a look into it. Although, I doubt I would use something like this in production (although we have been using Anvil for years now). Looks like it creates UI with storyboards and then only generate Java bindings. Anvil, on the other hand, suggests to build UI in code (like React does), which seems to be impossible with Multi-OS-Engine. That being said, for the first question - the answer is probably, 'no'. Anvil is as native as it can get (resulting in tiny APK sizes, unlike React Native and very simple internals, which anyone can explore or debug). For the second question the answer is "I'd love to!", but I need help from some really smart iOS developers (because I believe a native solution would be the best). |
Thanks for your reply. |
As a React developer, I love this library and the concepts behind it. Great job!
To make it even more appealing, it would be great to have an iOS version of it based on multi-os-engine (https://multi-os-engine.org/), which is Java on iOS. It should not be very hard to do, I might start that if I find time.
Now, Anvil is different from React with a different API. Have you thought about making it closer to React, with a base Component class, a component state, cloning the react native component library... The idea is to facilitate the migration of existing react code (like https://nativebase.io/) and drag the community to the technology.
The text was updated successfully, but these errors were encountered: