mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
ccd191d79a
Summary: Part of https://github.com/facebook/react-native/issues/34872 > Extract the content of the if branches that handle the EventHandlers ([Flow](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/flow/components/events.js#L131-L151), [TypeScript](https://github.com/facebook/react-native/blob/e133100721939108b0f28dfa9f60ac627c804018/packages/react-native-codegen/src/parsers/typescript/components/events.js#L150-L171)) into a handleEventHandler function in parsers-commons.js. This will take a name, a typeAnnotation, a parser and a findEventArgumentsAndType function as parameters. Use the switch based approach from TypeScript. ## Changelog: [Internal][Changed]: Extract the content into handleEventHandler Pull Request resolved: https://github.com/facebook/react-native/pull/38805 Test Plan: `yarn test react-native-codegen` Reviewed By: rshest Differential Revision: D48100350 Pulled By: cipolleschi fbshipit-source-id: 5de6deacd50e87ea0ec96147fff7c14ba55e5368
@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.