News for hackers. Stuff that matters.
Re:React Native for Android by jbigelow76 on Monday September 14, 2015 @02:22PM (#10216544)
Question for everybody doing some sort of cross platform mobile dev.

How common is it to have NO experience with a platform's native libraries? In other words you didn't go from ObjC or Java to React Native/Cordova/Xamarin to try and re-use code but because you know JS or C# and weren't concerned about learning the native platform.

For any that started out with no native platform knowledge did you start to dip into it as you got more experience with the cross platform tool and started bumping up against any potential limitations?

I've been flirting with Swift when I have some (rare) downtime, to get a foundation, but maybe that's not even necessary anymore given the effort companies like Facebook/Xamarin/Telerik* are putting into abstracting away the native platforms.

[*] I intentionally left Cordova off that list as "native" native and "phonegap" native are two different things.

Re:React Native for Android by lhorie on Monday September 14, 2015 @03:31PM (#10216959)
I got into native development with no experience in the iOS/Android APIs, coming from a web dev background. I did know Java and C from working on side projects, and read up on Objective-C before, though. At my previous company, all the developers doing native work had no prior experience w/ mobile development (i.e. they primarily had backend C# experience)

I dabbled w/ Cordova and friends before, and did some work to wrap webapps in thin native shells earlier on, but there was always a very strict separation between the "sandboxed" webapp and the native code, if any.

Webapps can and do work just fine for CRUD applications, but right now, I'm of the opinion that if you want to really leverage the hardware APIs or the native ecosystem, you're better off learning the native platform, because you get no syntax mismatch friction on Stack Overflow etc, compared to Xamarin / React Native / Ambly / whatever

Also, this opinion might be unpopular among the js devs who like lightweight text editors (disclaimer: I'm one), but the heavy IDEs for Java/ObjC/Swift are actually immensely useful once you get familiar w/ their features. The static typing provided by those languages helps a lot in large refactors, in API discoverability/autocompletion and in reasoning about the codebase in general.

Re:React Native for Android by tmail21 on Wednesday September 16, 2015 @02:27AM (#10224984)
We are a startup that went the React Native route. We initially started with Ionic, but then switched to React Native. You can read about our experiences here: https://tmail21.com/blog/why-our-startup-chose-react-native-...
Re:React Native for Android by johncolanduoni on Monday September 14, 2015 @07:44PM (#10218191)
If you stick with the tools which actually don't abstract the native platforms (e.g. RoboVM and Xamarin), I think you will learn native development quite easily. I've taken this approach, and I've had no trouble using documentation/StackOverflow to write equivalent code in Java/C#. Since pretty much all the APIs in these tools are 1-1 with the native APIs, I've also had no trouble going in the reverse direction and writing Swift/Objective-C/Java. You will still need to learn the languages, but you won't need to re-learn the APIs (which is the time consuming part).

Personally, I see little to no disadvantage with using these particular types of tools, especially if it means you can use languages like Scala, C#, and F# instead of Objective-C and Java.

Re:React Native for Android by tluyben2 on Tuesday September 15, 2015 @08:28AM (#10220199)
I started serious app dev with Xamarin before I ever touched ObjC. After having implemented a ton of apps I am able to move between Xamarin/RoboVM/ObjC/Swift/Java quite easily. I dabbled with Cordova and Titanium before that a bit but that was not a good experience for me.
Re:React Native for Android by nabaraz on Monday September 14, 2015 @02:32PM (#10216607)
I would love to see some discussion around this as well. I have been playing with Apache Corodova and Windows 10 SDK lately and they look very promising. Being a web developer, I found them to be easy to get started.

Are there complex apps built using phonegap/swift/cordova? What are the limitations? I know Facebook tried with a 'web app' approach and reverted back to native solution. But that was years ago.

Re:React Native for Android by o_____________o on Monday September 14, 2015 @02:40PM (#10216666)
Using Cordova, you will always be behind any and all Mobile Safari WebKit et al bugs. This not a big deal when pushing layout around a webpage, but it can be crippling for app development as the app grows in complexity and you crave native-quality interactions. Mobile Safari's Webkit implementation has a staggering list of severe bugs. Developing under it can become a nightmare of hacks and backpedaling. Been working on Cordova nearly full time for two years now. So much wasted time. React Native is a big deal, and is very different.
Re:React Native for Android by GrinningFool on Monday September 14, 2015 @05:34PM (#10217646)

    > This not a big deal when pushing layout around a webpage, 
    > but it can be crippling for app development as the app 
    > grows in complexity and you crave native-quality 
    > interactions 
Even on the fastest phones, web-based (including wrapped web components) simply don't offer the native experience. They come close, but there's always a slight but perceptible performance difference; and often a visual difference depending on what you're using.

I realize people really like the theoretical write-once behavior that you get for simple apps when using a javascript platform, but I've been waiting for years for web-based interactions to provide native quality - and I begin to suspect we'll never get there.

If you want native-quality interactions, the only solution is a native application and not common tooling via a javascript layer that runs atop the already not-as-performant-for-UI browser level. This makes your life harder as a developer, but gives your users the best possible experience for their platform.

Alternatively, if you're willing to give your users a good-but-less-than-native-quality experience, that's the niche filled by those tools.

Re:React Native for Android by thekingshorses on Monday September 14, 2015 @08:41PM (#10218348)
I used to think same way, but 99% of your user won’t feel that way.

My hacker news app is a hybrid app. Available on iOS/Android/Windows/Mac and web, and I harldy see any one compalining about not being native.

There are some legit issues and peole think only way to fix is go native. Only reason I have not fixed those issues because I don’t have time, or I don’t use that functinality.

Re:React Native for Android by boundlessdreamz on Tuesday September 15, 2015 @12:23AM (#10218935)
I use the app on Android and it's the best HN app on Android but at times it is obvious that it is not native and it has some issues as you said. What I have encountered are

1. I get an error message "Unable to load xxxx" at times (forgot the exact message) and the app closes.

2. If I switch between article/comments it always reloads

3. At times clicking on the comments icon doesn't work when you are in article mode.

4. I can't long press on links in comments to share it to browser/pocket etc

Compared to reddit apps like Relay, the HN app does feel much more basic.

Re:React Native for Android by rilut on Tuesday September 15, 2015 @02:34AM (#10219264)
Also the slide animations when I push the back button feels sluggish in my phone
Re:React Native for Android by windsurfer on Monday September 14, 2015 @07:40PM (#10218178)
> Even on the fastest phones, web-based (including wrapped web components) simply don't offer the native experience. They come close, but there's always a slight but perceptible performance difference

Honestly I used to believe this, but not after the release of the iPhone 5 and 6. Though there is no perceptible difference, it takes a lot of work to mimic the UI in terms of animations, opacity, and response actions, so most apps just use the default web technology which include things like a built-in 300ms delay, no response to clicking a link, etc.

Re:React Native for Android by SomeCallMeTim on Tuesday September 15, 2015 @12:55PM (#10221687)
> it takes a lot of work to mimic the UI in terms of animations, opacity, and response actions,

Which is already done for you in Ionic -- including disabling the 300ms delay.

Re:React Native for Android by kbutler on Tuesday September 15, 2015 @04:45PM (#10223058)
I'd like to believe that, but can you cite some web-app or webview-based example applications?
Re:React Native for Android by cbsmith on Monday September 14, 2015 @02:42PM (#10216679)
More accurately: with Cordova, you will always be behind on iOS.
Re:React Native for Android by lewisl9029 on Monday September 14, 2015 @03:07PM (#10216831)
Speaking as a web developer, this is sad, but true.

However, what's even sadder to me is the fact this continues to be true despite the fact that, believe it or not, the web has been the platform where most of the innovation in UI development paradigms has been taking place in the past few years. And I don't just mean in terms of the sheer number of new things coming out.

The web community pioneered UI development paradigms involving functional programming techniques and immutable data, and have brought its benefits to other platforms (through projects like React Native). I personally would never want to go back to the old way of building UIs. And I suspect I'll feel the same way about client-centric data fetching when I get to try out Relay/GraphQL, Falcor, Om Next, etc in production.

I really want Firefox OS to be successful for this exact reason. I don't want to have to make compromises between the best experience for my users and the best experience for myself as a developer. With a platform that makes web the native UI technology, we shouldn't have to make this compromise in theory, but Firefox OS's execution thus far has left much to be desired.

Re:React Native for Android by pjmlp on Monday September 14, 2015 @03:40PM (#10217020)
I don't believe it.

As someone with lots of native UI experience, that has to occasionally support web projects, the web is just plain clunky and playing catch up with the RAD tooling we enjoy since the mid-90 on native platforms.

Re:React Native for Android by lewisl9029 on Monday September 14, 2015 @03:51PM (#10217088)
I was mostly referring to development paradigms and methodology in my original post, but in terms of tooling, I personally haven't see any tooling on the native side even approach the increased productivity provided by the instantaneous feedback loops that countless hot-reload implementations can offer for the web.

https://github.com/gaearon/babel-plugin-react-transform/

http://gaearon.github.io/react-hot-loader/

https://github.com/bhauman/lein-figwheel

Re:React Native for Android by mirkoadari on Monday September 14, 2015 @04:58PM (#10217418)
Android has JRebel for Android for hot reloads...

https://zeroturnaround.com/software/jrebel-for-android/

Re:React Native for Android by lewisl9029 on Monday September 14, 2015 @05:33PM (#10217634)
I was not aware of this, so thanks for bringing it up.

It's a pretty amazing technical feat that this works at all, but I have a hard time imagining this would work well in practice for changes to anything other than maybe method bodies and templates though. Java's style of object orientation generally means there's plenty of tight-coupling between application state and operations on the application state, which would probably make life very difficult for any hot-reload implementation.

But regardless, it does exist and apparently works well for a lot of people. It looks like I was just ignorant when it comes to native tooling.

Re:React Native for Android by mirkoadari on Monday September 14, 2015 @05:40PM (#10217694)
Its definitely hard, but JRebel has had 7 years to figure this stuff out and so far seems to work just as well on Android.

Only one way to find out tho :) Trying it out for oneself.

Re:React Native for Android by mixmastamyk on Monday September 14, 2015 @04:25PM (#10217250)
I've done similar with inotify (dnotify before that) and Python now for over a decade, and it is an interface than can automate anything. I use it with doc generators also.

I believe I used something similar called fam in the 90's but that may have only been on SGI.

Re:React Native for Android by lewisl9029 on Monday September 14, 2015 @05:14PM (#10217506)
Filesystem watching is only part of the equation though. Live reload has been available for the web and various other platforms for a long time, but the traditional approach to live reloading does not preserve application state.

These new hot reload implementation allows your app to be reloaded with your new changes without affecting the state of the application, and is not practical unless your application has been developed with a focus on functional techniques and careful management of application state.

This probably doesn't sound like a significant difference, but in practice, it is a huge boost to productivity, especially in a non-trivial app where reloading the entire app and then reproducing the app state manually with every file change can become quite tedious.

Re:React Native for Android by lispm on Tuesday September 15, 2015 @07:18AM (#10219958)
That's why Common Lisp / CLOS has functionality like

  * CHANGE-CLASS (change the class of an object to a different class),
  * update-instance-for-different-class (updating the object after a class change, one can provide methods which will be lazily called when needed),
  * update-instance-for-redefined-class (updating the object after redefining a class, one can provide methods which will be lazily called when needed),
  * LOAD (load source or machine code),
  * EVAL (eval expressions)
  * COMPILE (compile code in memory to memory), ...
One then always develops with a live application. Classes and objects can be updated in-place...
Re:React Native for Android by ufmace on Tuesday September 15, 2015 @05:12PM (#10223244)
Which can be really cool, but has its downsides:

Hey cool, I can change these classes live!

Let's solve this tricky problem by changing the class at runtime. Cool, it works, now on to the next problem.

2 years later...

What's causing this super-weird bug? It's like the code isn't doing what it says at all.

1 week of debugging and head-banging later...

Oooh, something got screwed up in that runtime class change code. Fixed.

2 years later, repeat...

Re:React Native for Android by lispm on Wednesday September 16, 2015 @01:52AM (#10224900)
Is that something you've experienced?
Re:React Native for Android by ufmace on Wednesday September 16, 2015 @03:21PM (#10229107)
Not directly, mostly because I haven't done that much work in any language where you can do that. But I have had that kind of experience when trying to figure out what Ruby code is actually being run somewhere. I may be heading that way with C#, with the occasional overuse of dynamic and reflection.
Re:React Native for Android by mixmastamyk on Monday September 14, 2015 @06:26PM (#10217923)
Sounds neat, I do love a rapid feedback loop, although I may have done similar with a debugger and the reload built-in come to think of it.

In the types of apps I think we're talking about, typically most state is in the database and not much is going on in the client.

Re:React Native for Android by pjmlp on Tuesday September 15, 2015 @04:36AM (#10219567)
You mean like development with Smalltalk and commercial Common Lisp environments?

Or designing GUIs WYSIWYG with Delphi, XAML with Blend, the UNIX 4GL in the 90?

Re:React Native for Android by lewisl9029 on Tuesday September 15, 2015 @01:45PM (#10222014)
Yes, Smalltalk and Common Lisp environments probably did offer similar experiences.

Tooling for web development has probably been heavily inspired by the tooling available for CL and Smalltalk, but I don't think it's fair to say it's still playing catch up. The tooling ecosystem for the web has long since caught up to the best native ever had to offer, and is now advancing the state of the art faster than any other tooling ecosystem out there today.

Re:React Native for Android by bad_user on Monday September 14, 2015 @06:43PM (#10217993)
I was pleasantly surprised that the latest Chrome for Android delivers push notifications for Facebook due to a new W3C API, and Facebook's mobile web interface has been in good shape for some time, so right now Facebook's native app is completely optional. Which is a good thing, given how many permissions Facebook's app requires. Apparently this was announced back in April, but I just noticed it, due to Facebook being updated: http://blog.chromium.org/2015/04/reaching-and-re-engaging-us...

Along with other things such as the app manifest, Chrome on Android is leading the pack in terms of making the mobile web feel native. Previously this title belonged to iOS Safari, unfortunately Apple dropped the ball a long time ago.

I've been a long time Firefox user and I'm using Firefox on Android as well. But I do think they could do a better job, I mean I'm all for Firefox OS and what that means for Mozilla, but I feel their Android effort is subpar and that's a shame, given that Android is the modern Windows and there's plenty of room for Firefox on it. I mean right now Firefox is the only app I have that wasn't updated for the material design guidelines and they didn't even try to fake it. And that would be OK, but I've been waiting for things to get fixed ever since forever, like the Add to Homescreen functionality which is completely broken.

But anyway, people that bemoan web interfaces are usually ignorant of present day web interfaces that people use.

You can't name an email client that's more usable than GMail's web interface. And surprisingly FastMail on a mobile browser is almost as usable as native GMail, being all web. Facebook and Google Maps are 2 other example of having awesome mobile web interfaces. Of course, people focus on shiny rather than utility. But I don't care how usable or shiny your iMessenger or your FaceTime is, because I don't own an iOS device, not anymore. And your native app might be great, but if it doesn't have a web presence, I personally don't care much about it because I change devices often.

Re:React Native for Android by tracker1 on Tuesday September 15, 2015 @08:33PM (#10223988)
I disagree... They've removed functionality from the mobile web interface. Specifically, I'm unable to tag friends when sharing a post. When I share a video link (youtube, etc) it no longer creates a thumbnail or embeds the link as it does on desktop web. I'm unable to tag friends inside new/shared posts, only in comments.

I won't use the full client because it eats my battery, and they separated the messenger interface requiring yet another app with battery eating features.

Re:React Native for Android by jbigelow76 on Monday September 14, 2015 @03:05PM (#10216819)
I don't know about React Native, but Telerik's open source project NativeScript promises to always have 0 day support of all native platform features since it's reflecting over the native platform's libraries to expose to its own API.

React Native and NativeScript seem to have all the upside of Cordova (transference of web dev skills to native platforms) with none of the downsides (lag in new OS feature implementation, webview wrapped apps), I wonder if Cordova's days of relevance are numbered.

Re:React Native for Android by matthewrhoden1 on Monday September 14, 2015 @02:43PM (#10216684)
Sworkit was supposed to be an example of a complex app for ionic, not sure what else is out there. I've used that app and can say it seems pretty solid (no crashing, locking up my phone, etc.)

http://blog.ionic.io/built-with-ionic-sworkit/

I did a pet project using the vibration feature and it worked pretty well, but haven't tried on an iphone.

I can't speak for pushing the limits of the hardware though.

Re:React Native for Android by lewisl9029 on Monday September 14, 2015 @02:54PM (#10216751)
Not sure how common it is, but I've worked on a few Cordova apps and have no native experience whatsoever.

I have ran into some roadblocks that required stepping into native development to fix up issues with Cordova Plugins (specifically for background operation), but I suspect that won't be necessary for a large majority of apps out there.

Personally, I find the Hosted Web App spec a very promising alternative to Cordova for app development with web technologies. You simply use the open web APIs (notifications, geolocation, camera, etc) for features that would normally require messing with plugins in Cordova, and they would just work.

https://developer.mozilla.org/en-US/Marketplace/Options/Host...

It's such a shame that the biggest players (Android and iOS) probably have no plans to support it natively since it would greatly reduce developer lock-in. In the meantime, the ManifoldJS project can provide Cordova-based polyfills for your Hosted Web App, but then you'd have to resort to messing with plugins all over again for the only two mobile platforms that really matter...

http://manifoldjs.com/

Re:React Native for Android by declan on Monday September 14, 2015 @03:23PM (#10216914)
If you're going cross platform, the key is to know in detail the limitations of this approach, even if it takes longer to make that initial decision about what path to take.

Different cross-platform tools have different approaches, but as a concrete example take Corona SDK. You need no native platform knowledge and your app runs inside the Corona runtime, which makes some difficult things easy but some easy things -- third-party SDK integration, install source tracking -- difficult. And if the creator of the cross-platform environment has chosen not to support certain things, you're out of luck (and you're probably always going to be lagging even for things that are supported). On the other hand, you have only a single codebase to maintain and single-click builds for a lot of platforms.

As for Cordova, we spent some time testing if the performance was sufficient when building an early version of Recent News (https://recent.io -- v1.0 just released three days ago!). We concluded it was not. Boot times were slow, the UI felt very non-native, and overall performance didn't meet our requirements. Now that was a while ago and Cordova may have improved, and hardware performance certainly has improved, so maybe it's a better option today.

Re:React Native for Android by jbigelow76 on Monday September 14, 2015 @03:45PM (#10217055)
the key is to know in detail the limitations of this approach

There's the rub. If you don't know anything about the native platform then you "don't know what you don't know". The NativeScript demo shows how to pull in a native ObjC function (a string related method I think), but if you start with no background in the native libraries how would you even know when you could be leveraging a native library function instead of trying to recreate a sub-optimal approximation in JS. But if you have the foundation and know the native platform, why jump ship to JS at all? And then I'm right back where I started :)

Re:React Native for Android by vickychijwani on Monday September 14, 2015 @04:12PM (#10217187)
> But if you have the foundation and know the native platform, why jump ship to JS at all?

I'm a (native) Android and JS developer. The primary reason I'm excited about React Native is that I don't have to go through the tedious compile-install cycle for every little UI change. React Native will make prototyping/iterating on Android as easy as it is on the web. However my reasoning assumes that there will be almost no friction in terms of creating complex views in React Native. I'm curious to see if that pans out.

Re:React Native for Android by s73v3r on Monday September 14, 2015 @05:48PM (#10217729)
Not having used ReactNative before, how would that change? Wouldn't you still have to at least redeploy the app to the phone if you change the JS?
Re:React Native for Android by vickychijwani on Monday September 14, 2015 @05:59PM (#10217791)
> Wouldn't you still have to at least redeploy the app to the phone if you change the JS?

No, that's the beauty of it. All you need to do is shake your phone and tap the "Reload JS" option. Those JS files are served by some sort of a server that starts up on your dev machine when you first deploy the app. See https://facebook.github.io/react-native/docs/tutorial.html#d... (search for "reload js").

Re:React Native for Android by s73v3r on Monday September 14, 2015 @07:02PM (#10218055)
I assume this is only in dev mode, as opposed to release mode?
Re:React Native for Android by iLoch on Tuesday September 15, 2015 @01:57AM (#10219176)
Actually no, POCs have been made which allow you to deploy setups which allow for live updating apps in production. Apple even allows RCE as long as it's executed in the JS engine.
Re:React Native for Android by anshulsin on Monday September 28, 2015 @05:50PM (#10293461)
Got any sources for that? I've not found a single example of a react android app that shows "live updating apps in production". I'm talking about things like loading code seamlessly in the background from a CDN. There are examples for iOS though
Re:React Native for Android by declan on Monday September 14, 2015 @06:31PM (#10217946)
Quite right. It's true that if you don't have a background using the native libraries it's going to be difficult, so one approach would be talking to developers who do and doing research like reading blogs and discussions like this one...
Re:React Native for Android by pakled_engineer on Monday September 14, 2015 @06:12PM (#10217850)
I have zero native development experience on any mobile platform and write apps abstracted away in Scheme https://github.com/part-cw/lambdanative/wiki/Getting-Started

After you write/run a lot of tests to make sure the app does what it's supposed to (there's paid services for this kind of testing too) http://googletesting.blogspot.ca/2013/08/how-google-team-tes...

This React abstraction can use Chrome Developer Tools for debugging though, that's pretty awesome.

Re:React Native for Android by msoad on Monday September 14, 2015 @02:47PM (#10216705)
To my experience if all your apps do is showing tables of information and forms to put the information back in (classic WinForms app) any of the cross-platform stuff will work for you. Obviously React is rendering in native and I would prefer it.

But if your app is more advanced like a drawing app you should not use these cross platform stuff.

Re:React Native for Android by misiti3780 on Monday September 14, 2015 @03:05PM (#10216818)
or for iOS, any type of advanced animations. i like the idea of these platforms but if you building a mobile only app (like instagram when it launched) i cant imagine starting off with cross-platform tech stacks
Re:React Native for Android by aikah on Monday September 14, 2015 @04:21PM (#10217235)
You'll be limited by the widgets/apis whatever abstraction gives you. Sometimes it is enough, often it is not.
Re:React Native for Android by cbsmith on Monday September 14, 2015 @02:41PM (#10216672)
Game developers do it all the time with C++ using things like Marmalade.