Live data from Hacker News

Use ReactJS to Build Native Apps

twitter.com

71–80 of 175 posts

Re: Use ReactJS to Build Native Apps

#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 the instructions sent.

* The JS runs react the usual way - I'm assuming the tree reconciliation happens the same way as well - the diff instructions are just sent to the native view server.

Re: Use ReactJS to Build Native Apps

#72

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.

There will be more detail tomorrow, but at a high level: * JS engine on a background thread * Communicates via batched, async messaging protocol to a native (objc or android) server running on the main thread (basically create_view(), update_view(), destroy_view(), on_event() etc) * Plug-in for React that speaks that protocol * Tools to make cross-platform dev a bit easier (standard text component, cross-platform fle…

How does it compare to Appcelerator Titanium? That's also a JavaScript-to-native-UI layer utilizing a JS runtime. http://www.appcelerator.com/titanium/

I know one complaint among many was that wrapping native API in a new framework can limit access to functionality and customization; you're limited to the choices of the framework designer. Another is debugging is harder since native tools don't understand the framework and you're dependent on the tool chain provided by the framework makers.

Re: Use ReactJS to Build Native Apps

#73

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.

I know it's a bit of an orthogonal concern, but will this project provide a way to style native apps using web technologies (e.g. CSS) as well? I'm very excited about building native apps with React, and would be even more so if I could also leave behind the very-poorly-designed Android style primitives.

Yes, a subset of CSS was ported

Re: Use ReactJS to Build Native Apps

#75
Hi, I'm just reading through the ReactJS docs for the first time, and I found something peculiar. Let me explain.

So, as I understand ReactJS invokes a render() method defined by the user (programmer), and the result of that is diff'ed to previous results of the same method, and as a result, the DOM is modified.

I can understand this, but... The DOM is already incrementally rendered by the browser. That is, changes to the DOM are not direct, but are performed by the browser in a way that is as efficient as possible. So, why the need for a render() method?

Also, the render() method itself could be quite big and thus could take a long time to run, and almost completely nullify all advantages of incrementally updating only the display.

So, as you can see, I'm a bit confused...

Re: Use ReactJS to Build Native Apps

#76

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.

I understand Facebook Groups for iOS uses it, but how mature is the current component library (compared to Ionic for example)?

If it's still small do you plan on the majority of future components to be first-party or third-party (community)?

Extremely exciting either way, wish there was a livestream of tomorrow.

Re: Use ReactJS to Build Native Apps

#77

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.

There will be more detail tomorrow, but at a high level: * JS engine on a background thread * Communicates via batched, async messaging protocol to a native (objc or android) server running on the main thread (basically create_view(), update_view(), destroy_view(), on_event() etc) * Plug-in for React that speaks that protocol * Tools to make cross-platform dev a bit easier (standard text component, cross-platform fle…

You guys better be filming the talks! :)

Re: Use ReactJS to Build Native Apps

#78
post #75

Hi, I'm just reading through the ReactJS docs for the first time, and I found something peculiar. Let me explain. So, as I understand ReactJS invokes a render() method defined by the user (programmer), and the result of that is diff'ed to previous results of the same method, and as a result, the DOM is modified. I can understand this, but... The DOM is already incrementally rendered by the browser. That is, changes t…

DOM is stateful, whereas the render() method is stateless.

For instance, if you add a to the DOM, it will stay there forever. On the other hand if the next call to render() no longer includes the then React will do the work of removing it from the DOM.

Re: Use ReactJS to Build Native Apps

#79

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.

Wow. It looks like we're going to have to make our platform (http://platform.qbix.com) integrate with React out of the box. This sounds pretty awesome.

In short, how will it work and do you have any links we should check out, or people I can contact? The React virtual DOM has all kinds of elements that map to DOM elements, so how would it render in a native app? What about native APIs and Javascript that can interface with it e.g. like it does in PhoneGap? What is the equivalent here?

Is it like Titanium in some way?

Re: Use ReactJS to Build Native Apps

#80
post #75

Hi, I'm just reading through the ReactJS docs for the first time, and I found something peculiar. Let me explain. So, as I understand ReactJS invokes a render() method defined by the user (programmer), and the result of that is diff'ed to previous results of the same method, and as a result, the DOM is modified. I can understand this, but... The DOM is already incrementally rendered by the browser. That is, changes t…

Swapping out inner html has issues such as losing form data and bound events (etc...). Ignoring that you also have life cycle issues. For instance if you have a component that needs to know its render height you want a hook for calculating that height AFTER the entire DOM has updated. Otherwise you are going to force multiple layouts (bad). React provides these life cycle methods.

As far as the render method being big, the premise React is built on is that the virtual DOM is much faster than the real DOM. Test as necessary for your own comfort / use cases. I personally trust the testimonials of people smarter than me that aren't the React team also feel this is true and are making real changes to their products based on that. I also trust my own experiences that the DOM is slow :)

Post reply on HN