Socket
Socket
Sign inDemoInstall

@react-native/codegen

Package Overview
Dependencies
Maintainers
11
Versions
362
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native/codegen

Code generation tools for React Native


Version published
Weekly downloads
1.8M
increased by0.12%
Maintainers
11
Weekly downloads
 
Created

Package description

What is @react-native/codegen?

The @react-native/codegen package is a tool used in the React Native ecosystem to generate native code (Java for Android, Objective-C for iOS) from JavaScript. It is primarily used to bridge custom native modules and components in a React Native application, facilitating the communication between JavaScript and native code. This tool automates the process of creating the necessary boilerplate code for native modules, making the development process more efficient and less error-prone.

What are @react-native/codegen's main functionalities?

Generating Native Modules

This feature allows developers to generate the boilerplate code for native modules by specifying the platform (iOS or Android), the path to a schema file (schema.json) that describes the module, and the output directory. The schema file is a JSON file that outlines the structure and types of the native module's methods and properties.

"npx react-native codegen --platform ios/android --schemaPath ./schema.json --outputDir ./output"

Generating Native Components

Similar to native modules, this feature enables the generation of boilerplate code for native components. The process involves specifying a schema file (componentSchema.json) that describes the component's properties and events, allowing for seamless integration of custom native UI components into React Native applications.

"npx react-native codegen --platform ios/android --schemaPath ./componentSchema.json --outputDir ./output"

Other packages similar to @react-native/codegen

Changelog

Source

0.74.0

Breaking

  • OnLayout event batching changes (57e49b584d by @sammy-SC)
  • Delete traitCast and identifier traits (1170a68755 by @NickGerleman)
  • Remove static-behaves-like-relative errata (56b9b990de by @joevilches)
  • Make start/end in styles always refer to writing direction (e859f6c773 by @NickGerleman)
  • Remove APIs for reporting bundle download status to inspector-proxy, which does not use this information. (cfa02eec50 by @motiz88)
  • Delete configFilename and configKey arguments from iOS codegen CLI. Now we always expect them to be package.json and codegenConfig respectively. (33a44e68fc by @dmytrorykun)
  • Add errata for fix to marginStart/End for row-reverse flex direction (2dad663c28 by @joevilches)
  • Remove web performance logging from GlobalPerformanceLogger (53a2742e13 by @rshest)
  • Rename AbsolutePositioning errata (08eb985c33 by @joevilches)
  • Refactor React to get rid of JSIModule and its dependencies (6555205539 by @arushikesarwani94)
  • Get rid of old APIs in FabricUIManagerProvider (c2c346ccaf by @arushikesarwani94)
Android specific
iOS specific
  • Removing unused handler param on PushNotificationIOS.removeEventListener (fdf4ec3297)
  • Make bridgeless the default when the New Arch is enabled (c91af773fa by @cipolleschi)
  • CocoaPods: remove the ios_folder argument from the use_react_native function. (be0c353e18 by @dmytrorykun)
  • Codegen: mapping for numeric types is changed for Objective-C native modules. Float -> float; Int32 -> NSInteger. (5aa425c086 by @dmytrorykun)
  • Defining external codegen targets in react-native.config.js is not supported anymore. Define them as normal dependencies in package.json. (ca39a11b27 by @dmytrorykun)
  • Delete configFileDir CLI argument. (8a62d6135f by @dmytrorykun)
  • (072a2006e0 by @philIip)
  • Remove some usages of RCT_NEW_ARCH_ENABLED. The change should be transparent BUT some Swift libraries might get broken by this change. (951efc8ce2 by @cipolleschi)
  • You cannot call methodQueue on RCTHTTPRequestHandler (7503dbd784 by @philIip)
  • RepeatInterval is deprecated in PushNotificationIOS. Use fireDate and the new fireIntervalSeconds. (a1299938a9)
  • AlertAction is deprecated in PushNotificationIOS. getScheduledLocalNotifications now uses new iOS APIs which do not expose this property. (9f4d66d283)
  • Make TextInput.onContentSizeChange a direct event (744fb4a0d2 by @sammy-SC)
  • Remove the Flipper integration (899e7cdb55 by @cipolleschi)
  • Deleted the no-op didRegisterUserNotificationSettings: callback in RCTPushNotificationManager (3bea8e1bd4)

Added

Android specific
iOS specific

Changed

iOS specific
Android specific
iOS specific

Deprecated

  • Deprecate BatchedBridge.registerCallableModule. Please use registerCallableModule instead (7f549ec7be by @RSNara)
  • Warn when fabric is used without concurrent root (c06807154b by @javache)
  • Replace RAIICallbackWrapperDestroyer with AsyncCallback (re-land) (fbd8504cc0 by @javache)
  • Deprecated RAIICallbackWrapperDestroyer. Use AsyncCallback instead for safe jsi::Function memory ownership. (8dd89cee1b by @javache)
  • Refactor BaseJavaModule and ReactContextBaseJavaModule (5af7b7038c by @mdvacca)
Android specific
iOS specific

Removed

Fixed

Android specific
iOS specific

Security

iOS specific

Readme

Source

@react-native/codegen

Version

Installation

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

Testing

To run the tests in this package, run the following commands from the React Native root folder:

  1. yarn to install the dependencies. You just need to run this once
  2. yarn jest packages/react-native-codegen.

Keywords

FAQs

Package last updated on 11 Oct 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc