terrysahaidak / TurboModuleExample

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Native Turbo Module example

This repository is a Turbo Module implementation of Clipboard Core React Native module.

How to make your own Turbo Module

  1. Create a new npm package
  2. Add react-native-tscodegen and react-native-tscodegen-types as devDependencies
  3. Copy TurboClipboard.podspec, rename it, change library name, author etc
  4. Implement TurboModule.ts file: define all the methods in the Spec interface
  5. Copy react-native-tscodegen.json, rename library name etc
  6. Add codegen script to package.json with the following command to run: react-native-tscodegen ./react-native-tscodegen.json
  7. Run npm run codegen - it will generate Spec files - the JSI bridge which you should include in your sources. Your native module interface should extend NSObject <ModuleNameSpec> - the generated spec by the codegen of your TurboModule.ts
  8. Add your implementation source files following the example of TurboClipboard header and mm file
  9. Change source_files in the PodSpec accordingly
  10. Include in your TurboModule enabled application
  11. Use it

LICENSE

MIT

About


Languages

Language:Objective-C++ 44.5%Language:Objective-C 26.8%Language:Ruby 19.7%Language:TypeScript 8.9%