Live data from Hacker News

Introducing React Native [video]

youtube.com

101–110 of 193 posts

Re: Introducing React Native [video]

#101

Earlier quoted context omitted.

with gpu-accelerated css transitions, requestAnimationFrame, virtual dom and web workers, the experience can be damn close. he makes it seem like "no comparison", this is provably false at least for the apps he demoed. for games, native is still necessary. what react offers beyond performance though, is definitely awesome. imo, the talk comes off a bit like a sales pitch at a pep rally.

You're right that it's possible to get really, really close, but the effort required is very large and best avoided if possible. Not to mention, there will always be subtle differences between your UX and native, and it sucks to be in a position where you have to defend that difference to, say, your CEO who's asking why "it just feels different." Or worse, he can put his finger on exactly why it feels different and i…

It also sucks to explain to your CEO why it's taken so long to develop multiple versions of the apps. Theres tradeoffs for everything..

Re: Introducing React Native [video]

#104
-- Attention -- Cross posting from the other thread --

Seasoned Appcelerator’s Titanium Mobile SDK dev here. Looks like that a lot of people here is comparing this announcement from the react team to the Titanium Mobile SDK. I’d like to give some info to shed some light on the differences, and probably anticipate the challenges they have to (or had to) solve.

## Architecture

Both Titanium SDK and this Native React thing do have a JavaScript runtime behind the curtains.

Both frameworks will run the JS runtime on the background, on a different thread from the UI. This is incredibly important to remind.

Titanium SDK follows an OOP-ish, imperative approach. You create views using factories (`Titanium.UI.createScrollView({ })`) and you add those views to parent views (`parent.add(child)`). This is very similar to a browser DOM, and in fact it’s cumbersome to work with. They built an xml preprocessor called Alloy which does a better job at exposing the view hierarchy right in the source, but it just compiles down to JS, `create()` and `add()`.

This is important for the evaluation at least for the following reason: every time you update a property on a view (actually on a proxy object to the real view) you’re crossing the bridge and you have to pay that penality. The bridge is the void between the JS runtime’s thread and the main, UI’s one. This is incredibly painful when trying to do JS animations, sometimes if you’re not careful you can get hurt very badly. You can still do great things, but it’s way better to use the native `.animate()` methods, which cross the bridge only twice (at start, and at the end as a callback invoking).

On Native React you should not have this kind of problems because changes will be batched and updated on a update loop basis or at least debounced. Or at least optimized in some smart way. I believe.

## Layout

One big problem will be the layout. Given that they don’t want the developers to understand every layout system every platform provides, they have to normalize it somehow. Titanium SDK has it’s own layout system, incredibly easy to understand even from a web-only dev experience:

a) by default everything is absolute positioned,

b) you can get a vertical flow layout by setting the 'layout' property on the parent view or

c) you can get a horizontal flow (inline-block-ish) by setting 'layout' to horizontal.

Native React will probably follow a more intimately web-ish approach, just look at this JS/C/Java implementation of the box-model and flex-box specification by Facebook itself [1]

[1]: https://github.com/facebook/css-layout

## Support and limits

Titanium SDK is always criticized for being to limited in what you can do with it. This actually comes from two different issues:

1) they have to (almost) manually implement every API you might need, by proxying from native-land to JS-land;

2) they have to follow every release of the platform’s SDK;

3) you cannot just put native code along-side your JS code, so you cannot go where they didn’t.

Let’s see how Native React will solve this issue.

Titanium SDK is undergoing an heavy lifting refactoring to solve exactly this issues. The project is code-named Hyperloop and is already working behind the curtains for the Windows 8 version of the SDK.

## Conclusion

Because I shamelessy want to karma-drift this topic, I’ll stop here.

It’s interesting, but until they show us some (native) code... it’s just ideas.

Follow me on twitter (@_pier) and github (@yuchi [2]) for Titanium related stuff.

Also my company, SMC, does a lot of great opensource things for Titanium (on gh we’re @smclab)

[2]: https://github.com/yuchi

Re: Introducing React Native [video]

#106
post #55

Looks like React is reaching critical mass.

Based on what metric? A Facebook team talking about a Facebook framework and a HN thread filled with React enthusiasts? I am not bashing any of it, but to suggest critical mass is a bit immature.

Yeah, I have yet to meet a react developer in person. Maybe the definition of 'critical mass' is just enough fans to have commentors posting about it 24 hours a day. I would say rust has reached critical mass if react has.

Re: Introducing React Native [video]

#107

I wonder why it is such a big of a deal of not having DOM API:s on the WebWorker thread? I think the discussion from Browser vendors is that there is no use case or benefit of having them there. And not having the "native feel" or performance. I think browser vendors are on the verge on closing this gap totally. If not browser vendors, hardware will do it.

It's the same with all other native UI, though.

.Net Winform, WPF, Swing, etc., they don't allow you to make modification to UI outside main thread.

Re: Introducing React Native [video]

#108

Earlier quoted context omitted.

One way data binding is supported by WPF also, I mean, two-way data binding is the unusual odd man out. And of course, the one way data flow functions have to be immutable and you have to take a dependency whenever when you read a property imperatively. What they've done with react native sounds a lot like how WPF works anyways (scene graph updated in UI thread, rendering thread then renders scene graph). Now, there…

Having worked on production software with both WPF and React, I can tell you why React's "data binding" approach is categorically different (better, in my opinion) than WPF's. Like many abstractions in WPF, bindings have a "shadow world" feeling, where they are their own little isolated DSL. With the React model, "bindings" are just JavaScript expressions. Sure, with WPF you can overload operators and create "Express…

Right, WPF's declarative databinding support is separated from imperative semantics, even if they can interact a bit (a databinding relationship can be formed and destroyed imperatively). But I've moved away from WPF to Glitch, which doesn't have that problem: all code runs in the same world, with dependency tracing, re-evaluation on dependency change, and logging to support rollback as needed. In that case, now I'm curious how React compares to what I'm working on right now.

I've never heard anyone claim that laziness leads to more performant UIs. It has always been the opposite in my experience: by loosening up evaluation orders and allowing for glitching, you reduce the amount of book keeping needed to come up with optimal DAG-style re-computation orders. For example, consider a double-indirect (flat-map-style) dependency:

    countLabel.Content = folderView.Selected.Count;
If count changes, you update the label. But if selected changes, you have to stop observing the previous selected folder's count property and start observing a new selected folder's count property. Carefully tearing down and building back dependency chains is tough, but if you just play lose with the dependencies, it is actually quite easy to handle (you might get some spurious re-evaluations). Note that WPF can't handle this without lots of hackery, which is one reason I moved all my UI work to Glitch (the other is that WPF is totally inappropriate performance wise for writing compilers and language-aware editors). I'm curious how React handles indirect state? Or does it need to do dependency tracing at all (it wouldn't if its not incremental; I can't tell by looking at the website)?

Re: Introducing React Native [video]

#109

I wish they'd go into more detail on why they can't make an app like paper in the browser environment. They mentioned something about Web Workers being crippled and later on explained how their framework puts JavaScript in it's own thread by default. I'm also wondering why in their experience no one ever comes close to native widgets when imitating them in a Web apps.

I'm pretty sure an app like Paper is possible using web technologies (if you only support the latest browsers). I don't even see why they bring Paper as an example since I think the app is pretty shit UX wise.

Re: Introducing React Native [video]

#110
post #68
post #62

Earlier quoted context omitted.

I don't think Slack is a HTML5 app, at least on Android. The apk contains ~2.5MB of bytecode and half a meg of layouts.

Wow. Indeed. thanks! I really thought that they were HTML5 based on how similar the HTML5 version is compared to the Android experience. Thanks again!

I think Slack is partially HTML5 and partially native on mobile.
Post reply on HN