How to write Native Modules for React Native

I'm very eager to share insights from my projects.

Ahsan Ali

3/16/20211 min read

Sometimes, we have to access native platforms APIs that are not available in Javascript.

For example, the integration of some custom hardware device with our application using Bluetooth. In this case, we have to use native API code for the Bluetooth module for both platforms, Java/Kotlin for Android and Objective-C/Swift for iOS.

There might be a case where you want to use your existing code implementation written in Objective-C, Java, Kotlin, or Swift in your React Native application, or you want to write some high-performance, multi-threaded code for things like video processing, machine learning, etc.

The Native Module system allows us to use native APIs code written in Java, Kotlin, Objective-C, and Swift with JS code. Native module works as a bridge between native APIs and React Native code, allowing us to run native APIs code within JS, send data to native APIs, and receive data from native APIs.

In this article, we will build the architecture to implement native modules in React Native.

Read more....