React Native is great, because it provide superior DX while being able to provide native experience in apps. But what exactly is native?

A native application can probably be defined as following,

  • It should feel at home on a device, using familiar UI, patterns and performance
  • It should be able to take advantage of full functionality in the OS

Let’s focus on the first point, because we know we can take advantage of of full OS functionality in React Native.

There seems to be a misconception that when you write native Java/Obj-C/Swift code, it makes the app native. Probably in a developer’s mind it does. But the language doesn’t matter to the user. If the same feature is implemented in JS and the user can’t tell the difference, does it really matter? Nope.

Recently Martin Konicek has been advocating about why you shouldn’t re-implement existing OS patterns in JavaScript, because it’s extremely difficult to match the native gestures and animation curves when you re-implement it in JavaScript. Let’s drop “JavaScript” from Martin Konicek’s statement, and it still holds true. In short, you should avoid re-implementing existing OS patterns like gestures and animations, language doesn’t matter.

When we’re working on implementing a feature, and the animations are something we came up with, and we need to implement it in scratch, should we build it in JavaScript? Definitely, because it helps keep the implementations consistent across platforms, and React Native has a great API for animations. Performance of the animations is not a concern, because React Native can already run animations on UI thread which gives you the same performance as you would get when you write it in Java/Obj-C.

Basically, avoid re-implementing native transitions and gestures, use the existing components/libraries provided by the OS. What’s important is the experience, not the language. If you must re-implement it, and you can do it in JavaScript, go for it.

No Comments