Summary:
Android builds with new arch fail on Windows build host (https://github.com/facebook/react-native/issues/36475). This tiny correction fixes generation of `schema.json` (without it codegen failed to find any files, and generated empty schema). Unfortunately, does not fixes the issue with Windows host entirely, as builds still fail later (on ninja build step).
## Changelog:
[Android] [Fixed] - A bug fix for Android builds with new arch on Windows host.
Pull Request resolved: https://github.com/facebook/react-native/pull/36542
Reviewed By: NickGerleman
Differential Revision: D48563587
Pulled By: cortinico
fbshipit-source-id: acd510308ce9768fb17d3a33c7927de3237748ac
Summary:
[Codegen 119] This PR introduces `emitBuildEventSchema` to parser commons and abstracts the logic out of typescript and parser events as requested on https://github.com/facebook/react-native/issues/34872
## Changelog:
[Internal] [Changed] - Add `emitBuildEventSchema` to parser commons and update usages.
Pull Request resolved: https://github.com/facebook/react-native/pull/38810
Test Plan:
Run `yarn jest react-native-codegen` locally and ensure CI is green
## Screenshot of test passing locally:
<img width="1047" alt="Screenshot 2023-08-07 at 8 03 49 AM" src="https://github.com/facebook/react-native/assets/64726664/ab87f004-d9f8-4b5f-800b-0e724430301f">
Reviewed By: rshest
Differential Revision: D48155051
Pulled By: cipolleschi
fbshipit-source-id: a3db3f4783d60681b366a871b1d2ee32eb864bc0
Summary:
[Codegen 131] This PR add a function `emitUnionProp` to the parser-primitives, as requested on https://github.com/facebook/react-native/issues/34872
## Changelog:
[INTERNAL] [ADDED] - Add `emitUnionProp` function to parser-primitives
Pull Request resolved: https://github.com/facebook/react-native/pull/38705
Test Plan: `yarn test react-native-codegen`
Reviewed By: christophpurrer
Differential Revision: D47921708
Pulled By: rshest
fbshipit-source-id: c2c081c6317928e5eb8b0c1d0640c7b7f40a4b0b
Summary:
[Codegen 135] This PR introduces `getPaperTopLevelNameDeprecated` to parser base class and abstracts the logic out of typescript and parser events as requested on https://github.com/facebook/react-native/issues/34872
## Changelog:
[Internal] [Changed] - Add `getPaperTopLevelNameDeprecated` to parser base class and update usages.
Pull Request resolved: https://github.com/facebook/react-native/pull/38683
Test Plan:
Run `yarn jest react-native-codegen` locally and ensure CI is green
## Screenshot of test passing locally:
<img width="1060" alt="Screenshot 2023-07-30 at 10 04 24 AM" src="https://github.com/facebook/react-native/assets/64726664/3f61377b-9f44-45e8-bece-d4fd6bcc4567">
Reviewed By: cipolleschi
Differential Revision: D47902816
Pulled By: rshest
fbshipit-source-id: 6fab53e02cfc3f0aaa3ffd795c3fe1d2f723e060
Summary:
[Codegen 130] This PR add a `getLiteralValue` function to the Parser interface, which returns the literal value of an union represented, given an option. as requested on https://github.com/facebook/react-native/issues/34872
## Changelog:
[INTERNAL] [ADDED] - Add `getLiteralValue` function to codegen Parser
Pull Request resolved: https://github.com/facebook/react-native/pull/38651
Test Plan: Run `yarn jest react-native-codegen` and ensure CI is green
Reviewed By: cipolleschi
Differential Revision: D47912960
Pulled By: rshest
fbshipit-source-id: d9426fef4c0f92c5244d5c4c72202ec29099b76e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38295
Move constant to class instance so customers can use strongly typed name, feedback from D46159001
Changelog:
[Internal] [Changed] - Add module name constant to codegen'd class for downstream use
Reviewed By: christophpurrer
Differential Revision: D47095993
fbshipit-source-id: 741d0d837bf912d6b32e5f12c5df871563d46686
Summary:
This is a follow up PR to https://github.com/facebook/react-native/issues/37872 as it was not merged correctly.
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal][Changed]: Add emitObjectProp in parser primitives
Pull Request resolved: https://github.com/facebook/react-native/pull/37904
Test Plan: `yarn test react-native-codegen`
Reviewed By: cipolleschi
Differential Revision: D46753690
Pulled By: rshest
fbshipit-source-id: a1d0a727222066f3721f62427a51ee0317e06f13
Summary:
[Codegen 128] This PR add a `getObjectProperties` function to the Parser interface, which returns the properties of an object represented by a type annotation as requested on https://github.com/facebook/react-native/issues/34872
## Changelog:
[INTERNAL] [ADDED] - Add getObjectProperties function to codegen Parser
Pull Request resolved: https://github.com/facebook/react-native/pull/37789
Test Plan: Run `yarn jest react-native-codegen` and ensure CI is green
Reviewed By: cipolleschi
Differential Revision: D46584748
Pulled By: rshest
fbshipit-source-id: 7f509b6f8754472a9b3048214345dc94265604ba
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37832
This parameter is currently unused and is causing Android builds to fail
as they compile with `-Wall`
This is a follow-up to https://github.com/facebook/react-native/pull/37454/ as that PR updated only the `fromJs` and not the `toJs` method as well.
Changelog:
[Internal] [Changed] - Remove CallInvoker parameter from toJs method in Codegen
Reviewed By: rshest
Differential Revision: D46647110
fbshipit-source-id: 1f3e22aca7a3df11ac02b5c4b89c9311b8b1798c
Summary:
[Codegen 132] This PR introduces `emitMixedProp` to parser-primitives and abstracts the logic out of typescript and parser events as requested on https://github.com/facebook/react-native/issues/34872
## Changelog:
[Internal] [Changed] - Add emitMixedProp to parser-primitives and update usages.
Pull Request resolved: https://github.com/facebook/react-native/pull/37608
Test Plan:
Run yarn jest react-native-codegen and ensure CI is green
## Screenshot of tests passing locally:
<img width="1182" alt="Screenshot 2023-05-28 at 12 46 49 PM" src="https://github.com/facebook/react-native/assets/64726664/dbea4daf-d954-4c7f-b121-c6aad1fb318e">
Reviewed By: dmytrorykun
Differential Revision: D46275638
Pulled By: cipolleschi
fbshipit-source-id: 803d82055c7925e49aca1f408b5c7a50c687349a
Summary:
[Codegen 138] This PR introduces `getProperties` to Parser base class and implements the function in Typescript and Flow Parsers.
This PR also gets rid of `getProperties` from :
- `packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js`
- `packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js`
and updates the usages with `getProperties` from the respective parser objects as requested on https://github.com/facebook/react-native/issues/34872
## Changelog:
[Internal] [Changed] - Add getProperties to Parsers base class and update usages.
Pull Request resolved: https://github.com/facebook/react-native/pull/37633
Test Plan:
Run yarn jest react-native-codegen and ensure CI is green
## Screenshot of tests passing locally:

Reviewed By: cipolleschi
Differential Revision: D46322882
Pulled By: rshest
fbshipit-source-id: 5506ce5ff395946ea8c1258b152716fea0142b95
Summary:
This PR extracts the `findComponentConfig(...)` Flow and TS from the `index.js`'s files to the `parser-commons.js` file.
bypass-github-export-checks
## Changelog:
[INTERNAL][CHANGED] - Refactor: Extract `findComponentConfig(...)` from Flow & TS to `parsers-commons.js`
Pull Request resolved: https://github.com/facebook/react-native/pull/37547
Test Plan: - `yarn flow && yarn test packages/react-native-codegen` → should be green.
Reviewed By: cortinico
Differential Revision: D46143481
Pulled By: cipolleschi
fbshipit-source-id: f9a456b1d58312422b17463ed2b60ee5fda16462
Summary:
[Codegen 87] This PR introduces `getProps` to the Parser class and implements this function in Typescript and Flow Parsers.
We also get rid of the following files from :
- `packages/react-native-codegen/src/parsers/typescript/components/props.js`
- `packages/react-native-codegen/src/parsers/flow/components/props.js`
as requested on https://github.com/facebook/react-native/issues/34872
bypass-github-export-checks
## Changelog:
[Internal] [Changed] - Add `getProps ` to Parsers and update usages.
Pull Request resolved: https://github.com/facebook/react-native/pull/37504
Test Plan: Run yarn jest react-native-codegen and ensure CI is green
Reviewed By: cortinico
Differential Revision: D46074152
Pulled By: cipolleschi
fbshipit-source-id: aa6a1a556c9b4a4a6209221f70c8add46ed2d08b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37477
When creating a stack of several codegen fixes, a conflit generated some duplicated code we moved to the parsers from the utils.
This change removes that duplicated cone.
## Changelog:
[Genearal][Fixed] - Remove duplicated code.
Reviewed By: cortinico
Differential Revision: D45979013
fbshipit-source-id: 78cb89df81305221258e283ba5924135d498e800
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37475
We recently landed a change with a typo in the interface declaration. We just fixed the typo
## Changelog:
[General][Fixed] - Fixed a typo in the interface declaration
Reviewed By: robhogan
Differential Revision: D45978419
fbshipit-source-id: f44dbcd5c1706b9582b997a5eb6c0a82d0e422cc
Summary:
X-link: https://github.com/facebook/metro/pull/987
While working on https://github.com/facebook/react-native/pull/35786 I noticed some inconsistencies in the versioning for Babel and Flow across the monorepo. So in this PR I wanted to address that so that for 0.72 we'll have the codebase in a more consistent shape.
Happy to split in multiple PRs if needed.
## Changelog
[GENERAL] [CHANGED] - Bump Babel packages to ^7.20.0 (or closest latest release), bump flow parser to 0.206.0 in a few places that were left out from latest bump
Pull Request resolved: https://github.com/facebook/react-native/pull/35787
Test Plan: CI is green.
Reviewed By: cipolleschi
Differential Revision: D42384881
Pulled By: hoxyq
fbshipit-source-id: 21fd43391d12722cf707c3cdbbb36f49c036359d
Summary:
[Codegen 104] This PR introduces `getResolvedTypeAnnotation` to the Parser class and implements this function in Typescript and Flow Parsers.
We also get rid of usages `resolveTypeAnnotation` from :
- `packages/react-native-codegen/src/parsers/typescript/utils.js`
- `packages/react-native-codegen/src/parsers/flow/utils.js`
and replace it with `parsers.getResolvedTypeAnnotation` as requested on https://github.com/facebook/react-native/issues/34872
bypass-github-export-checks
## Changelog:
[Internal] [Changed] - Add `getResolvedTypeAnnotation ` to Parsers and update usages.
Pull Request resolved: https://github.com/facebook/react-native/pull/37373
Test Plan: Run yarn jest react-native-codegen and ensure CI is green
Reviewed By: dmytrorykun
Differential Revision: D45865651
Pulled By: cipolleschi
fbshipit-source-id: fdce6e5059306ebe67121aa1b212e67de864bf84
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37274
With dynamic frameworks, we can't use floating C functions.
The way in which dynamic frameworks work is that they need to be self contained. They are built in isolation so that other frameworks can be linked against them to solve their dependencies.
Currently, when working with 3rd party libraries, we are Codegenerating a RCTThirdPartyComponentProvider which tries to invoke floating C functions that are defined in other modules. React-RCTFabric has no visibility on those modules, therefore it fails building.
The implemented solution exclude the generation of those symbols and leverage a the Objective-C runtime to automatically register libraries when they are loaded.
**This mechanism is applied ONLY when the flag RCT_DYNAMIC_FRAMEWORKS is turned on.** There will be no impact on internal meta apps, nor on any apps that are not using Dynamic Frameworks.
This change requires a small migration in all the Fabric components libraries that wants to support dynamic frameworks. They have to implement a
```
+ (void)load
{
[super load];
}
```
method in their ComponentView.
Not to slow down the adoption of the new architecture, waiting for a migration in the ecosystem, the next diff introduce a secondary, declarative loading mechanism for Fabric Components, which follows the same approach used by TurboModules.
## Changelog:
[iOS][Changed] - Add support for distributed registration of Fabric Components with Dynamic Libraries.
Notes that this change is NOT breaking as dynamic frameworks were not working before in the New Architecture. Static Libraries and Static Frameworks continue working as usual.
Reviewed By: dmytrorykun
Differential Revision: D45605441
fbshipit-source-id: e609fbf6f92fddfbaa676227fde60962d6b0faa4
Summary:
> The `buildPropSchema` function in `parsers/typescript/components/props.js` and `parsers/flow/components/props.js` is the same. move it to `parser-commons` and use it in the original files.
part of https://github.com/facebook/react-native/issues/34872
- [x] Make the getTypeAnnotation signature from the Flow package to be equal to the typescript one. Specifically, the Typescript one needs an additional parameter withNullDefault that we can safely ignore in the implementation.
- [x] buildPropSchema signature can be updated to accept those two functions in input as callbacks. Then, the getProps function can feed the right functions based on the language to the shared build prop schema.
ref: https://github.com/facebook/react-native/issues/34872#issuecomment-1517519254
bypass-github-export-checks
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - Use `buildPropSchema` from parser-commons
Pull Request resolved: https://github.com/facebook/react-native/pull/37043
Test Plan: - [ ] `yarn jest react-native-codegen` pass
Reviewed By: rshest
Differential Revision: D45209982
Pulled By: cipolleschi
fbshipit-source-id: c241bc0542ba662c965d70d1dc283f48541e14ea
Summary:
[Codegen 116] This PR attempts to extract the logic of `getEventArgument` function from the following locations :
- `parsers/flow/components/events.js`
- `parsers/typescript/components/events.js`
since they are the same and move the function to `parsers/parsers-commons.js` as requested on https://github.com/facebook/react-native/issues/34872
## Changelog:
[Internal] [Changed] - Move `getEventArgument` to parser-commons and update usages.
Pull Request resolved: https://github.com/facebook/react-native/pull/37133
Test Plan: Run `yarn jest react-native-codegen` and ensure CI is green
Reviewed By: christophpurrer
Differential Revision: D45569128
Pulled By: cipolleschi
fbshipit-source-id: 63a7619e5b4fca0157c62a359ac51831f4f15945
Summary:
Previously we allow `{[key:string]:Something}` in codegen, `Something` is type-checked but thrown away, generating a `GenericObjectTypeAnnotation`.
In this change, `Something` is added to `GenericObjectTypeAnnotation` as an optional field.
For downstream code such as C++ codegen, this change is **backward compatible**. It allows C++ codegen to produce a more precious type optionally.
## Changelog:
[General] [Added] - Recognize dictionary type in codegen
Pull Request resolved: https://github.com/facebook/react-native/pull/37206
Test Plan:
```
yarn jest react-native-codegen
yarn jest react-native-codegen-typescript-test
```
Reviewed By: cipolleschi
Differential Revision: D45563340
Pulled By: dmytrorykun
fbshipit-source-id: 9a9ce36df6ded6d42d35c3dcb6fb0eaca16c4458
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37145
This diff adds the generation of Array types in events.
It supports the generation of Array of:
- Boolean
- Int32
- Float
- Double
- String
- Objects
- Array
**Note:** This is a first iteration. We could improve the generation further by leveraging the `Bridging` module within React Native.
I'll take a stab at it in a next diff.
## Changelog:
[General][Added] - Generate events with arrays
Reviewed By: cortinico
Differential Revision: D45321685
fbshipit-source-id: 34b05f5501b06714d1fabf1a51cb057af7027f00