This is an example library that explains how anyone can build jsi modules from scratch in React Native. This code is written as a support project for my blog.
npm install react-native-simple-jsi
For iOS also run pod install
in /ios
folder.
You must have Android NDK and CMake installed on android to build the library.
The following methods are implemented.
The relevant code is present in cpp/example.cpp
file.
helloWorld():string;
multiplyWithCallback(x:number,y:number,callback:(z:number) => void):void
multiply(x:number,y:number):number
The relevant code on android is in android/cpp-adapter.cpp
and ios/SimpleJsi.mm
on iOS.
getDeviceName():string
setItem(key:string,value:string):boolean
getItem(key:string):string
import simpleJsiModule from "react-native-jsi-template";
simpleJsiModule.helloWorld() // returns helloworld.
Run the example app for more.
The initial work done by authors of the following libraries has helped a lot in writing the blog and keeping this repo updated.
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT