top | item 17299374

Vue Native

429 points| tomcam | 7 years ago |vue-native.io | reply

203 comments

order
[+] lwansbrough|7 years ago|reply
Here's my pitch for a better ecosystem: we develop an intermediate standard for fundamental UI building blocks (divs/blocks/layers, images, video, etc.) + a layout engine, sort of like the DOM. Shells (browsers, native platforms like React Native but without the React requirement, etc.) would give JS renderers access to the lowest level painting calls available (ie. "repaint this node") along with programmatic access to the new standard UI API. Renders could then build on top of that API, implement the draw call optimizations themselves based on whatever makes sense for the rendering engine (for instance, React Fiber would be issuing draw calls differently than Vue's rendering engine.)

This would allow developers to get native performance out of a web-based rendering context. It would also be theoretically easy to build new renderers around the standard UI API. So you could swap out your backend between browser-native and a mobile/desktop library backed by OpenGL/WebGL, or another headless solution, etc.

Importantly, I think you need to limit the scope of this new UI standard (perhaps just to basic shapes, like how SVG is similarly limited), that way you leave UI implementations like dropdown boxes to ecosystem programmers (so you'd have a dropdown box for each React, Vue, etc. -- this sounds bad but people do this already.) Limiting the API scope also means making it easier for new renderers to enter the scene. Compare such a world to the current hellscape that is building your own HTML renderer. The API is so insane it's really only possible for big companies to take it on (Google, Microsoft, Apple, Mozilla.)

How this ties back into this post: you could create an _____ Native, which would really just implement everything you want from React Native, but without React. Then you can just plug Vue or React into the renderer and boom you're done.

Edit: Observant people will notice my ideal system resembles X11. Indeed, I think X11 is an interesting proposition in "shell" (browser, native) contexts, as shell applications are inherently window-managed and sandboxed. This allows for applications to reinvent the wheel without disrupting the fundamental UX of window management on the system OS.

[+] danpalmer|7 years ago|reply
While I admire your hopefulness that this could solve the problems, I don’t think it will for two reasons.

1. This is what the DOM is, to some extent. All those components on the page are “native” components, we have declarative markup for them (HTML) and we can script them. They are “rendered” by native code in browsers which are some of the most highly optimised codebases around.

2. The API design for JS and for higher performance systems is quite different. Take UITableViewDataSource for example, it does view prefetching, caching, object reuse, etc. As of iOS 12, this also feeds into the CPU throttling control to ensure enough compute is available on a cell fetch that it will meet the 8-16ms deadline so that no frames are dropped. This is just a totally different way of thinking about APIs and performance that the JS ecosystem is not designed to work with.

It’s possible that a total rewrite of that stack could provide significant benefits, but I think that would be more from removing legacy cruft in the DOM, than from it being a paradigm shift.

[+] jeremiep|7 years ago|reply
This assumes the web rendering context is the proper abstraction to build application UIs. Its not. Its too complex and object-oriented to be efficient. It was intended for documents and is a general pain to work with for applications.

For one, there's a lot to be learned from immediate-mode UIs (I'm thinking Dear IMGUI, not Unity3D's GUI); ie state inside components generates complexity, which is a bad thing. Your views should be nothing more than a pure FSM transforming app state to UI directives. IMGUIs have a ton of tricks to simplify UI development. With these in mind, FP becomes a much more interesting paradigm than OOP for this. The same logic applies whether you render the entire UI 60 times a second or you cache the previous render to only do the minimum amount of updates.

A good abstraction is one where features can emerge from its design. For example you rarely have to test your views when they're just a simple pure transform. You don't need an entire framework and command-patterns to implement undo when your app state is immutable and modelled as a sequence of actions. With each emergent feature you remove the need for tons of code and tooling; that yields agility.

I still believe most web application are much more complex than they should be, especially on the UI level, regardless of the framework used. And until we solve that problem, I don't think the web stack is the way to go for native. We're just replacing one set of problems for another one.

I strongly believe we shouldn't make things easier, but simpler.

[+] amelius|7 years ago|reply
The problem is: the platform owners (Apple and Google) have absolutely no incentive to make this see the day of light. They make money selling apps, and want to bind developers to their platform.
[+] Aissen|7 years ago|reply
It's funny because Netflix's Gibbon and YouTube's Cobalt already use some of those ideas. At least the latter is open source. Flutter is built with the same thinking. There will be some kind of convergence in the coming years.
[+] mda|7 years ago|reply
Some of your points remind me of Flutter.
[+] hardwaresofton|7 years ago|reply
I prefer NativeScript[0] & it's vue-specific extension NativesScript Vue[1] due to NativeScript's ability to work with more than one paradigm/framework. NativeScript enables any Javascript application to become a mobile app (along with ones built in Angular and Vue) and I think that's pretty great.

[0]: https://www.nativescript.org/

[1]: https://nativescript-vue.org/

[+] dabernathy89|7 years ago|reply
Yep, NativeScript looks neat and we're starting to dive into it at my office. Trying to head into a direction where we can extract out a bunch of JS logic and share it between a NativeScript-Vue repo for mobile apps and our main Laravel/Vue app.
[+] jbverschoor|7 years ago|reply
And there's no need to make bridges. Simply access the native API from javascript/typescript
[+] pstuart|7 years ago|reply
Looks interesting, and it's sponsored by Progress? Looks like old dogs can learn new tricks.
[+] reilly3000|7 years ago|reply
This is the only missing piece that has held me back from jumping into Vue. I know its not the most advantageous aspect of the framework, but my personal favorite aspect of it is the single file components. Being able to create a complete logical unit of UI of in one file feels more natural and produtive. All the speed of inline styles without the guilt and shame.
[+] sjellis|7 years ago|reply
FWIW, the next version of Ionic (in beta) decouples from Angular, so that people can use the tools and platform support of Ionic to build mobile apps with Vue, or whatever they prefer.
[+] sideproject|7 years ago|reply
Yes! :) I've been using VueJS for awhile and my next step was to create a mobile app - either via RN or even Flutter. But, hello vue-native!
[+] sebastienrocks|7 years ago|reply
This uses react-native, I would not consider jumping on the Vue ship if you've been waiting for a native solution. This seems more like a hack-y way of going about it.

Some other solutions are out there, one of the main ones being nativescript. However it feels like the community still hasn't "agreed" on a solution like React did.

To my knowledge, Vue still does not have anything official around native.

I would consider waiting for now, unless this proposed solution suits you.

(This doesn't mean you shouldn't start using Vue elsewhere however, I have been using it for the past few months at work on a pretty large-scale project and it is my favorite library by far, for many different reasons).

[+] maxwell2022|7 years ago|reply
> Vue Native transpiles to React Native.

Why would you not use react native directly then? I don't get it

[+] neya|7 years ago|reply
A lot of us prefer Vue over React, I for one favor Vue over React personally and have been using it in all my recent projects. So, just a matter of preference for those who don't want to use React.
[+] zappo2938|7 years ago|reply
I've been working with RN for a few months now. Good luck with that. I can't imagine another layer of abstraction.
[+] woah|7 years ago|reply
This is ironic, given that a lot of people advocating for vue on the web talk about how it's better because it doesn't involve all that complicated transpilation.
[+] ivanfon|7 years ago|reply
How does this compare to nativescript-vue?

https://nativescript-vue.org/

[+] inopinatus|7 years ago|reply
Their website may have repurposed the look and logo of the Vue project, but (unlike React Native's relationship with React) this doesn't appear to have any official association. In particular, Evan You called it an "interesting approach" but added "not endorsing this"[1].

https://twitter.com/youyuxi/status/1006565660091125760

[+] ilurkedhere|7 years ago|reply
I'm confused. Wouldn't "native" imply it uses platform widgets rather than HTML?
[+] mgalka|7 years ago|reply
Ironic the site does not seem to be responsive
[+] squiggy22|7 years ago|reply
Yes. Its worse than terrible on a mobile. Going to see if its open source and put a pull in for it.
[+] kingosticks|7 years ago|reply
If that doesn't put you off I'm not sure what would.
[+] ivm|7 years ago|reply
Ironically I just saw the tweet about Udacity team removing React Native from their apps:

https://twitter.com/n8ebel/status/1006244834351312897

[+] k__|7 years ago|reply
I can understand this.

I already planned 3 weeks for the Android port of an app.

But probably still better than the 5 months the iOS app took to make.

I have to set up an Android build environment and install all the Android versions of my native modules.

Since iPhones required dynamic sized UIs for iPhone5/iPhone/iPhone+/iPhoneX anyway, I expect to use most of the UI code without any change.

[+] dvdhnt|7 years ago|reply
Site is broken on mobile. Styling issues make it undreadable.
[+] xrd|7 years ago|reply
It's hilarious that you can't view this site on native browsers. How ironic!
[+] xab9|7 years ago|reply
Probably they are just people and didn't have the time to write a responsive css, which is not as simple as it sounds, especially if you are not using a grid framework.

Feel free to fork the site's code and send them a PR.

[+] steiner_j|7 years ago|reply
I'm genuinely confused as why this is getting so much attention. The NativeScript-Vue integration is out for over a year already. It fulfils exactly the same purpose, without the additional strange cross-compilation/transpilation.
[+] elyobo|7 years ago|reply
Page consists of an example (useful) and slides (not). Might look again once there's some useful content; slides aren't _quite_ as bad as a video, but it's pretty awful.

Edit: ah, the get started links to real content. Missed that.

[+] zpr|7 years ago|reply
Maybe you also didn't notice you can scroll down on the slides to get more info on the headlining topic (I missed it at first).
[+] baybal2|7 years ago|reply
I'm no longer a career webdev, but when I still do need to do something front-end related, Vue is a tool of choice. I really like Ethan's non-doctrinal approach, and that Vue is as isolated from dreaded committee designs of opens source projects invaded by corporate types.

I still regard GTK+ as one of the best C GUI toolkits. Particularly when it comes to thought-through design of layouting mechanism and that the widget lib was build with ergonomic in mind.

When you work with UIs in plain C, you invariably come to getter-setter pattern.

I wonder, can Vue guys somehow glue Vue components to GTK widgets?

[+] pier25|7 years ago|reply
Considering there is already Weex and NativeScript with Vue, what does this add?

Personally I think Flutter will become the dominant cross platform solution in 2020 or so. ReactNative has always seemed like a hack to me.

[+] tribby|7 years ago|reply
what's the difference between this and react-vue?[1]

I would prefer to be using weex, but that project has seemed stagnant ever since it became part of the apache foundation. or at least, they haven't really updated their site or fleshed out the docs etc. it's very hard to get buy-in from other developers because of that.

1. https://github.com/SmallComfort/react-vue