
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
react-native-codegen
Advanced tools
The react-native-codegen package is a tool used in the React Native ecosystem to generate native code for JavaScript components and modules. It helps in creating type-safe interfaces between JavaScript and native code, ensuring that the data passed between them is correctly typed and validated.
Generating Native Modules
This feature allows you to define a native module in a JSON format, which react-native-codegen will then use to generate the corresponding native code. This ensures type safety and consistency between JavaScript and native code.
```json
{
"name": "MyModule",
"type": "module",
"methods": {
"myMethod": {
"type": "function",
"params": [
{ "name": "param1", "type": "string" },
{ "name": "param2", "type": "number" }
],
"returnType": "void"
}
}
}
```
Generating Native Components
This feature allows you to define a native component in a JSON format, which react-native-codegen will then use to generate the corresponding native code. This ensures that the component's props are correctly typed and validated.
```json
{
"name": "MyComponent",
"type": "component",
"props": {
"title": { "type": "string" },
"count": { "type": "number" }
}
}
```
Generating Event Emitters
This feature allows you to define an event emitter in a JSON format, which react-native-codegen will then use to generate the corresponding native code. This ensures that the events and their data are correctly typed and validated.
```json
{
"name": "MyEventEmitter",
"type": "eventEmitter",
"events": {
"onEvent": {
"type": "function",
"params": [
{ "name": "eventData", "type": "object" }
]
}
}
}
```
The react-native-create-library package is used to create a new native module library for React Native. It provides a boilerplate for creating native modules but does not offer the same level of type safety and code generation as react-native-codegen.
The react-native-builder-bob package is a CLI tool for creating and building React Native libraries. It focuses on setting up the project structure and build configuration but does not provide code generation capabilities like react-native-codegen.
yarn add --dev react-native-codegen
Note: We're using yarn
to install deps. Feel free to change commands to use npm
3+ and npx
if you like
v0.70.7
POST_NOTIFICATIONS
and deprecate POST_NOTIFICATION
(b5280bbc93 by @dcangulo)FAQs
⚛️ Code generation tools for React Native
The npm package react-native-codegen receives a total of 59,236 weekly downloads. As such, react-native-codegen popularity was classified as popular.
We found that react-native-codegen demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.