TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

First Impressions Using React Native

539 pointsby jlongsterover 10 years ago

29 comments

azakaiover 10 years ago
I think it&#x27;s a very strong point that moving script code off the main thread can help achieve smooth UIs. No more GC pauses, no more slowdowns if the JS engine hits a snag, etc.<p>I think this is actually possible on the web as well. Someone could write a UI framework which runs JS in a Worker, and sends messages to the main thread, on which there is HTML and minimal JS to receive the messages and handle them.<p>I&#x27;m surprised this hasn&#x27;t been done, or has it and I just haven&#x27;t heard about it?<p>If you&#x27;re worried about the overhead of transferring lots of messages from the Worker to the main thread, I think it can be pretty fast actually. I did an experiment with proxying WebGL that way, which is a fairly high-traffic API, with nice results,<p><a href="https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/" rel="nofollow">https:&#x2F;&#x2F;blog.mozilla.org&#x2F;research&#x2F;2014&#x2F;07&#x2F;22&#x2F;webgl-in-web-wo...</a><p>For something rendering a UI, message passing overhead should be reasonable, especially if the framework is smart enough to only send over what changes (like React Native does).
评论 #9010798 未加载
评论 #9013045 未加载
评论 #9011215 未加载
评论 #9010786 未加载
评论 #9011504 未加载
评论 #9011015 未加载
评论 #9010756 未加载
评论 #9010938 未加载
评论 #9010823 未加载
评论 #9010694 未加载
评论 #9012853 未加载
jeniusover 10 years ago
&gt; &quot;This is <i>solid engineering</i>. And it completely reinforces the fact that <i>React.js is the right way</i> to build apps.&quot;<p>This just comes off as really weird to me. Why would any sane developer make a statement like this? It sounds preachy and brainwash-y and weird. If there&#x27;s anything we learn as developers it&#x27;s that there never is and never will be a single &quot;right way&quot; to do everything. Reading stuff like this makes me doubt the entire article.<p>There&#x27;s a difference between writing objectively about something that&#x27;s interesting that you enjoyed, and trying to lay down a dogma. TBH, the more of this article I read, the more my view of it&#x27;s goals swayed towards the latter.
评论 #9012375 未加载
评论 #9013065 未加载
评论 #9011276 未加载
danabramovover 10 years ago
Declarative UI is boss.<p>I know Andy (former UIKit team) was quoted in the intro thread but I&#x27;ll do it again:<p><i>&gt;I say with confidence as a former UIKit author: React&#x27;s model for the UI layer is vastly better than UIKit&#x27;s. React Native is a huge deal.</i><p><a href="https://twitter.com/andy_matuschak/status/560511204867575808" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;andy_matuschak&#x2F;status&#x2F;560511204867575808</a><p>If you&#x27;re averse to React because of JSX, “mixing templates and views” and similar superficial “best practices”, you&#x27;re missing out. Engineers embracing React are not dumb. You should consider a possibility that they think it&#x27;s good for a reason, and that reason is something you should learn about instead of armchair-rejecting it.<p>Try tuning out your inner rule-of-thumb linter for a weekend and really give it a try.
评论 #9011016 未加载
评论 #9010079 未加载
评论 #9012606 未加载
评论 #9011054 未加载
yuchiover 10 years ago
Seriously please stop making assumptions on Titanium without knowing a thing about it.<p>&gt; With the latter, you&#x27;re also interfacing directly with native objects all the time, which is doomed to fail performance-wise. React Native actually performs the layout on a separate thread [...]<p>Wrong. With Titanium you work with proxies. And JS is in a separate thread. The only actual difference between ReactNative and Titanium on this side is the functional&#x2F;fully-declarative&#x2F;almost-stateless vs imperative DOM-like philosophy.<p>Let me slip this through: «if you don’t know something then don’t make it look like you do».<p>Sorry for the rant. I’m just very upset from yet another post like this.
评论 #9010467 未加载
评论 #9010093 未加载
apiover 10 years ago
I&#x27;m looking forward to desktop UIs also being supported by something like this -- e.g. native Windows, GTK+, and Cocoa widgets. Then we&#x27;d have a true framework for writing GUI apps that can share most of their code across the whole range of platforms, which would make me literally stand up and start singing right now. Lalalalalalala!<p>If you coupled this with conditional stuff around what kind of form factor you&#x27;re on (screen size, etc.) you could design mobile first UIs that gracefully <i>enriched</i> on a larger form factor. Lalalalalala!<p>I don&#x27;t know of Facebook cares, but I WILL PAY FOR THIS! For a well-engineered modern platform that did all of the above I would pay thousands of dollars. So if the choice comes down to staying free and abandoning this effort vs. making it a profit center, please for the love of all that is holy take my money.<p>Really when you look at the labor costs of developing parallel UI efforts on many platforms, a cross-platform dev system that delivered a <i>high quality</i> native-feeling experience across every major platform could be worth at least tens of thousands of dollars to millions of people.
评论 #9013241 未加载
saosebastiaoover 10 years ago
I love the concepts behind React, and I agree this is a huge deal...I just wish it weren&#x27;t javascript. It is a terrible language, and the languages that compile to javascript are a poor substitute (bloated code sizes, interop issues, poor runtime performance, etc). For a framework that is all about state machines (a good thing! All UIs are state machines), I hate that there aren&#x27;t better ways to model them in the language. I would kill to be able to do React in F# or OCaml.
评论 #9009888 未加载
评论 #9010014 未加载
评论 #9010081 未加载
评论 #9010577 未加载
评论 #9012370 未加载
评论 #9012977 未加载
评论 #9011229 未加载
评论 #9014063 未加载
评论 #9010023 未加载
评论 #9010026 未加载
jobuover 10 years ago
Sounds amazing... What are the challenges, limitations, and tradeoffs for using React Native? There have been similar initial reviews of Titanium, Phonegap, and Xamarin, but in my experience they all have serious issues that make native development a better option in most cases.
评论 #9009921 未加载
abaloneover 10 years ago
Probably the most useful way to get a read on this is to compare it to Titanium, also a JS-to-native framework that runs JS on a separate thread. The biggest problems with Titanium were not performance. A couple of the most common complaints:<p>1) You don&#x27;t have full access to native SDK functionality (e.g. all the latest cool things in iOS8). You&#x27;re going through a cross-platform API wrapper and limited to the choices of the framework architect. So it can be frustrating to go down this path only to find you still can&#x27;t quite get the native experience you want.<p>2) Debugging is harder because the native toolchain (e.g. Xcode) doesn&#x27;t understand the framework. You have to rely on tools provided by the framework.<p>AFAICS the author doesn&#x27;t address these issues. He seems to focus largely on the (theoretical?) performance optimization of not crossing the JS-to-native bridge as much in React... by being even more isolated from the native APIs and doing more work in JS. But even if true, performance was not the chief complaint with the closest predecessor to this.
评论 #9012236 未加载
jordanlevover 10 years ago
&gt; the mess of HTML and CSS get in the way of frameworks instead of helping them<p>I totally understand where the author is coming from, and do agree... BUT there is a flip side to this, which is that HTML and CSS enable us to come up with and implement totally unique designs and interfaces. The lack of standard layout and complex &quot;widgets&quot; is definitely a pain in the ass, but it also enables a lot of unique-looking websites and designs. It&#x27;s kind of a pet peeve of mine when platforms&#x2F;CMS&#x27;s try to output markup instead of just providing data to the view layer... they are always outputting the &quot;best practice&quot; (if lucky) at the time they were built, and then a year or two later you want to do things a different way and you&#x27;re stuck.<p>So I&#x27;m super excited about React.js and love the simple mental model with flux etc., but another part of me also worries that one can&#x27;t dictate the markup exactly the way one wants because it has to be recognizable to the virtual dom as well (or the iOS view in native, or whatever other front-end React will output to). Maybe someone with more React.js experience can enlighten me about this though? (I&#x27;ve only dabbled).
评论 #9010119 未加载
datashovelover 10 years ago
I get this weird feeling that React Native has been created as a stand-in until webview is truly ready to take over mobile. I can&#x27;t imagine a scenario where by end of 2015 (or early 2016) mobile webview technology won&#x27;t be sufficient for 99% of mobile apps.
mhdover 10 years ago
So if this is native widgets etc., the main point is being able to write this in JavaScript, right? Anything in it for those who don&#x27;t consider this inherently beneficial?<p>Souns a lot like GWT, s&#x2F;Enterprise &quot;architects&quot;&#x2F;Web &quot;ninja&quot;&#x2F; to me.
评论 #9011046 未加载
fidotronover 10 years ago
OK, so how long before we backport the Android UI toolkit to WebGL using GWT and get rid of HTML and CSS altogether? Or even just write a sane new one?<p>Very interesting that this stuff comes from Facebook, who have very little concern about being indexable by search engines.
评论 #9010900 未加载
jsprogrammerover 10 years ago
The code style really reminds me of ExtJS circa 2.x (not sure what it&#x27;s like now), which was pretty good at what it set out to do. However, React Native requires compiling down to various different platforms which means having to maintain multiple compatibility layers to continually shift to keep up with the native vendors. You&#x27;re also pretty much stuck with proprietary distributors as well. Fun. Fun.<p>This does look interesting, but honestly, I think this can either already, or very soon, be replicated on the web, a platform which holds tremendous advantages that native will likely never be able to catch up to. Perhaps there&#x27;s an argument that these apps can also be translated to the web when their time comes, but I wonder what sacrifices are being made in the name of going Native?<p>React Native seems to be an attempt to fight in the opposite direction (Web -&gt; native) while the real momentum is going the other way (native -&gt; Web), and the best part is, you don&#x27;t even have to do anything to get it, the major players are building that open ecosystem for us.
评论 #9010890 未加载
评论 #9010607 未加载
评论 #9010487 未加载
评论 #9010319 未加载
评论 #9013165 未加载
swanifyover 10 years ago
As someone who has developed many apps using Appcelerator Titanium, I am looking forward to getting my hands on this to see where the differences lie.<p>I know that it has taken Titanium years to mature, so I wonder if it will take a similar amount for React to iron out the bugs - I&#x27;ll be surprised &#x2F; pleased if they hit the ground running.<p>Hopefully they&#x27;ll hurry up and make it public!
pothiboover 10 years ago
I&#x27;m assuming React Native can load external JS files over the network? If that&#x27;s the case, then I understand why Facebook is building this.<p>They could have control of their application and behavior and make even more changes than before without re-submitting to the App Store.
评论 #9010886 未加载
评论 #9010907 未加载
GrinningFoolover 10 years ago
<p><pre><code> &quot;React Native actually performs the layout on a separate thread, so the main thread is as free as it can possibly be to focus on smooth animations (it also provides flexbox for layout, which something that no other framework provides)&quot; </code></pre> Interestingly - though perhaps increasingly less relevant - this is how BlackBerry 10 platform native QML-based applications work as well.
akrymskiover 10 years ago
I can&#x27;t help but feel that all this energy would be better spent on improving webkit itself (such as running JS in a separate thread to the UI)
Taigover 10 years ago
For me the best of the web has always been HTML &amp; CSS which I miss so often when dealing with native widgets or creating my own. The only thing that used to scare me off the web was JavaScript. Give me a HTML &amp; CSS frontend, please. But let me keep my beloved Scala or Swift ;)
serve_yayover 10 years ago
I&#x27;m still very excited to try it. I agree that this is the way forward for writing apps. I have attempted to write iOS apps before, and the problem is not objc, I actually kinda like objc. The problem is the damn view layer.
falcolasover 10 years ago
Didn&#x27;t we do this already with Qt? Or Java? Or wxWidgets? Or OpenGL? Seems like cross-platform UIs have been a reality for quite some time.<p>What does React bring to the table that these do not?
评论 #9010309 未加载
bsaulover 10 years ago
Wonder if the ability to easily refresh the view will make a difference to ios dev used to the wysiwyg approach by xcode for building views.
malandrewover 10 years ago
This is yet another reason why you shouldn&#x27;t use animations in CSS3 and should do them in JavaScript. I honestly don&#x27;t understand how behavior (which is what animations are) got baked into a declarative style language.<p>Layout (which is also behavior if the layout changes with the dimensions of the viewport) and animations are two things that need to be removed from CSS and implemented in JavaScript.
评论 #9010684 未加载
arxiiover 10 years ago
sounds interesting. not a fan on reacts workflow because i use jade templates w&#x2F; backbone that get compiled to html for me and its much less code, but separating javascript and native components into different threads is a great idea.<p>i believe we should be able to see javascript being used as a responsive language portable across all devices and being used to control native components as a separate layer.<p>im actually working with a flexbox xml&#x2F;html wrapper framework for iscroll that i might use to build a responsive app that not only does pc animations but performs alot of nice mobile slider animations that seem to go at 60 fps on modern handhelds, but its up to emerging gapping technologies like cordova and this to make the use of future &quot;responsive ui kits&quot; which i believe should be emerging soon.
regularfryover 10 years ago
Soooo... Strap a code editor component on the front and call it Hypercard 9000?
crazychromeover 10 years ago
Do a Ctrl + F, then type &quot;android&quot;. How many matches have you seen amongst 122+ comments? 2, including this one!
crudbugover 10 years ago
This made me think differently =&gt; JS can be used as a control layer and the native components are the data layer.
eclipxeover 10 years ago
Why not Titanium?
coldcodeover 10 years ago
Will React&#x27;s concepts every make it as truly native code I wonder?
zkhaliqueover 10 years ago
OK this DOM stuff is great but what about the other HTML5 interfaces, like sending requests to the server, localStorage, etc. ?
评论 #9010485 未加载