TurboModuleExample
TurboModuleExample copied to clipboard
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
- Create a new npm package
- Add
react-native-tscodegenandreact-native-tscodegen-typesas devDependencies - Copy
TurboClipboard.podspec, rename it, change library name, author etc - Implement
TurboModule.tsfile: define all the methods in the Spec interface - Copy
react-native-tscodegen.json, rename library name etc - Add
codegenscript topackage.jsonwith the following command to run:react-native-tscodegen ./react-native-tscodegen.json - Run
npm run codegen- it will generate Spec files - the JSI bridge which you should include in your sources. Your native module interface should extendNSObject <ModuleNameSpec>- the generated spec by the codegen of yourTurboModule.ts - Add your implementation source files following the example of
TurboClipboardheader andmmfile - Change
source_filesin the PodSpec accordingly - Include in your TurboModule enabled application
- Use it
LICENSE
MIT