mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
3af126b562
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46747 You can now use unions in native modules. Support for this pretty much existed, but one callsite was throwing for non-cpp modules which meant nobody could use this. Previously, StructCollector would throw that this was not supported because it couldn't generate it for objc. Instead of generating something smart in the native code for each option, it just tells native to treat them like the base type (number, string, object). Changelog: [General][Added] Codegen now supports Union Types in NativeModules Reviewed By: GijsWeterings Differential Revision: D63664505 fbshipit-source-id: 73278ed9cd64452173c5170aba44ced71181510f
@react-native/codegen
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:
yarnto install the dependencies. You just need to run this onceyarn jest packages/react-native-codegen.