This post is meant to be read in the context of its parent post "Lessons Learned on a React-Native Project". If you've stumbled on this particular page randomly, I'd recommend jumping over to that post and starting from there.
To be honest, this lesson applies to any cross-platform library, and is my biggest takeaway from this project. Going into it I'd built up React-Native in my head as the solution to all my cross-platform problems. I mean, come on, we're just writing JavaScript! And it's a simple compile to get it working across both platforms! Amaaaaaaaazing!
... Yeah nah mate.
Cross-platform development is bloody hard. Here's what cross-platform framework developers are trying to accomplish;
- Present something familiar (JavaScript/React, C#.NET/XAML) and map it to concepts relevant to mobile development.
- Write APIs to essentially map the things we're familiar with into the underlying native components that will actually be rendered.
- Abstract away several build and/or dependency systems, and have it all magically "just compile".
- All while being performant.
This shit is hard. Having spent a bit of time with both React-Native and Xamarin I have a huge amount of respect for what these developers are trying to do. I get super frustrated with both of these platforms (and show no bones about letting those around me know it), but that doesn't mean I don't admire what the developers have managed to do up to this point.
As a result of this complexity, you're probably going to hit some pretty crazy stuff... Incorrect dependency resolution, broken builds (that worked locally I swear!), inconsistent rendering between platforms and things you would never think can happen. I have a story on this last bit, but I'll save it for later in this post.
Next Section -> "React-Native does not shield you from needing to know about the native aspects of the project"