Live data from Hacker News

Use ReactJS to Build Native Apps

twitter.com

121–130 of 175 posts

Re: Use ReactJS to Build Native Apps

#121
This sounds promising. I've been building something with Ionic recently and it's great 'cause it's just Angular but the documentation is a bit inconsistent and outdated. If React Native were to execute and deliver, I'd definitely love to switch over.

Re: Use ReactJS to Build Native Apps

#123

Hi, I'm Jordan from the React team. I'm happy to answer any questions about React Native, but @vjeux will be giving a more thorough talk tomorrow that you won't want to miss (if you're at ReactJSConf), so I might wait for him to answer some of them. This is not the DOM. This is not a web view. If you know ReactJS, you can build native apps with React Native.

Any word on SVG support?

Re: Use ReactJS to Build Native Apps

#124
I have long questioned the validity of middleware (for the lack of better terms, please don't be pedantic) to create native applications.

I get it, HTML can replicate performance of native apps to a certain extent now, but it's also bound by restrictions that native apps aren't.

Speed of innovation being one. HTML5 is a large ship that takes a long time to evolve (in comparison). iOS and Android aren't, by the same means. Particularly iOS since Apple has a habit of introducing backwards compatibility breaking new features.

I don't understand fully how hybrid made apps will ever be able to properly compete with a native platform for this reason alone, not mentioning some of the other problems that plague hybrid and middle ware apps.

Re: Use ReactJS to Build Native Apps

#125

Earlier quoted context omitted.

A render in react doesn't return DOM elements. Render is a pure function which projects app state into a description of the view. Let's call this description A, so render(state) -> A. When state changes and render is called a second time we get a new description, render(newState) -> B. A diff is then applied to them diff(A, B). The diff can then be translated to an update strategy for the actual DOM (or in this case,…

Amelius, I cannot reply to you directly for some reason. Anyway... So say you're rendering some long list of items. Because react is just plain JS (no templates!), you will map the array of items to components in your render. You give each item a key so that react can reconcile components across renders. If component with same key is returned from render next time then it's kept in the DOM (and any updates applied),…

Thanks a lot for this detailed explanation.

If I get this clearly, then still:

render() -> returns N items every time it is invoked

And React will diff those N items against the DOM (using a key) every time an update is required.

So, to me it appears that still O(N) amount of work has to be done every time something small changes in the list.

This is not necessarily a bad thing. But here we assume that doing render() is faster than actually building the DOM from scratch, even though they have the same computational complexity, O(N).

Anyway, I'll have a look at that link. Very interesting, thanks again.

Re: Use ReactJS to Build Native Apps

#126
post #71

Summary of what I can make out so far: * Write JS as usual. Write React as usual, but don't use the DOM JSX elements (or the React.DOM) factories - instead use the new 'NativeView' elements. * The code you write runs in a Javascript interpreter on the background thread. * The NativeView elements communicate transparently with a native server running on the main thread, which renders and fills native views based on th…

Nice summary thanks :-)

Re: Use ReactJS to Build Native Apps

#127

Earlier quoted context omitted.

Actually currently only the iOS Groups app is built on top of React Native. (I'm Andrew, I work at FB on React Native)

Hey Andrew, this https://itunes.apple.com/us/app/facebook-groups/id931735837?... app is build on top of ReactJs?

A significant portion of it, yes

Re: Use ReactJS to Build Native Apps

#128
post #32
post #20

This is awesome news. I've been working on a desktop application using React, node-webkit and browserify and it's been a great development experience. Being able to leverage web technologies to build native apps has been a huge time saver. However, I'm relying on the NodeJS components in order to do things like access the file system and fork commands. I'm wondering how React Native will handle this functionality. Wi…

Native APIs are exposed as JS modules. And XHR, for example, is polyfilled in terms of whatever native capability exposed. You can totally use npm modules, provided any module that it uses is polyfilled.

My bet is that they are working with thrift for their transport layer. We're moving the same direction. I should be landing a bunch of diffs over the next week to the JS thrift libraries to support XHR and websockets in the nodejs thrift library (for use with browserify).

Re: Use ReactJS to Build Native Apps

#129

Hi, I'm Jordan from the React team. I'm happy to answer any questions about React Native, but @vjeux will be giving a more thorough talk tomorrow that you won't want to miss (if you're at ReactJSConf), so I might wait for him to answer some of them. This is not the DOM. This is not a web view. If you know ReactJS, you can build native apps with React Native.

Will this layer be released as a separate project so that other projects like raynos/mercury [2] or elm [1] can target this interop layer?

mercury was fully decoupled from virtual-dom [0] (such that you can use virtual canvas or virtual-gl). Would be really nice if this stuff can be used by other libraries easily.

[0] https://github.com/Matt-Esch/virtual-dom

[1] http://elm-lang.org/

[2] https://github.com/Raynos/mercury

Re: Use ReactJS to Build Native Apps

#130
post #91
post #86

Earlier quoted context omitted.

Given the presence of https://github.com/facebook/css-layout it will probably flex-based. Not cool as a constraint based layout but good enough for easier portability of knowledge.

Can I create the largest possible square div in a rectangular div with this library? That is my standard test as to whether a layout framework is advanced enough to meet my basic needs. (vanilla CSS fails this test of course, even with the most recent extensions, AFAIK)

With css-flexbox, you probably can. Your DIV should have flex-grow: 1 which will make it take the allowable space along the "main axis" (shared with other flex-growers) and then align-items: stretch, to pick up all available space along the "cross axis". With some nesting, you can do pretty much whatever you want except for the grid layout. Grid layout is another thing coming but barely implemented in the today's browsers.

Anyways, flex-box is not available in IE < 10. IE10 requires ms- prefix. If React makes it available everywhere (IE8+) that will be really great.

Post reply on HN