Граф коммитов

25684 Коммитов

Автор SHA1 Сообщение Дата
Gabriel Donadel Dall'Agnol 305f7c3352 chore: Extract codegen case 'Stringish' into a single emitStringish function (#34936)
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

![image](https://user-images.githubusercontent.com/11707729/194987664-b588b82b-a9e0-49a9-a3cc-a03cb0a230e6.png)

Reviewed By: cipolleschi

Differential Revision: D40255921

Pulled By: rshest

fbshipit-source-id: 9c08f81f12c93995bb6ba032fabcd6451b8dc7c1
2022-10-12 03:06:04 -07:00
youedd b3219fe345 Extract contents of the case 'VoidTypeAnnotation' into a single emitVoid function (#34932)
Summary:
Part of https://github.com/facebook/react-native/issues/34872

This PR:
- extracts the content of the case 'VoidTypeAnnotation' ([Flow](b444f0e44e/packages/react-native-codegen/src/parsers/flow/modules/index.js (L375-L377)), [TypeScript](00b795642a/packages/react-native-codegen/src/parsers/typescript/modules/index.js (L410-L412))) into a single emitVoid function in the parsers-primitives.js file. Use the new function in the parsers.
- unit tests emitVoid function

## Changelog

[Internal] [Changed] - Extract contents of the case 'VoidTypeAnnotation' into a single emitVoid function

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

Test Plan:
` yarn jest react-native-codegen`

<img width="957" alt="image" src="https://user-images.githubusercontent.com/19575877/194931977-d5cfc5f5-c9db-498d-9e5c-ae40a38d3623.png">

Reviewed By: cipolleschi

Differential Revision: D40239730

Pulled By: rshest

fbshipit-source-id: 16a9555223cacbb3b9916fd469bd63f83db33f18
2022-10-12 03:06:04 -07:00
Chenglin Liu a885b1fcfd Add link group label to talkios deps (#34949)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34949

Changelog: [Internal]

Currently, link groups depend on supermodules to generate. To continue supporting link groups while allowing us to migrate off supermodules, we'll add a talkios_link_group label on all talkios targets to persist the current hierarchical information.

Reviewed By: jkeljo

Differential Revision: D40268275

fbshipit-source-id: a82e969e7cb8ec167489be73dc9bc71cf8ec37e1
2022-10-11 20:05:05 -07:00
Héctor Ramos 21c8837c12 Bump Circle CI macOS container to Xcode 14.0.1, Ruby to 2.7.6, CocoaPods 1.11.3 (#34884)
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
2022-10-11 18:27:25 -07:00
Marco Fiorito fd4451ecfa Chore/extract codegen case object to parser primitives (#34926)
Summary:
Part of https://github.com/facebook/react-native/issues/34872

This PR extracts the content of the case 'Object' ([Flow](b444f0e44e/packages/react-native-codegen/src/parsers/flow/modules/index.js (L365-L367)), [TypeScript](00b795642a/packages/react-native-codegen/src/parsers/typescript/modules/index.js (L400-L402))) into a single emitObject function in the parsers-primitives.js file. Use the new function in the parsers.

## Changelog

[Internal] [Changed] - Extract contents of the case 'Object' into a single emitObject function

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

Test Plan: <img width="276" alt="image" src="https://user-images.githubusercontent.com/18408823/194892107-1da9d6e5-c659-47f9-8597-ff4a4b7710ca.png">

Reviewed By: rshest

Differential Revision: D40231670

Pulled By: cipolleschi

fbshipit-source-id: db6a61427c8c020d48be5317b094f136842b62ca
2022-10-11 15:17:13 -07:00
Chenglin Liu b33961d7a0 Add link group label to talkios deps
Summary: Currently, link groups depend on supermodules to generate. To continue supporting link groups while allowing us to migrate off supermodules, we'll add a talkios_link_group label on all talkios targets to persist the current hierarchical information.

Reviewed By: jkeljo

Differential Revision: D40268252

fbshipit-source-id: 9211add120448e95f892d36a85583c700b2ec9a0
2022-10-11 14:24:40 -07:00
Luna Wei 14456e7124 Add aria-labelledby to types
Summary: Changelog: [Internal] Add `aria-labelledby` to TS events from changes in https://github.com/facebook/react-native/pull/34725

Differential Revision: D40239207

fbshipit-source-id: 27832037bf1de74c2b86c04521b9baaa60c99d44
2022-10-11 11:12:49 -07:00
Peter Abbondanzo 5c5220a46d Check for system bars apperance on newer SDKs (#34899)
Summary:
As identified in https://github.com/facebook/react-native/issues/34350, modals do not honor the system's status bar colors because they may not be set by the deprecated `systemUiVisibility` flags. Unless `android:windowLightStatusBar` is set to true, the default flag is a zero-integer (a.k.a. "dark mode", where the icons show as white). Since the `StatusBar` component is using the new `setSystemBarsAppearance` API, the ModalHost should also infer its status bar settings from the same API.

## 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
-->

[Android] [Fixed] - Fixed an issue on Android API 31+ where modals would turn status bar icons white by default

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

Test Plan:
- On a screen with the `StatusBar` bar style set to `dark-content`, the modal also uses white icons
- On a screen with the `StatusBar` bar style set to `light-content`, the modal also uses black icons

### Preview

Here, I change the `barStyle` from `light-content` to `dark-content` and demonstrate that the proper attributes are retained. The "Before" is a recording from `main` and the "After" is this branch. Notice how in "Before", the status bar is always turning the icons white when the modal opens.

|Before|After|
|-|-|
|![ezgif-5-586e81991d](https://user-images.githubusercontent.com/10366495/194954666-71f69bd6-c02a-4725-9562-e1f5fcfdeddf.gif)|![ezgif-5-b212d7bb01](https://user-images.githubusercontent.com/10366495/194954244-9c205821-1d7f-4630-861b-f5dbe207f7cd.gif)|

## Other considerations

There's some argument towards removing this check entirely--the status bar appearance should be derived from the theming and/or the parent activity's settings, thereby removing the need to apply separate styling

Reviewed By: lunaleaps

Differential Revision: D40243122

Pulled By: lunaleaps

fbshipit-source-id: ffa56c7d6a1906f89658f95a12f6bf1cefd5be8e
2022-10-11 10:50:05 -07:00
Matt Blagden 4d1a56813c Add perftest dev support manager
Summary:
Add a `DevSupportManager` that can be used for performance testing. This `DevSupportManager` allows the inspector connection to be established, but leaves everything else disabled.

Previously, if Developer Support was enabled on a release build, the application would present an error as it unsuccessfully attempted to use the bridge dev support manager.

With this change, if a developer opts into developer support in a release build (i.e. `enableOnCreate == true && ReactBuildConfig.DEBUG == false` in the `DevSupportManagerFactory`), the `PerfTestDevSupportManager` will be used, allowing use of things like heap size reporting and the sampling profiler.

(`enableOnCrease` indicates the development mode setting: https://www.internalfb.com/code/fbsource/[6b8a941fdf2a0fd58d9db36f5a59fa5fb53ad2df]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java?lines=259)

Changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D39468561

fbshipit-source-id: cb3c82e7a8ee74316b23f57dc8d0cc6e5cdb18a7
2022-10-11 10:24:05 -07:00
Daksh Bhardwaj f353119113 feat : add aria labelled as alias for accessibilityLabelledBy (#34725)
Summary:
This adds the [aria-labelledby](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)  prop to the components where it's used as requested on https://github.com/facebook/react-native/issues/34424,  equivalent [accessibilityLabelledBy](https://reactnative.dev/docs/accessibility#accessibilitylabelledby-android)

## Changelog
[General] [Added] - Add aria-modal prop to basic component

## TestPlan

 - Enable talkback.
 - Open the RNTester app and navigate to the Api's tab
 - Go to the TextInput with aria-labelledby attribute section

<img width="495" alt="Screenshot 2022-09-19 at 7 46 05 PM" src="https://user-images.githubusercontent.com/22423684/191038924-017dba93-ea7d-494d-ba6f-161e986f9b54.png">

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

Reviewed By: lunaleaps

Differential Revision: D40176143

Pulled By: lunaleaps

fbshipit-source-id: 003d1ab27bfd01b5c6d4c58a4de501ec7966359d
2022-10-11 05:48:42 -07:00
MaeIg 38fcafe623 Extract the function createParserErrorCapturer into a single function in the parsers/utils.js file (#34934)
Summary:
This PR aims to reduce code duplication by extracting `createParserErrorCapturer` function from the flow and typescript folders into a shared parsers/utils.js file. It is a task of https://github.com/facebook/react-native/issues/34872:
> Extract the function createParserErrorCapturer ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/utils.js#L122-L143) [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/utils.js#L114-L135)) into a single function in the parsers/utils.js file and replace its invocation with this new function.

## 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 function createParserErrorCapturer into a single function in the parsers/utils.js file

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

Test Plan:
yarn flow:
<img width="628" alt="image" src="https://user-images.githubusercontent.com/40902940/194948886-d6763e39-ea07-4004-86cc-5287c4783012.png">

yarn lint:
<img width="509" alt="image" src="https://user-images.githubusercontent.com/40902940/194948916-3e54afa5-7e0b-4a61-ac18-8ec306d8c6d4.png">

yarn jest react-native-codegen:
<img width="386" alt="image" src="https://user-images.githubusercontent.com/40902940/194948966-d1e5b12e-02ab-4d53-a4bf-6abaf4d70fbe.png">

Reviewed By: cipolleschi

Differential Revision: D40256048

Pulled By: cipolleschi

fbshipit-source-id: 098519a17d6e3128d236c639b246a706f9dbf66d
2022-10-11 05:24:25 -07:00
Antoine Doubovetzky 966f3cdea3 extract emitPromise from parsers modules to shared parsers-primitives (#34935)
Summary:
This PR is a task from https://github.com/facebook/react-native/issues/34872:
> Extract the content of the case 'Promise' ([Flow](b444f0e44e/packages/react-native-codegen/src/parsers/flow/modules/index.js (L90-L97)), [TypeScript](00b795642a/packages/react-native-codegen/src/parsers/typescript/modules/index.js (L197-L205))) into a single emitPromise function in the parsers-primitives.js file. Use the new function in the parsers.

Note that this PR should be merged after https://github.com/facebook/react-native/pull/34933

## 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 contents of the case 'Promise' into a single emitPromise function inside parsers-primitives

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

Test Plan: I tested using jest and flow commands.

Reviewed By: cipolleschi

Differential Revision: D40257033

Pulled By: cipolleschi

fbshipit-source-id: 0246f43c6b688629e2de1259e7f535c2cf6dd0a4
2022-10-11 05:22:59 -07:00
Antoine Doubovetzky 29e5655dee extract assertGenericTypeAnnotationHasExactlyOneTypeParameter to parsers-commons (#34933)
Summary:
This PR is a task from https://github.com/facebook/react-native/issues/34872:
> Extract the function assertGenericTypeAnnotationHasExactlyOneTypeParameter ([Flow](b444f0e44e/packages/react-native-codegen/src/parsers/flow/modules/index.js (L441)) [TypeScript](00b795642a/packages/react-native-codegen/src/parsers/typescript/modules/index.js (L476))) into a single function in the parsers-common.js file and replace its invocation with this new function.

## 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 assertGenericTypeAnnotationHasExactlyOneTypeParameter from the flow and typescript folders to parsers-commons

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

Test Plan: I tested using jest and flow commands.

Reviewed By: cipolleschi

Differential Revision: D40257022

Pulled By: cipolleschi

fbshipit-source-id: 609972914deade9afdd1c0cf1e17be1c08c1d37b
2022-10-11 05:22:59 -07:00
Kinarobin 11f47432ff Fix measure inner dimensions (#1114)
Summary:
`YGFloatIsUndefined(collectedFlexItemsValues.totalFlexGrowFactors) &&            collectedFlexItemsValues.totalFlexGrowFactors == 0`  is not reachable.

X-link: https://github.com/facebook/yoga/pull/1114

Reviewed By: NickGerleman

Differential Revision: D40203817

Pulled By: NickGerleman

fbshipit-source-id: 46a8c19dc0e097f4c28e7f48135f0382a557764a
2022-10-11 03:38:35 -07:00
Pieter De Baets 2f58e52006 Apply Animated initialProps handling to Fabric only (#34927)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34927

The changes made in D36902220 (a04195167b) and D36958882 (d8c25ca1b6) attempted to reduce flickering and consistency issues when using Animated.

In the old renderer, we explicitly reset all animated props, and wait for the subsequent React commit to set the props to the right state, but if `initialProps` are used, the React reconciliation may not be able to identify the prop-update is required and will leave out the value. This behaviour is different in the new renderer, where we do not explicitly `restoreDefaultValues` on detaching the animated node, and instead rely on the latest state being correct(?).

Changelog:
[General][Fixed] Stop styles from being reset when detaching Animated.Values in old renderer

Fixes #34665

Reviewed By: rshest

Differential Revision: D40194072

fbshipit-source-id: 1b3fb1d1f4a39036a501a8a21e57002035dd5659
2022-10-11 03:35:58 -07:00
Luna Wei f8996f1ea2 Fix handling across elements styling
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
2022-10-10 19:59:28 -07:00
Christoph Purrer 53f1f6b9cd Add TurboModule code-gen support
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
2022-10-10 15:42:06 -07:00
MaeIg 1fc27c4cba Extract TypeAlias logic of translateTypeAnnotation from the flow and typescript folders in parsers-primitives (#34918)
Summary:
This PR aims to reduce code duplication by extracting `typeAliasResolution` logic from the flow and typescript folders into a shared parsers-primitives file. It is a task of https://github.com/facebook/react-native/issues/34872:
> Wrap the TypeAlias resolution lines ([Flow](b444f0e44e/packages/react-native-codegen/src/parsers/flow/modules/index.js (L321-L362)), [TypeScript](00b795642a/packages/react-native-codegen/src/parsers/typescript/modules/index.js (L356-L397))) in a proper typeAliasResolution function in the parsers-primitives.js files and replace those lines with the new function.

## 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 TypeAlias logic of translateTypeAnnotation from the flow and typescript folders in parsers-primitives

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

Test Plan:
All tests are passing, with `yarn jest react-native-codegen`:
<img width="930" alt="image" src="https://user-images.githubusercontent.com/40902940/194835192-49478b1c-3e04-40f9-b6f3-e26491f272ab.png">

Reviewed By: rshest

Differential Revision: D40223495

Pulled By: rshest

fbshipit-source-id: c74b68385e59497b6a8eaa56b96a001ef447a2cd
2022-10-10 10:47:40 -07:00
Pieter De Baets 9255eeabb3 Fix image loading error when null source is used
Summary:
D39423391 (6bdcb49966) caused Android to receive more empty / null URI's, which caused incorrect network requests to be sent.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D40224924

fbshipit-source-id: 2de7920cc66a51c2967afe440614db11821aedd7
2022-10-10 10:13:29 -07:00
Thibault Malbranche e4dff28c58 add 0.68.4 changelog (#34924)
Summary:
Adds changelog for new patch.

## 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] - add changelog entry for 0.68.4

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

Test Plan: N/A

Reviewed By: rshest

Differential Revision: D40226689

Pulled By: rshest

fbshipit-source-id: 2c60533fb9ed40a7b40dc8385482d98cd77fd309
2022-10-10 07:51:11 -07:00
Jesse Katsumata cb3a5cc691 Add unit test for common parsers method (#34915)
Summary:
This PR is part of https://github.com/facebook/react-native/issues/34872
This PR adds unit test for method that were refactored into parsers-commons.js in codegen in https://github.com/facebook/react-native/issues/34898

## 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] - Add unit test for common parsers method

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

Test Plan: `yarn jest react-native-codegen`

Reviewed By: cipolleschi

Differential Revision: D40219036

Pulled By: cipolleschi

fbshipit-source-id: 2fb666c016f7822feaf2156d23ce7ffb9572c756
2022-10-10 04:23:30 -07:00
Antoine Doubovetzky 3ab7ef24a7 extract emitDouble from parsers modules to shared parsers-primitives (#34913)
Summary:
Part of https://github.com/facebook/react-native/issues/34872

This PR extracts the content of the case 'Double' ([Flow](b444f0e44e/packages/react-native-codegen/src/parsers/flow/modules/index.js (L202-L204)), [TypeScript](00b795642a/packages/react-native-codegen/src/parsers/typescript/modules/index.js (L1235-L237))) into a single emitDouble function in the parsers-primitives.js file. Use the new function in the parsers.

## 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 contents of the case 'Double' into a single emitDouble function inside parsers-primitives

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

Test Plan: I tested using jest and flow commands.

Reviewed By: cipolleschi

Differential Revision: D40216018

Pulled By: cipolleschi

fbshipit-source-id: bc2aaa7636fbd2f6c861e4d87e394d0e4875a4a5
2022-10-10 04:23:30 -07:00
MaeIg 5f05b07d02 Extract RootTag case of translateTypeAnnotation from the flow and typescript folders in parsers-primitives (#34901)
Summary:
This PR aims to reduce code duplication by extracting `emitRootTag` logic from the flow and typescript folders into a shared parsers-primitives file. It is a task of https://github.com/facebook/react-native/issues/34872:
> Extract the content of the case 'RootTag' (Flow TypeScript) into a single emitRootTag function in the parsers-primitives.js file. Use the new function in the parsers.

~~Note that https://github.com/facebook/react-native/issues/34898 should be merged first. I rebased on it's branch.~~

## 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 RootTag case of translateTypeAnnotation from the flow and typescript folders in parsers-primitives

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

Test Plan:
All tests are passing, with `yarn jest react-native-codegen`:
<img width="934" alt="image" src="https://user-images.githubusercontent.com/40902940/194777150-6136c1b6-11f8-4e21-829b-fda418b6925c.png">

Reviewed By: cipolleschi

Differential Revision: D40212553

Pulled By: cipolleschi

fbshipit-source-id: eadbbfb5cf6dfa6c966f4c08a5d9372a3470b621
2022-10-10 04:23:30 -07:00
Tarun Chauhan 7b345bca55 Extract module/errors into a shared file (#34896)
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
2022-10-10 04:20:22 -07:00
Gabriel Donadel Dall'Agnol fa22a6e2d7 build: Bump ws to 6.2.2 due to ReDoS vulnerability (#34759)
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
2022-10-10 02:58:40 -07:00
Riccardo Cipolleschi b24f60f729 Add ComponentWithState in Android (#34911)
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
2022-10-10 02:51:06 -07:00
Riccardo Cipolleschi 1a9cceb20b Add sample component with state in RNTester (#34909)
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
2022-10-10 02:51:06 -07:00
Riccardo Cipolleschi d7c41361dd Add ImageSource and ImageRequest to generate custom NativeState (#34910)
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
2022-10-10 02:51:06 -07:00
Riccardo Cipolleschi 7490ad4a21 Generate Custom Native State (#34796)
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
2022-10-10 02:51:06 -07:00
Kudo Chien 5fa51e665f introduce SKIP_BUNDLING_METRO_IP to skip ip.txt generation (#31829)
Summary:
ios debug archiving build will generate ip.txt that will leak metro server address for other people testing.
moreover, it will slow down launch time for metro server availability to wrong address.
this pr introduce `SKIP_BUNDLING_METRO_IP` to prevent ip.txt generation.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [iOS] [Changed] - introduce SKIP_BUNDLING_METRO_IP to skip ip.txt generation

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

Test Plan:
### Classic build will generate ip.txt
```sh
xcodebuild -workspace RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphoneos -destination 'generic/platform=iOS'
find $HOME/Library/Developer/Xcode/DerivedData/RNTesterPods-* -name 'ip.txt'
```
this will find the ip.txt

### Specify `SKIP_BUNDLING_METRO_IP=1` will not generate ip.txt
```sh
SKIP_BUNDLING_METRO_IP=1 xcodebuild -workspace RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphoneos -destination 'generic/platform=iOS'
find $HOME/Library/Developer/Xcode/DerivedData/RNTesterPods-* -name 'ip.txt'
```
this will NOT find the ip.txt

Reviewed By: hramos

Differential Revision: D40095785

Pulled By: hramos

fbshipit-source-id: 0c913f078e683879e07e9ce3306e899d631206b2
2022-10-10 01:26:29 -07:00
Youssef Eddibili 54fc62cda7 Extract contents of the case 'NumberTypeAnnotation' into a single emitNumber function (#34908)
Summary:
Part of https://github.com/facebook/react-native/issues/34872

This PR:
- extracts the content of the case 'NumberTypeAnnotation' ([Flow](b444f0e44e/packages/react-native-codegen/src/parsers/flow/modules/index.js (L370-L372)), [TypeScript](00b795642a/packages/react-native-codegen/src/parsers/typescript/modules/index.js (L405-L407))) into a single emitNumber function in the parsers-primitives.js file, and uses the new function in the parsers
- unit tests emitNumber function

## Changelog

[Internal] [Changed] - Extract contents of the case 'NumberTypeAnnotation' into a single emitNumber function

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

Test Plan:
` yarn jest react-native-codegen`

<img width="935" alt="image" src="https://user-images.githubusercontent.com/19575877/194764122-44975a97-3acd-4f27-babe-ddcd58c3ec61.png">

Reviewed By: cipolleschi

Differential Revision: D40214542

Pulled By: cipolleschi

fbshipit-source-id: a7746d3f1dd5f127dc520c6156383b18e00281ec
2022-10-09 17:34:10 -07:00
Krystof Woldrich 74fda10702 Fix rn config file load codegen (#34895)
Summary:
Resolves https://github.com/facebook/react-native/issues/34894

## 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
-->

[General][Fixed] - Load react-native.config.js from correct path during codegen

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

Test Plan:
Command line output after fix with extra console logs to show the correctness ( hopefully :) ) of the fix.

```bash
 ~/repos/sentry-react-native � � krystofwoldrich/multipleRNsamples ± �node node_modules/react-native/scripts/generate-artifacts.js --path sample-new-architecture --outputPath codegen
[Codegen] Processing react-native core libraries
[Codegen] Found react-native

[Codegen] >>>>> Searching for codegen-enabled libraries in /Users/krystofwoldrich/repos/sentry-react-native/node_modules

[Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js
cwd /Users/krystofwoldrich/repos/sentry-react-native
rnConfigFilePath sample-new-architecture/react-native.config.js
rnConfigFilePath - resolved /Users/krystofwoldrich/repos/sentry-react-native/sample-new-architecture/react-native.config.js
[Codegen] Found sentry/react-native

[Codegen] >>>>> Searching for codegen-enabled libraries in the app

[Codegen] >>>>> Processing FBReactNativeSpec
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/FBReactNativeSpecrHeknw/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios

[Codegen] >>>>> Processing rncore
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/rncorehCjmlJ/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios

[Codegen] >>>>> Processing RNSentrySpec
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/RNSentrySpectMmDpf/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios

>>>>> Creating component provider
Generated schema list: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/rn-tmp-schema-list.json
Generated provider in: codegen/build/generated/ios

[Codegen] Done.
```

Reviewed By: rshest

Differential Revision: D40177746

Pulled By: rshest

fbshipit-source-id: 970f016db26fda003ee3b47d50e80549fdb88415
2022-10-09 15:52:41 -07:00
Jesse Katsumata db8c11d392 Extract the content of the case 'Int32' (Flow, TypeScript) into a single emitInt32 function in the parsers-primitives.js file. (#34906)
Summary:
Part of https://github.com/facebook/react-native/issues/34872

Refactors emitInt32 in codegen parser module into a common parsers-primitive.js

## 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 content of the case 'Int32' (Flow, TypeScript) into a single emitInt32 function

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

Test Plan:
Ran `yarn jest react-native-codegen`

<img width="690" alt="Screen Shot 2022-10-09 at 15 45 21" src="https://user-images.githubusercontent.com/6936373/194742142-801a89c8-f803-4e8d-9b05-cf6bda97ea19.png">

Reviewed By: cipolleschi

Differential Revision: D40212544

Pulled By: cipolleschi

fbshipit-source-id: 845e3758ab654edb972a8d8dc3cfa73464e2d49d
2022-10-09 13:34:38 -07:00
Tarun Chauhan 7a2e3468e9 Extract contents of the case 'BooleanTypeAnnotation' into a single emitBoolean function (#34907)
Summary:
Part of https://github.com/facebook/react-native/issues/34872

This PR extracts the content of the case 'BooleanTypeAnnotation' ([Flow](b444f0e44e/packages/react-native-codegen/src/parsers/flow/modules/index.js (L365-L367)), [TypeScript](00b795642a/packages/react-native-codegen/src/parsers/typescript/modules/index.js (L400-L402))) into a single emitBoolean function in the parsers-primitives.js file. Use the new function in the parsers.

## 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 contents of the case 'BooleanTypeAnnotation' into a single emitBoolean function

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

Test Plan:
Run ```yarn jest react-native-codegen```

<img width="803" alt="image" src="https://user-images.githubusercontent.com/34857453/194751101-3b1a619e-332a-43a9-bfa3-35f5869d7c5f.png">

Reviewed By: cipolleschi

Differential Revision: D40212518

Pulled By: cipolleschi

fbshipit-source-id: 9c1462c1e51a1836f963866dc4101f081898df00
2022-10-09 13:34:38 -07:00
Gabriel Donadel Dall'Agnol 7227bdec8e chore: Extract codegen ParserError from flow and typescript into a common file (#34874)
Summary:
This PR extracts the `ParserError` class from the `error.js` files from the flow and typescript folders into a single file in their parent folder in order to reduce the amount of duplicated code as requested on https://github.com/facebook/react-native/issues/34872

## Changelog

[Internal] [Changed] - Extract codegen `ParserError` from flow and typescript folders into a common file

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

Test Plan:
Run `yarn jest react-native-codegen` and ensure CI is green

![image](https://user-images.githubusercontent.com/11707729/194135137-bf0fc82d-220b-4509-b1bb-1e7dae925efe.png)

Reviewed By: cipolleschi

Differential Revision: D40133301

Pulled By: cipolleschi

fbshipit-source-id: 060571cf993672a9d03003e1a1a7c2aa2f381123
2022-10-09 03:17:28 -07:00
Antoine Doubovetzky 24efebf83d Extracts modules/utils.js files from the flow and typescript folders in parsers-commons (#34898)
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
2022-10-08 08:22:58 -07:00
Phillip Pan 0d3596aa4b hook up offscreen api to runApplication
Summary:
[Changelog]: Internal

integrate the offscreen component when we render an application that is configured to do so

Reviewed By: rubennorte

Differential Revision: D39458472

fbshipit-source-id: 9bd492ca258723cb9cf0b7e4f6c9b0005554e91e
2022-10-07 18:13:04 -07:00
Vincent Riemer c48cb04ce4 Add pointerMove between platform test
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
2022-10-07 12:07:19 -07:00
Vincent Riemer d5f40a9153 Fix MoveAcross pointer event test for iOS
Summary:
Changelog: [iOS][Internal] - Get the "move across" pointer event test passing on iOS

After implementing the "MoveAcross" pointer event test it indicated that the implementation, at least on iOS, was firing the events in an incorrect order. Extrapolating from the test's expectations all the events related to entering/leaving/ect. should fire before the down/move/up instead of placing those down/move/up/ect. between the leave and enter events.

Reviewed By: lunaleaps

Differential Revision: D39221372

fbshipit-source-id: 31b7292e524a9ec9d998e658b7d0ef3ebc825d68
2022-10-07 12:07:19 -07:00
Héctor Ramos 31bedd9815 Add hermes/create-tarball.js script (#34875)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34875

Create common script for generating a Hermes tarball after Hermes is built from source.

Use after building Hermes from source to create a tarball of the resulting build artifacts. The path to the tarball can be passed to CocoaPods via a `HERMES_ENGINE_TARBALL_PATH` envvar in order to use these pre-built Hermes artifacts when installing the `hermes-engine` pod with `pod install`.

Use in Circle CI when creating a Hermes tarball for caching and for use in stable React Native releases.

Usage:

```
pod install

# When Hermes is built from source via CocoaPods, the build artifacts will be located in the Pods directory for hermes-engine

node ./scripts/hermes/create-tarball.js \
  --inputDir ./sdks/hermes \
  --buildType Debug \
  --releaseVersion 1000.0.0 \
  --outputDir .
```

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D40124378

fbshipit-source-id: f9712e87526ccc737afac4599b0ab0a7bb3f3956
2022-10-07 10:21:25 -07:00
Héctor Ramos af4e061523 Circle CI: do not share .git cache across different operating systems (#34885)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34885

We use workflows extensively in Circle CI, so caching a git checkout should help speed up tests when downstream jobs need to checkout the repository. In the current configuration, the Windows job is most likely to run and write to the .git cache first, which results in permission issues when the .git cache is loaded onto macOS or linux hosts.

By splitting the cache by architecture, we may lose on some reusability across jobs with distinct architectures, but it ensures we avoid cross-platform permission issues.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D40150781

fbshipit-source-id: 4a4b2a4da5e20f754b72db0c9852c7c1616b610c
2022-10-07 10:21:25 -07:00
Tarun Chauhan 35556dba60 Extract modules/schema.js from flow and TS folders to a shared file (#34879)
Summary:
This PR reduces code duplication by ```extracting the modules/schema.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``` as 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] - Extracts the modules/schema.js from the flow and typescript folders in a shared file.

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

Test Plan:
run ```yarn jest react-native-codegen```
<img width="788" alt="image" src="https://user-images.githubusercontent.com/34857453/194232470-3ae3b99a-2556-48da-aac6-20ffc95f90a0.png">

Reviewed By: robhogan

Differential Revision: D40143266

Pulled By: robhogan

fbshipit-source-id: 417a5456c8099ad2761617e2be7cf8306c7d9ec4
2022-10-07 09:20:48 -07:00
Zihan Chen (MSFT) c4f9556f7e Make `yarn` and `yarn jest react-native-codegen` works on Windows with git (#34854)
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
2022-10-07 08:04:02 -07:00
Pieter De Baets 370bbd705b Fix ScrollView blurring TextInput when changing focus between inputs
Summary:
On some platforms, when two inputs are in a scrollview, trying to switch focus to another textinput doesn't work and requires two taps. This is because from `_handleTouchEnd` we blur the currently focused input, even if that input had only just become focused from the same touch event. Instead, only blur when the event did not target the current textinput.

Changelog: [Android][Fixed] TextInputs may not get focused when switching inputs in a ScrollView

Reviewed By: jehartzog

Differential Revision: D40159333

fbshipit-source-id: 388f85dff5ac8f24d7e2590e887635391c52d72f
2022-10-07 07:20:33 -07:00
Rubén Norte 21dc5c8e99 Remove import cycle from Systrace module
Summary:
Replaced import cycle with Flow type cycle, which will remove the warnings from Metro.

Changelog: [internal]

Reviewed By: motiz88

Differential Revision: D40177136

fbshipit-source-id: e63986d8918e48e8c4cd8014d306d68fcbd2cf10
2022-10-07 07:18:42 -07:00
Riccardo Cipolleschi ae3dd54fae Fix forward: Filtering platform in codegen (#34897)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34897

This [commit](7680bdeb4f) 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
2022-10-07 06:30:28 -07:00
Lorenzo Sciandra 6552d478bd infra(e2e): fix enabling new arch for RNTester iOS in the E2E script (#34882)
Summary:
Quick follow up to https://github.com/facebook/react-native/pull/34513 to fix an issue that has been bothering the release crew for a while: the iOS new arch component not working! Turns out, we're silly billies �

## 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] - Add new arch flag to iOS pod install command in E2E script

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

Test Plan:
Everything works correctly now:

<img width="987" alt="Screenshot 2022-10-06 at 14 20 09" src="https://user-images.githubusercontent.com/16104054/194327768-4da7d607-879b-46ad-a453-504983980831.png">

Reviewed By: dmytrorykun

Differential Revision: D40143251

Pulled By: dmytrorykun

fbshipit-source-id: 91ba6e22c25770efe6a839d6728d7052bc17a8f2
2022-10-07 06:24:27 -07:00
Pieter De Baets 2afcea2b91 Track observed pointer-events using a single bitset
Summary:
Noticed that we were using a different tag for each pointer event observed (and that weren't clearing these properly when recyling views).

Each of these tags is a hashmap entry and a boxed boolean, so we can do much better by just using a single (boxed) integer.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D40077519

fbshipit-source-id: 130e78c3641eaedfa8787644b98763fd4367bc27
2022-10-07 04:44:48 -07:00
Riccardo Cipolleschi 7680bdeb4f Implement filtering for platform specific spec files
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
2022-10-07 03:21:17 -07:00
Zihan Chen (MSFT) 00b795642a Refactor in turbo module TypeScript codegen: process `(T)`, `T|U`, `T|undefined` and related stuff in a central place (#34814)
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
2022-10-07 03:13:38 -07:00