News for hackers. Stuff that matters.
Re:Tempted to Abandon React Native for Native Android by ed on Saturday February 04, 2017 @03:56PM (#13569005)
Sounds like a good opportunity to build some performance-tuning muscle :)

Whether using RN or java, you'll want to know how to debug memory/performance issues on Android - they're mostly unavoidable on mobile devices!

(And maybe you can file some issues against React Native, too, which would be great and help the platform)

Re:Tempted to Abandon React Native for Native Android by SomeCallMeTim on Saturday February 04, 2017 @04:32PM (#13569193)
I've seen large images give native iOS and Android apps trouble. It's a challenging problem to solve no matter what.

And using ReactNative or NativeScript for the high level UI and a plug-in to handle pushing the bits around is probably still a better choice than going completely native.

Re:Tempted to Abandon React Native for Native Android by silkodyssey on Saturday February 04, 2017 @04:49PM (#13569290)
That's an interesting idea. The code to select and resize the images are native third-party plugins so in this case I am not sure anything more could be done.

I thought maybe the problem was that the app had to switch to another app to select the image. I reimplemented the code using a pure JavaScript plugin based on React Native's CameraRoll API to avoid switching apps and it still crashed when the image was selected for processing.

Re:Tempted to Abandon React Native for Native Android by frostik on Saturday February 04, 2017 @06:20PM (#13569700)
Just a wild guess - you said opening for processing. Depending on what you're doing with the file and how you're opening it the whole data get's passed over the bridge resulting in some catastrophic memory allocations. I would recommend tapping into the bridge communication and start checking if everything stays where it should. Some picker modules tend to send base64 encoded file beside the URL.
Re:Tempted to Abandon React Native for Native Android by silkodyssey on Saturday February 04, 2017 @06:58PM (#13569871)
The first module I tried was react-native-image-picker and yes it returns an object with base64 encoded data. What I do with this data is first, resize the image then display the resized image in an ImageView then upload the resized image to Firebase Storage.
Re:Tempted to Abandon React Native for Native Android by iOSGuy on Saturday February 04, 2017 @08:36PM (#13570253)
You definitely will want to write images to file, then pass the file path over the bridge. That's an easy solution.

I've been using React Native cross platform for over a year, and it has a ridiculous number of issues, but they're trade offs. There are benefits that come with it. React Native is just another tool, evaluate it as you would any other framework.

Re:Tempted to Abandon React Native for Native Android by silkodyssey on Saturday February 04, 2017 @04:16PM (#13569107)
That's a fair point about the opportunity to build some performance-tuning muscle but I imagine to do that would require solid knowledge of both React and Android. Where do I start? I am more inclined to go towards the native Android side first.

Aa a follow up, I just did a test with a native Android app doing the same thing: getting an image through an Intent. With the native Android app, the same image that was crashing the React Native app doesn't cause any problems.

Re:Tempted to Abandon React Native for Native Android by Gudin on Saturday February 04, 2017 @04:56PM (#13569322)
What does that have to do with performance? You shouldn't serialize hi-rez bitmap and pack it in Intent.

Activities/Intents should at least force you to be careful and not to keep all data around in your memory, but only pass data you really need.

Re:Tempted to Abandon React Native for Native Android by htormey on Saturday February 04, 2017 @05:03PM (#13569364)
Have you read this:

https://facebook.github.io/react-native/docs/performance.htm...

It might help with some of the performance issues you encountered.

Even if you decide to abandon React Native and just do Native Android or iOS, you are going to have to deal with performance issues at some point in your career.

Re:Tempted to Abandon React Native for Native Android by BoorishBears on Sunday February 05, 2017 @02:12AM (#13571325)
Are you sending an image bitmap in the actual Intent? I'm surprised you're not having it break when sent to Android's IPC mechanism which has fairly low size limits.

I would use a Content Provider to share the image instead.