Connect Native Modules C++ in React Native > 0.60.
There is a more straitforward way to connect C++ in React Native. The CxxModule is it, and there is a sample as well. Unfortunately, setup CxxModule on Android right now is getting a little difficult. Modules allow you to do:
- Encryption
- Image Processing
- and other...
And you are willing to do a little extra work you can use Djinni. Djinni is a codegen for different languages, but there still some overhead.
Especially on Android, a JS call might be in such flow: JS -> RNBridge in JS VM -> JNI -> Android VM -> Java NativeModule -> JNI -> C++ The back and forth between JNI is redundant and wasted in command serialization/deserialzation.
This project generates interface bindings for Objective-C and Java. Once you create the wrapper code for C++, you can create Java and Objective-C classes that integrate with React Native. Thus React will call Obj-C/Java which will call C++. Profit.
React Native version > 0.60
$ yarn installUse data from a table to convert values.
| Plugin | README |
|---|---|
| jsArgAsBool | (args, 0) |
| jsArgAsInt | (args, 1) |
| jsArgAsDouble | (args, 2) |
| jsArgAsString | (args, 3) |
| jsArgAsArray | (args, 4) |
| jsArgAsObject | (args, 5) |
MIT

