minhaics / jsi-myself

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-native-jsi-template

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.

Installation

npm install react-native-simple-jsi

Prerequisites

You must have Android NDK and CMake installed on android to build the library.

Methods

The following methods are implemented.

Platfom agnostic

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

Platform specific

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

Basic usage example

import simpleJsiModule from "react-native-jsi-template";

simpleJsiModule.helloWorld() // returns helloworld.

Run the example app for more.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

About

License:MIT License


Languages

Language:C++ 26.9%Language:Objective-C++ 24.8%Language:Java 20.1%Language:Objective-C 14.5%Language:JavaScript 5.6%Language:CMake 2.7%Language:Ruby 2.7%Language:TypeScript 1.5%Language:Starlark 1.2%