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

25659 Коммитов

Автор SHA1 Сообщение Дата
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
Lorenzo Sciandra 967de03f30 fix(ios): add xcode 14 workaround (turn off signing resource bundles) for pods (#34826)
Summary:
This is inspired by the Expo workaround d970a9ecbb to address an issue that cocoapods has with Xcode 14: https://github.com/CocoaPods/CocoaPods/issues/11402

This wants to address this https://github.com/facebook/react-native/issues/34673 in a way that we can also cherry-pick on the 0.70 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
-->

[iOS] [Fixed] - add xcode 14 workaround (turn off signing resource bundles) for `React-Core`

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

Test Plan:
Tested locally by opening RNTester via Xcode 14.0.1, and targetting my iPhone as device. After applying the patch, the error for React Core AccessibilityResources disappears.

Also, added ruby test for new patch.

Reviewed By: hramos

Differential Revision: D40063828

Pulled By: hramos

fbshipit-source-id: e10d5b6a917a6a7cbacd14ecfdac55e60e46c6f8
2022-10-07 02:29:59 -07:00
Nicola Corti 73bcedb903 Expose rrc_image to consuming builds
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
2022-10-06 16:41:46 -07:00
Nicola Corti e13aaaa9a4 Expose react_render_imagemanager to consuming builds
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
2022-10-06 16:41:46 -07:00
Andrew Coates 138c88c7da Fix warnings around mixing int and size_t usage in unsafe ways (#34889)
Summary:
react-native-windows builds treat a lot of c++ compiler warnings as errors.  Including ones that cause value truncation when assigning `size_t` values to an `int`.

This fixes the compiler warning, by using `size_t` as the type for `i`, which matches `size`.  I then modified the loop to avoid the value underflow that occurs when decrementing an unsigned zero value.

## Changelog
[Internal] [Changed] - Fix compiler warnings around mixing int and size_t usage in unsafe ways

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

Test Plan: This code change was made in react-native-windows when integrating latest react-native changes.  -- our fabric implementation was able to run through this code without any issues.

Reviewed By: mdvacca

Differential Revision: D40158306

Pulled By: rozele

fbshipit-source-id: b6858cb953635b37fd63a88ed1a372eb3dc394f7
2022-10-06 16:25:44 -07:00
David Vacca 9a44e5bdd8 Create documentation to write C++ ViewManagers in React AR apps
Summary:
Create documentation to write C++ ViewManagers in React AR apps

changelog: [internal] internal

Differential Revision: D40119174

fbshipit-source-id: edce0e6b226a30007c39f924b5896fa2267e98b7
2022-10-06 16:15:04 -07:00
Sam Zhou abb21dd908 Annotate empty objects in xplat
Reviewed By: pieterv

Differential Revision: D40134090

fbshipit-source-id: 3dd0bdb41ed559d9f72f0ff35c14e5551789fcc0
2022-10-06 13:19:11 -07:00
Rubén Norte 7c36d0b6a0 Specify command to regenerate bundled sort-imports ESLint rule
Summary: Changelog: [internal]

Reviewed By: yungsters

Differential Revision: D40138586

fbshipit-source-id: 2d593f6064680beec810ee608852895fdfff4f3b
2022-10-06 09:40:09 -07:00
Nicola Corti 7d2f48c97d Let RNGP set buildConfigFields for New Architecture and Hermes
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
2022-10-06 09:13:12 -07:00
Rubén Norte 40567c21e9 Fix TypeScript tests
Summary:
I fixed the TypeScript definitions for Systrace in a0f56adb07, but I forgot to update the TypeScript tests that were outdated. This diff fixes those tests and CI in OSS.

Changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D40141920

fbshipit-source-id: f73501450af0be6b0b6f836b9a774abb1fa4f620
2022-10-06 06:54:05 -07:00
Nicola Corti c9e6a6056d Hide the C++/Cmake configuration from user space inside the framework
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
2022-10-06 06:40:22 -07:00
Vincent Riemer 36c971695c Add pointer event pointer move event order test
Summary:
Changelog: [Internal] - Add pointer event pointer move event order test

This diff adds a port of the [mouse event mouse move event order test](https://github.com/web-platform-tests/wpt/blob/master/uievents/order-of-events/mouse-events/mouseevents-mousemove.html) but instead used here for testing our pointer event implementation.

Reviewed By: lunaleaps

Differential Revision: D40041387

fbshipit-source-id: 491659405865e1a0d95cfd1b3227a48a6136a98b
2022-10-05 16:06:18 -07:00
Rubén Norte bbb6b9631e Add native function to determine if systrace is enabled
Summary:
We're currently using `global.__RCTProfileIsProfiling` to determine if the app is currently profiling to forward calls to Systrace to native.

We're defining `global.__RCTProfileIsProfiling` when the React Native runtime is initialized (which, in most cases, is on startup or shortly after startup), which means that enabling profiling in the middle of the session doesn't set this value to `true`.

This diff adds a new method (in the global scope for now, as the rest of bindings for Systrace) to check if we're profiling in real time. This call should be very cheap as it's implemented as a JSI function that calls into a C++ API directly.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D40095840

fbshipit-source-id: e7030d6370ecb43d56478b03cb63806ffa0cd0cf
2022-10-05 15:17:53 -07:00
Rubén Norte 789912441e Remove unnecessary checks for profiling in dev mode
Summary:
It doesn't make sense to have checks for whether we're profiling or not in `__DEV__` blocks, where we shouldn't be profiling in the first case.

We're going to remove the `global.__RCTProfileIsProfiling` flag in favor of a function that checks if we're profiling in real time (as opposed to checking if we're profiling only on startup, which is what that value does). This is just to make that migration easier without having to migrate callsites that are bad practices anyway.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D40095841

fbshipit-source-id: ba6cdf4bef8a4c169c50a974671c21144ccee92b
2022-10-05 15:17:53 -07:00
Rubén Norte a0f56adb07 Refactor Systrace module
Summary:
This refactors the systrace module to:
1) Migrate it to ESM
2) Fix the typing of certain parameters (e.g.: `eventName` and `cookie` shouldn't be optional)
2) Fix TypeScript definitions
3) Add inline documentation for methods
4) Add args (metadata) to all methods where it's supported in fbsystrace (`endEvent` and `endAsyncEvent`).
5) Make `setEnabled` a no-op. The only place where this method is called is from native, when starting a profile session. The problem is that implementation for Systrace in OSS (https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/systrace/Systrace.java#L40-L42) doesn't support listeners, so this wouldn't work correctly there. It also doesn't get called with Venice, so instead of fixing it for Venice with the same Meta-internal behavior, I decided to fix it for everyone with the synchronous method.

I'm not considering this a change in the public API of systrace because this module has been broken in OSS for ages and I'm assuming no one's using it at this point.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D40095842

fbshipit-source-id: fee41b2b7ae23aefe059e390c55d139db75247c5
2022-10-05 15:17:53 -07:00
Joshua Selbo 87acdfb436 Remove androidx args on library wrappers
Summary:
Changelog:
[Internal][Removed] - Remove legacy AndroidX arguments on buck targets

Differential Revision: D39835294

fbshipit-source-id: dbbdd7546d60c459b7f9184654dad7a8d5a196e8
2022-10-05 13:49:48 -07:00
Nicola Corti b39e77b3d7 Encapsulate the prefab configuration for Android consumers
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
2022-10-05 11:35:05 -07:00
Nicola Corti 881f1de204 Exclude generated folders from the GenerateCodegenSchemaTask
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
2022-10-05 11:23:59 -07:00
Samuel Susla 0857238633 Pass didUserCallbackTimeout argument to Scheduler's callback
Summary:
changelog: [internal]

RuntimeScheduler's callbacks previously did not pass down argument `didUserCallbackTimeout`. This was intentionally left out because React team intended to remove it. But, as it turns out, it was not removed and it is needed for Offscreen to not enter infinite render loop. In React, it is used here: https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberWorkLoop.new.js#L1022-L1028

Reviewed By: ryancat

Differential Revision: D40060377

fbshipit-source-id: c45719fbbd0275ab2bcf9a2bbf0191aaa96010cc
2022-10-05 10:35:33 -07:00
Héctor Ramos 2a21d5a28e Exclude Hermes debugger in release builds
Summary:
Fixes Xcode release builds when Hermes is enabled.

The Hermes debugger is loaded by the Hermes executor only if HERMES_ENABLE_DEBUGGER is defined. The hermes-engine Pod would set `HERMES_ENABLE_DEBUGGER=0` in release builds, but of course this would satisfy the HERMES_ENABLE_DEBUGGER ifdef check, leading to build time issues due to missing `hermes::debugger` symbols.

Now, both the `hermes-engine` and `React-hermes` pods only set `HERMES_ENABLE_DEBUGGER=1` in debug builds. No gcc preprocessor definition is added by these pods in release builds.

Changelog:
[iOS] [Changed] - Do not load Hermes inspector in release builds

Reviewed By: cipolleschi

Differential Revision: D40077503

fbshipit-source-id: dd9ce148e8521fc4e43e47e90f29ba8f7c9b7e4a
2022-10-05 09:19:05 -07:00
Ruslan Shestopalyuk aa5d43fe54 Merge enablePropIteratorSetter flags into a single one in CoreFeatures (#34869)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34869

Changelog: [Internal]

This merges all instances of `enablePropIteratorSetter` into a single one.

Both `AccesibilityProps` and `BaseTextProps` had their own instances if it, which is now redundant.

Reviewed By: cipolleschi

Differential Revision: D40062555

fbshipit-source-id: b6ccf5a9538612dd731a6f9c4eaceeebcb6d95be
2022-10-05 05:09:37 -07:00
Pieter De Baets bed977b178 Reset View tag when recycling
Summary:
Automation tests were hitting issues with view recycling enabled because we use the main tag field to lookup views, and not properly resetting it when recycling.

Changelog: [Internal]

Reviewed By: jehartzog

Differential Revision: D40076594

fbshipit-source-id: 5f518b979a23562f7e7fc8271488678e78f50e91
2022-10-05 04:23:26 -07:00
Gabriel Donadel Dall'Agnol 530dae8a45 chore: rename hermes-inspector-msggen to @react-native/hermes-inspector-msggen (#34850)
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
2022-10-05 03:57:08 -07:00
Lorenzo Sciandra 3610168bb0 add 0.70.2 changelog (#34859)
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.70.2

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

Test Plan: N/A

Reviewed By: NickGerleman

Differential Revision: D40056094

Pulled By: NickGerleman

fbshipit-source-id: 1e833b63080351c66dafc4e43f3681220a9738eb
2022-10-05 03:42:33 -07:00
Sam Zhou b56d709e6e Annotate `useCallback` in xplat (11/n)
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
2022-10-04 18:51:59 -07:00
Pearce Liang 108c876206 Fix comment typo 'layed out' to 'laid out' (#1061)
Summary:
Just a simple typo fix.

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

Reviewed By: javache

Differential Revision: D40059940

Pulled By: javache

fbshipit-source-id: 052a4a8fe80ff49e059a3096500dbe5bddcb73db
2022-10-04 10:54:16 -07:00