mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
62da9b8ce2
Summary: This is the second diffs that backs out the Custom Native State from the Codegen. The reason why we are backing it out are: 1. It forces users to create new types in JS that are not ctually used there. For example, the NativeState you define, and eventually exports, in JS is not used anywhere in your JS code. 2. You need to put in the JS native state some types that does not exists in JS, only to have them generated by the Codegen. ImageRequest, for example, does not exists in JS, but you need it in your (iOS) state to load images 3. There are a lot of edge cases due to how C++ handles variables. Some variables needs to be created as pointers. Some others as `const &`. It does not scale to hard code all of them and there is the risk to have the same type that needs to be a pointer in some case and something else in others. 4. It is better to instruct the users on how to properly create a component with Custom State, Shadow Node and Descriptor. ## Changelog: [General][Removed] - Back out parsing and generation of Custom Native State from Codegen Reviewed By: cortinico Differential Revision: D40426134 fbshipit-source-id: c368e122cc31ee8df056fe1bf6cecaab482140a4
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 react-native-codegen.