Summary:
This PR extracts the codegen `ModuleInterfaceNotFoundParserError` exception into a separate function inside `error-utils.js` so that it can be used by both Flow and Typescript parsers as requested on https://github.com/facebook/react-native/issues/34872. This also adds unit tests to the new `throwIfModuleInterfaceNotFound` function.
## Changelog
[Internal] [Changed] - Extract codegen `ModuleInterfaceNotFoundParserError` in a separate function that can de used by Flow and TypeScript parsers
Pull Request resolved: https://github.com/facebook/react-native/pull/34922
Test Plan:
Run `yarn jest react-native-codegen` and ensure CI is green

Reviewed By: dmytrorykun
Differential Revision: D40296533
Pulled By: cipolleschi
fbshipit-source-id: 205469b15337f6c3847936a6ef5427b5a9e08665
Summary: Changelog: [Internal] - Add a display example for offset of many pointers
Reviewed By: mdvacca
Differential Revision: D39736111
fbshipit-source-id: 1fb3f1037d7e743ae1a383a4f4ee876e32da4a6a
Summary:
Update RNTester Podfile.lock after running `pod install` with Hermes enabled, which is the default in open source.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D40197412
fbshipit-source-id: ce57d204b704fda85cae7f2966e479e80db25e1b
Summary:
This adds the `destructuredArrayIgnorePattern` rule [recently introduced in `typescript-eslint`](https://github.com/typescript-eslint/typescript-eslint/issues/4691), making underscored identifiers in array destructurings no longer an error, e.g.
```js
const [state, _dispatch] = useContext(MyContext);
```
would be acceptable if `state` is used.
## Changelog
[General] [Added] - Add destructuredArrayIgnorePattern to eslint config
Pull Request resolved: https://github.com/facebook/react-native/pull/33552
Test Plan: Install the `react-native-community/eslint-config` package and test the example.
Reviewed By: lunaleaps, cipolleschi
Differential Revision: D40166101
Pulled By: ryancat
fbshipit-source-id: 1e30297bf40d65e09682c4f9f3b3dd432ba5310e
Summary:
This moves configureDevPorts inside AgpConfiguratorUtils, and makes it use
finalizeDsl. This removes a deprecated API `BaseVariant` which is causing a
build warning for all the users + it's a step towards making RNGP fully variant aware.
Changelog:
[Internal] [Changed] - Move configureDevPorts inside AgpConfiguratorUtils and use finalizeDsl
Reviewed By: cipolleschi
Differential Revision: D40139558
fbshipit-source-id: 1e5b8661b8d223a603f8ab5d160edd2133304d92
Summary:
I'm suppressing this deprecation on `reactRoot` as it's unnecessary.
It creates noise and the usage is actually legit.
Changelog:
[Internal] [Changed] - Suppress deprecation on reactRoot passed as deprecatedReactRoot
Reviewed By: cipolleschi
Differential Revision: D40139555
fbshipit-source-id: f3755f020ab1dceb17d0fdd18c6c8e374c87c60c
Summary:
Changelog
[General][Internal] - Make react-native-codegen work on Windows within BUCK
This makes react-native code-gen work on Windows - by basically filling in some necessary windows commands for the existing bash/shell ones
Reviewed By: cortinico, cipolleschi
Differential Revision: D40268750
fbshipit-source-id: 0db7597999ec8108babf56abed436f6dc7789cce
Summary:
This PR extracts the content of the codegen case `'Stringish'` into a single `emitStringish` function inside the `parsers-primitives.js` file and uses it in both Flow and TypeScript parsers as requested on https://github.com/facebook/react-native/issues/34872. This also adds unit tests to the new `emitStringish` function.
## Changelog
[Internal] [Changed] - Extract the content of the case 'Stringish' into a single emitStringish function
Pull Request resolved: https://github.com/facebook/react-native/pull/34936
Test Plan:
Run `yarn jest react-native-codegen` and ensure CI is green

Reviewed By: cipolleschi
Differential Revision: D40255921
Pulled By: rshest
fbshipit-source-id: 9c08f81f12c93995bb6ba032fabcd6451b8dc7c1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34884
Xcode 14 is now stable. Updating CI to use latest Xcode command line tools.
The Circle CI 14.0.1 container ships with Ruby 2.7.6 and CocoaPods 1.11.3, see full manifest here: https://circle-macos-docs.s3.amazonaws.com/image-manifest/v8824/index.html
Changelog: [iOS][Changed] Bump to Ruby 2.7.6 and CocoaPods 1.11.3
Reviewed By: mdvacca
Differential Revision: D40148796
fbshipit-source-id: b1eab68e159ec3237ff2ef596163b73fc1e511e4
Summary: Changelog: [Internal] Adjust styling so test works on mobile screen and verified Android is passing
Reviewed By: mdvacca
Differential Revision: D40247320
fbshipit-source-id: c39bff510900393af7696e92e1f846999eb0ced3
Summary:
Add TurboModule code-gen support for macOS and Windows
Changelog
[General][Internal] - Add TurboModule code-gen support for macOS and Windows
Reviewed By: javache
Differential Revision: D40140890
fbshipit-source-id: 60d235f16af590c07abddba3d289efa7d1d973c0
Summary:
This PR reduces code duplication by extracting all the errors in the module/errors into a single parsers/errors.js file. All the errors must drop the corresponding Flow or Typescript token in the name and take an extra language parameter in the constructor. Also, rename the hasteModuleName parameter to nativeModuleName.
Part of https://github.com/facebook/react-native/issues/34872
## 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 all the parsers errors in the module/errors into a single parsers/errors.js file
Pull Request resolved: https://github.com/facebook/react-native/pull/34896
Test Plan:
run ```yarn jest react-native-codegen``` and check all test case passes.
<img width="793" alt="image" src="https://user-images.githubusercontent.com/34857453/194545577-cf2d980b-b6b7-4f93-b13e-2e45d92dceab.png">
Reviewed By: rshest
Differential Revision: D40176486
Pulled By: rshest
fbshipit-source-id: b33ae49b2bcceeffd307370ee5e3b24a9e1bb340
Summary:
A moderate vulnerability was found in all versions of `ws` below 7.4.6 June last year. React native current uses v6.1.4 which is susceptible to it, fortunately this security fix has been backported to v6.X.X and we don't need to upgrade any major versions/worry about breaking changes. This PR bumps `ws` to 6.2.2 ([CHANGELOG](https://github.com/websockets/ws/releases/tag/6.2.2)) due to this ReDoS vulnerability
More information about this vulnerability can be found here -> https://github.com/advisories/GHSA-6fc8-4gx4-v693
Closes https://github.com/facebook/react-native/issues/31646
## Changelog
[Internal] [Security] - Bump ws to 6.2.2 due to ReDoS vulnerability
Pull Request resolved: https://github.com/facebook/react-native/pull/34759
Test Plan:
Ensure WebSocket tests are working as expected
Tested HMR working on Twilight
| iOS | Android |
| https://pxl.cl/2g70M | https://pxl.cl/2g70V |
Reviewed By: hramos, cortinico
Differential Revision: D39722905
fbshipit-source-id: 12088ab5ea26d904675de484e2014949d6696465
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34911
This diff adds the Same component with state added in the previous diff for iOS
## Changelog
[Android][Added] - ComponentWithState
Reviewed By: cortinico
Differential Revision: D40108233
fbshipit-source-id: b5bd1d1bdd7053920f737772c85034e4c5aed26a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34909
This Diff introduces a Sample component in RNTester which uses the NativeState to load some images.
It is an example on how to use CustomNativeState
In this first diff, I focused on the iOS side of things. The next diff will make this work with Android.
## Changelog
[iOS][Added] - Introduce sample component which work with the native state.
Reviewed By: cortinico
Differential Revision: D39884926
fbshipit-source-id: 9323d751fd06a1bb8ff93af836d97010c2095833
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34910
This Diff adds supports on the CustomState generation for ImageSource and ImageRequests, to enable NativeComponents to use the ImageSource loading provided by React Native.
To achieve this, I also had to fox some errors in the imports and to introduce some functions to decorate parameters.
This diff also introduces the tests for thise additional types in both generators and parsers.
## Changelog
[General][Added] - add support for ImageSource and ImageRequest in the State.
Reviewed By: cortinico
Differential Revision: D39884889
fbshipit-source-id: ae3d2d51dfe6a4fe688dc78fec83f428beb8d443
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34796
This diff introduces the generation of custom native states using basic types as we do with the Props.
To make it work, the custom types are already writte in the Props.h file, therefore the State.h file must import that other file to have access to the required types.
This diff adds and updates the tests for the State.
## Changelog
[General][Added] - Generate custom Native State
Reviewed By: cortinico
Differential Revision: D39816763
fbshipit-source-id: 42d1aa9a6df23145f4a46ae8ccfb43d81fa651fb
Summary:
This PR is a task from https://github.com/facebook/react-native/issues/34872
_Extract the modules/utils.js from the flow and typescript folders in a shared parsers-commons.js file. Then, have the two parsers use the same wrapModuleSchema function for modules._
(`wrapModuleSchema` is a copy-paste mistake, in this case it is `wrapNullable` and `unwrapNullable`)
## 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] - Extracts Codegen's modules/utils.js files from the flow and typescript folders in parsers-commons
Pull Request resolved: https://github.com/facebook/react-native/pull/34898
Test Plan:
I ran `yarn jest react-native-codegen`:
<img width="775" alt="Capture d’écran 2022-10-07 à 21 29 48" src="https://user-images.githubusercontent.com/17070498/194639515-a446c2cf-daf3-43a1-9833-cd546ca5865e.png">
Reviewed By: cipolleschi
Differential Revision: D40193740
Pulled By: cipolleschi
fbshipit-source-id: 02cbacc215fe5dd9bdd0839d8796587ab2821906
Summary:
Changelog: [RNTester][Internal] - Add "PointerMove Between" platform test
This diff adds another port of a web platform test which verifies the event order when a hoverable pointer moves between elements.
Reviewed By: lunaleaps
Differential Revision: D40164303
fbshipit-source-id: 12f39dfcf7a1a4acabfd762185bc2227451b1057
Summary:
A few fixings to make `yarn jest react-native-doegen` works on Windows:
- ~~Add a `.gitignore` file to tell git not to track generated/temporary files.~~
- There is no `rm` on Windows, change it to `rimraf`.
I have been using it in the last 3 months and it works perfectly on Windows, otherwise I could not even build the code in my laptop.
## Changelog
[General] [Changed] - Make `yarn` and `yarn jest react-native-codegen` works on Windows with git
Pull Request resolved: https://github.com/facebook/react-native/pull/34854
Test Plan: `yarn jest react-native-codegen` passed
Reviewed By: cortinico
Differential Revision: D40059524
Pulled By: cortinico
fbshipit-source-id: e3cde2506c7d18c2b580099257637b90f4cb328c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34897
This [commit](https://github.com/facebook/react-native/commit/7680bdeb4f96a8092393372a59c77a9d7b729cae) added the possibility to create Codegen specs that are platform specific.
However, it also modifies how the codegen is invoked and we need to publish a new version of the `react-native-codegen` package on NPM before we can use that feature.
## Changelog:
[General][Fixed] - Remove usage of the codegen spec filtering until we publish a new version of the codegen.
Reviewed By: robhogan
Differential Revision: D40176447
fbshipit-source-id: 20be630dec3dcd7efb9fd510c6cf9f2c161f906a
Summary:
This diff helps the library maintainer to keep their spec file platform specific if some specs make no sense in one platform or in the other.
We are filtering the spec files when we need to create the Schema.
The diff modifies also the call sites in the `scripts` (for iOS) and in the `gradle-plugin` (for Android).
It also adds tests for the new functions in the CLI.
The change is completely additive and it should not change any pre-existing behaviour.
## Changelog
[General][Added] - Add support for platform-specific specs
Reviewed By: cortinico
Differential Revision: D40008581
fbshipit-source-id: b7fcf6d38f85fe10e4e00002d3c6f2910abdbe35
Summary:
`TSParenthesizedType`, `TSUnionType`, `TSNullKeyword`, `TSUndefinedKeyword`, `TSVoidKeyword` etc are repeatly processed in so many places. In this change I put them in a new file `parseTopLevelType.js`, and everyone call that file, all repeat implementation are deleted.
The `parseTopLevelType` function will look into a type consisted by the above types in any possible combination (but still very easy to do), and tell you if a type is nullable, or if there is a default value, and what is the real type with all noises removed.
Array types and union types are processed in component twice, for property of array, and property of nested arrays (`componentsUtils.js`). They are extracted into single functions.
## Changelog
[General] [Changed] - Refactor in turbo module TypeScript codegen: process `(T)`, `T|U`, `T|undefined` and related stuff in a central place
Pull Request resolved: https://github.com/facebook/react-native/pull/34814
Test Plan: `yarn jest react-native-codegen` passed
Reviewed By: yungsters, sammy-SC
Differential Revision: D40094373
fbshipit-source-id: f28e145bc4e7734be9036815ea425d820eadb8f0
Summary:
This change will expose the rrc_image module to be consumed via Prefab by user projects. This is needed as part of a change of the codegen to support custom states.
Changelog:
[Internal] [Changed] - Expose rrc_image to consuming build
Reviewed By: cipolleschi
Differential Revision: D40098541
fbshipit-source-id: 2e07d8b19f53ba93920009603c95a43b01f131eb
Summary:
This change will expose the `react_render_imagemanager` module to be consumed via Prefab by user projects. This is needed as part of a change of the codegen to support custom states.
Changelog:
[Internal] [Changed] - Expose react_render_imagemanager to consuming build
Reviewed By: cipolleschi
Differential Revision: D40022929
fbshipit-source-id: ece47503b11a641067ae6db82f1d69b244c9c5be
Summary:
This diff further simplifies the New App Template by removing the
buildConfigFields for both Hermes and New Architecture with the React Native Gradle Plugin.
Changelog:
[Android] [Changed] - Let RNGP set buildConfigFields for New Architecture and Hermes
Reviewed By: cipolleschi
Differential Revision: D40139559
fbshipit-source-id: 202b6ac9c4c036a026a2ff3e8279087ffd363eaa
Summary:
This change encapsulates all the NDK configuration logic inside the React Native
Gradle Plugin. The changes are additive so that the user can still specify a
custom configuration if they wish.
So far I've applied the changes to RN Tester. Changes to the template require a
bump of the Gradle Plugin NPM package.
Changelog:
[Android] [Changed] - Hide the C++/Cmake configuration from user space inside the framework
Reviewed By: cipolleschi
Differential Revision: D40139557
fbshipit-source-id: 013220695791e3d0d458e118de16953e0545c3de
Summary:
This moves the prefab/pickFirst configuration from the user's
build.gradle to the React Native Gradle Plugin.
As this configuration is entirely under our control, is safe
to assume users won't need to tweak it (e.g. we control which
libraries are built, etc.).
Changelog:
[Android] [Changed] - Encapsulate the prefab configuration for consumers
Reviewed By: cipolleschi
Differential Revision: D40094691
fbshipit-source-id: d1510a0a382d26e94e3d01f30661af39f7bedf52
Summary:
I'm adding a series of excludes to the `GenerateCodegenSchemaTaskTest`.
The reason is that RN Tester is setting `packages/rn-tester` as the root of the
specs as they're not isolated.
This is causing the Gradle task to crawl inside the `android/app/build` folder
where we store sourcemaps and other files that have .js files. As those files
gets updated when you build, the codegen task gets invalidated over and over
and Gradle is firing warning about it.
Changelog:
[Internal] [Changed] - Exclude generated folders from the GenerateCodegenSchemaTask
Reviewed By: cipolleschi
Differential Revision: D40098418
fbshipit-source-id: fcffbc73e8258c4e9eefda062e1fad77be650002
Summary:
This PR renames ` hermes-inspector-msggen` to `react-native/hermes-inspector-msggen`, moves it to `packages/hermes-inspector-msggen` and makes the package private as part of RFC480.
Related to https://github.com/facebook/react-native/issues/34692
## Changelog
[General] [Changed] - Move and rename `hermes-inspector-msggen` to `react-native/hermes-inspector-msggen`
Pull Request resolved: https://github.com/facebook/react-native/pull/34850
Test Plan: run `sh ReactCommon/hermes/inspector/tools/run_msggen`
Reviewed By: mattbfb
Differential Revision: D40060406
Pulled By: cortinico
fbshipit-source-id: e018fd88e8374a69fbd8737fbb9abe7565d4a003
Summary:
Add explicit annotations to useCallback as required for Flow's Local Type Inference project. This codemod prepares the codebase to match Flow's new typechecking algorithm. The new algorithm will make Flow more reliable and predictable.
Codemod command: `flow codemod annotate-use-callback`
drop-conflicts
bypass-lint
Changelog: [Internal]
Reviewed By: evanyeung
Differential Revision: D40079418
fbshipit-source-id: 59750a5d07b2ac1f440927794a7523682f048a5e