Files
react-native/packages/react-native-codegen
MaeIg 8f484c3a62 Extract the switch(configType) block from the buildSchema function into a new function in the parsers/utils.js file (#34992)
Summary:
This PR aims to extract  the switch(configType) block from the buildSchema function into a separate function in a shared file between typescript and flow. It is a task of https://github.com/facebook/react-native/issues/34872:
> This task is more advanced than the others. Extract the switch(configType) block ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/index.js#L82-L119), [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/index.js#L92-L129)) from the buildSchema function into a new function in the parsers/utils.js file and use it in the two functions. Note that the new function must accept some callbacks to wrapModule/ComponentSchema and to buildModule/ComponentSchema.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - Extract the switch(configType) block from the buildSchema function into a new function in the parsers/utils.js file

Pull Request resolved: https://github.com/facebook/react-native/pull/34992

Test Plan:
yarn flow:
<img width="548" alt="image" src="https://user-images.githubusercontent.com/40902940/195980663-a2d0e4bd-d2b8-464e-bbf5-3bcde553f7e8.png">

yarn lint:
<img width="521" alt="image" src="https://user-images.githubusercontent.com/40902940/195980675-a5c67d00-a822-46a8-8bd4-e1fe4f7fb698.png">

yarn jest react-native-codegen:
<img width="415" alt="image" src="https://user-images.githubusercontent.com/40902940/195980681-672e4447-4b33-43e8-a866-9e619ad332b1.png">

I added new tests:
<img width="621" alt="image" src="https://user-images.githubusercontent.com/40902940/195980703-8a68756a-45ad-4931-971f-f1e83ce16a96.png">

Reviewed By: cortinico

Differential Revision: D40429659

Pulled By: cipolleschi

fbshipit-source-id: 7e9875c129fee17c3cc5ef9c6f7990f39bfe2bf0
2022-10-19 01:38:28 -07:00
..
2022-02-22 02:23:02 -08:00
2020-09-29 14:39:40 -07:00

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 react-native-codegen.