News for hackers. Stuff that matters.
Re:React Native is now open source by WalterGR on Thursday March 26, 2015 @06:05PM (#9273451)
> they focused on running said HTML/Javascript within a performance limited WebView and not the other way around.

Could you explain that? I'm not familiar with phone development and I'm having difficulty figuring out what "the other way around" is.

Re:React Native is now open source by ChrisLTD on Thursday March 26, 2015 @06:09PM (#9273476)
Phone Gap tried to mimic native Android and iOS UI using HTML, CSS, and JS. React Native uses JS to control 100% native UI.
Re:React Native is now open source by TheMakeA on Thursday March 26, 2015 @06:42PM (#9273645)
For some definitions of "100% native UI."

I'm a little concerned because, for example, a button is not implemented as a native UIButton, and a ListView doesn't use UITableView. Instead they are composed of native UIViews with a lot of JavaScript glue.

That being said, Facebook has more experience writing iOS apps than me, so it may be possible that those things don't really matter (and doesn't preclude 1:1 components from being added down the road).

Re:React Native is now open source by woah on Friday March 27, 2015 @01:11AM (#9274851)
The native uibutton is made of uiviews too
Re:React Native is now open source by robterrell on Friday March 27, 2015 @01:11PM (#9277593)
I don't even see a button class in React Native... but if there was one and it was custom-made from UIViews, it's going to look and act differently than a native button. Turn on accessibility features -- does the button's title get read aloud? If you turn on button highlighting, does the button get an outline? If you turn on bold text or large text, does the text of the button change?

I've spent 15 minutes with React Native so far, and as best I can figure, the answer is no.

If they were building the GUI components from UIKit pieces, they'd get all of this for free. But I understand it would be pretty hard to get all this working with the flexible layout architecture they have... so I'm guessing they'll have to slow add all the accessibility features in over time.

Re:React Native is now open source by TheMakeA on Friday March 27, 2015 @02:27AM (#9274987)
Absolutely. My primary concern is with the controls feeling native. Reimplementing controls with UIViews doesn't seem much better than reimplementing them with HTML/CSS (save for performance). There's still surface area to break the illusion.

Some food for thought: what if you kept HTML and CSS but instead of using a WebView to render it, you rendered the DOM manually using UIViews? You could even make overflow: scroll; turn into UIScrollViews automatically.

Re:React Native is now open source by kylebrown on Friday March 27, 2015 @08:08AM (#9275762)
>Reimplementing controls with UIViews

If it's using UIViews, it isn't reimplementing native controls. It's using native controls, same as if it was implemented with (interface builder) .nib files. That's like saying "reimplementing html/css with html/css".

Re:React Native is now open source by smackfu on Friday March 27, 2015 @09:24AM (#9276068)
It may be a "native control" but if you reimplement UIBUtton and have to recreate what Apple did to create it in the first place, that's where things tend to fall apart.
Re:React Native is now open source by ErikHuisman on Friday March 27, 2015 @04:21AM (#9275175)
If you write JSX. What would be the benefit of using html anymore? Your own components can be the same on web or native. The base components might be a bit different but that isn't difficult to learn.

<Carrousel> <Item></Item> <Item></Item> </Carrousel>

On the web you might use a div with overflow:scroll on native a scrollView.

Re:React Native is now open source by kylebrown on Friday March 27, 2015 @08:13AM (#9275777)
One of the big pieces in React Native was reimplementing flexbox positioning (they did it using randomly generated test cases in a TDD-based process; described in the "diving deeper" video iirc). So as long as you use flexbox to position your html, it should be pretty portable to react native.
Re:React Native is now open source by pikachu_is_cool on Friday March 27, 2015 @06:20AM (#9275438)
I mean... if you're talking about the entire HTML and CSS spec, then it'd be way, way, way ridiculously slower than just using a WebView.
Re:React Native is now open source by dcre on Thursday March 26, 2015 @06:18PM (#9273529)
With React Native, instead of writing HTML/CSS and running it on a crappy browser embedded in an app, you write code that looks like HTML/CSS (it's actually JSX)[1][2] and it is translated to native code.

[1] https://facebook.github.io/react/docs/displaying-data.html

[2] https://facebook.github.io/react/docs/jsx-in-depth.html

Re:React Native is now open source by oyvindkinsey on Thursday March 26, 2015 @09:12PM (#9274238)
It's not translated. The JS runs to create a declarative description of what the ui should look like, which is reduced to a diff representing the changes that needs to be made to the native ui. These change commands are then marshalled to native code which simply implements the changes (add this thing, move this thing, remove this thing).
Re:React Native is now open source by dcre on Friday March 27, 2015 @10:12AM (#9276354)
Oh, right. Thank you.