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

25492 Коммитов

Автор SHA1 Сообщение Дата
Gabriel Donadel Dall'Agnol 34db2d4e93 feat: Add string support to the transform property (#34660)
Summary:
This updates the `transform` property to support string values as requested on https://github.com/facebook/react-native/issues/34425. This also updates the existing unit tests of the `processTransform` function ensuring the style processing works as expected and updates the TransformExample on RNTester in order to facilitate the manual QA of this.

## Changelog

[General] [Added] -  Add string support to the transform property

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

Test Plan:
1. Open the RNTester app and navigate to the Transforms page
2. Check the transform style through the `Transform using a string` section

https://user-images.githubusercontent.com/11707729/189550548-ee3c14dd-11c6-4fd1-bd74-f6b52ecb9eae.mov

Reviewed By: lunaleaps

Differential Revision: D39423409

Pulled By: cipolleschi

fbshipit-source-id: 0d7b79178eb33f34ae55a070ce094360b544361f
2022-09-22 07:30:34 -07:00
Riccardo Cipolleschi b7add0aadb Always generate an EmptyNativeState (#34754)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34754

This Diff is the second step of enabling the CodeGen to parse and generate a NativeState for the components.

The feature has been largely requested by the OSS community but it could be also helpful for people in Meta.

## Changelog
[General][Added] - Always generate an empty NativeState for Fabric Components

Reviewed By: cortinico

Differential Revision: D39696435

fbshipit-source-id: e24768af78f59696c0b4db009e8065bb5c89316b
2022-09-22 06:41:44 -07:00
Riccardo Cipolleschi 69f8cf14f0 Always generate the EventEmitters (#34750)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34750

This Diff is the first step of enabling the CodeGen  to parse and generate a NativeState for the components.

The feature has been largely requested by the OSS community but it could be also helpful for people in Meta.

To allow the generation of custom `NativeState`, we first have to always generate a `ViewEventEmitter`: that's because the `ConcreteShadowNode` template lists the Generics with this order: `Name`, `Props`, `EventEmitter`, Others...
If we skip the `EventEmitters` and we put the `State`, React Native would think that the State is actually an `EventEmitter` and the build step will fail.

## Changelog
[General][Added] - Always generate a ViewEventEmitter for Fabric Components

Reviewed By: cortinico

Differential Revision: D39509869

fbshipit-source-id: 390cc146ef013baf1ed09d55a0182a5aeb5b9d9e
2022-09-22 06:41:44 -07:00
Samuel Susla 15dbd9121d Back out "Fix: Install Fabric UIManager before main bundle execution"
Summary:
Original commit changeset: 4491d6de1109

Original Phabricator Diff: D39493654 (447be62909)

changelog: [internal]

Reviewed By: javache

Differential Revision: D39727129

fbshipit-source-id: 412a7fc5e4bf8db26cde7d420e71cf1f314cdc93
2022-09-22 06:36:59 -07:00
fortmarek 22940e4177 Use verdaccio for the template e2e test (#34577)
Summary:
This PR adds [verdaccio](https://github.com/verdaccio/verdaccio) to release packages in the `packages` directory during the E2E test on CI.

The rationale behind this is the following:
- Firstly, we wanted to push the [monorepo RFC](https://github.com/react-native-community/discussions-and-proposals/pull/480). We hit an issue when renaming the packages to follow the same convention caused by the e2e test using the template to fail. This is because the template installs packages from the live version of npm – and if you just rename a package in a given PR without releasing it, the package understandably can't be installed since it's not published, yet – as you can see [here](https://app.circleci.com/pipelines/github/facebook/react-native/15286/workflows/149df51f-f59b-4eb3-b92c-20c513111f04/jobs/282135?invite=true#step-108-283).
- Secondly, the current e2e test on `main` does not actually test the latest code of the packages in the `packages` directory as it simply downloads the latest versions from npm. This creates a divide between what's tested and what users should expect when using nightlies or when a new minor is released.

## 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] - Use verdaccio for template e2e test

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

Test Plan: `test_js` CI check should pass. Additionally, I have temporarily updated the [PR](https://github.com/facebook/react-native/pull/34572) renaming `assets` to `assets-registry` to include the verdaccio changes – the `test_js` passes there, additionally proving merging this PR will unblock us with the rename PRs.

Reviewed By: cipolleschi

Differential Revision: D39723048

Pulled By: cortinico

fbshipit-source-id: aeff3811967360740df3b3dbf1df50e506fb72d8
2022-09-22 05:02:37 -07:00
Kudo Chien 3d7e1380b4 Fix port as -1 if dev server without specifying port on Android (#34705)
Summary:
when specifying dev server without port, e.g. http://www.example.com/, there are some issues.

1. redbox error
<img src="https://user-images.githubusercontent.com/46429/190540390-8ee420f2-7642-427b-9f2e-e0c6d31015f8.png" width="30%">

2. showing -1 in loading view

<img src="https://user-images.githubusercontent.com/46429/190540727-158f35ad-359f-443a-a4b0-768dd2f7e400.png" width="50%">

the root cause is coming from [`java.net.URL.getPort()` will return -1 when the url doesn't have a port](https://developer.android.com/reference/java/net/URL#getPort()). this pr replaces the parser to [`okhttp3.HttpUrl`](https://square.github.io/okhttp/4.x/okhttp/okhttp3/-http-url/#port) that it will have default port 80 for http or port 443 for https. the two call paths should only serve http/https address, not file:// address. it should be safe to change from java.net.URL to okhttp3.HttpUrl.

not fully related, in the case above, android will connect to `ws://www.example.com/:8097` for react-devtools
we should strip the trailing slash in *setUpReactDevTools.js*

## Changelog

[Android] [Fixed] - Fix port as -1 if dev server without specifying port on Android

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

Test Plan:
test on rn-tester with the following steps

1. `yarn start`
2. open another terminal and run `ngrok http 8081` and it will return a tunnel url, e.g. `71a1-114-36-194-97.jp.ngrok.io`
3. open dev setting in app and change the dev server to `71a1-114-36-194-97.jp.ngrok.io`
5. reload the app

Reviewed By: cipolleschi

Differential Revision: D39573988

Pulled By: cortinico

fbshipit-source-id: 397df90ab30533207bd87a3f069132d97c22c7fd
2022-09-22 04:20:44 -07:00
Gabriel Donadel Dall'Agnol c2b699abc5 chore: Fix RNTester typos (#34757)
Summary:
While working on https://github.com/facebook/react-native/pull/34550 I noticed that a couple of words inside the RNTester package were misspelled, this gave me the idea to test other files as well using the VS Code extension [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) which unveiled quite a few other typos.

## Changelog

[Internal] [Fixed] - Fix RNTester typos

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

Test Plan: Shouldn't require much testing as this is just fixing some typos inside the RNTester package.

Reviewed By: dmytrorykun

Differential Revision: D39722889

Pulled By: cortinico

fbshipit-source-id: a575ab8337586c5fe2d68ce73d2aae27d24a6384
2022-09-22 03:14:51 -07:00
Rujin Cao 41c6c69aaa '@emails' -> '@oncall' (*.js)
Differential Revision: D39684030

fbshipit-source-id: 69f281e9e630334ca405a92f75b659795d9ad3e1
2022-09-21 20:47:05 -07:00
Samuel Susla 59f25da5a4 React Native sync for revisions c28f313...0cac4d5
Summary:
This sync includes the following changes:
- **[0cac4d54c](https://github.com/facebook/react/commit/0cac4d54c )**: Double invoked effects on suspended children ([#25307](https://github.com/facebook/react/pull/25307)) //<Samuel Susla>//
- **[3d615fc14](https://github.com/facebook/react/commit/3d615fc14 )**: Grammar. Removed doubles of the word "the". ([#25295](https://github.com/facebook/react/pull/25295)) //<Victoria Graf>//
- **[6e3bc8a2e](https://github.com/facebook/react/commit/6e3bc8a2e )**: [DevTools] Check if Proxy exists before creating DispatcherProxy ([#25278](https://github.com/facebook/react/pull/25278)) //<Tianyu Yao>//
- **[e7fc04b29](https://github.com/facebook/react/commit/e7fc04b29 )**: [react-dom] Reorganize react-dom internals to match react ([#25277](https://github.com/facebook/react/pull/25277)) //<Josh Story>//
- **[0b54e0047](https://github.com/facebook/react/commit/0b54e0047 )**: Handle rejections to avoid uncaught rejections ([#25272](https://github.com/facebook/react/pull/25272)) //<Sebastian Markbåge>//
- **[c5d06fdc5](https://github.com/facebook/react/commit/c5d06fdc5 )**: [Flight] Fix Webpack Chunk Loading ([#25271](https://github.com/facebook/react/pull/25271)) //<Sebastian Markbåge>//
- **[975b64464](https://github.com/facebook/react/commit/975b64464 )**: [Flight] response.readRoot() -> use(response) ([#25267](https://github.com/facebook/react/pull/25267)) //<Sebastian Markbåge>//
- **[60fbb7b14](https://github.com/facebook/react/commit/60fbb7b14 )**: [Flight] Implement FlightClient in terms of Thenable/Promises instead of throwing Promises ([#25260](https://github.com/facebook/react/pull/25260)) //<Sebastian Markbåge>//
- **[c91a1e03b](https://github.com/facebook/react/commit/c91a1e03b )**: experimental_useEvent ([#25229](https://github.com/facebook/react/pull/25229)) //<Lauren Tan>//
- **[346c7d4c4](https://github.com/facebook/react/commit/346c7d4c4 )**: straightford explicit types ([#25253](https://github.com/facebook/react/pull/25253)) //<Jan Kassens>//
- **[3401e9200](https://github.com/facebook/react/commit/3401e9200 )**: useMemoCache implementation ([#25143](https://github.com/facebook/react/pull/25143)) //<Joseph Savona>//
- **[0556bab32](https://github.com/facebook/react/commit/0556bab32 )**: [Transition Tracing] More Accurate End Time ([#25105](https://github.com/facebook/react/pull/25105)) //<Luna Ruan>//
- **[5fdcd23aa](https://github.com/facebook/react/commit/5fdcd23aa )**: Flow: upgrade to 0.140 ([#25252](https://github.com/facebook/react/pull/25252)) //<Jan Kassens>//
- **[5c43c6f02](https://github.com/facebook/react/commit/5c43c6f02 )**: Unwind the current workInProgress if it's suspended ([#25247](https://github.com/facebook/react/pull/25247)) //<Sebastian Markbåge>//
- **[e52fa4c57](https://github.com/facebook/react/commit/e52fa4c57 )**: Add early exit to strict mode ([#25235](https://github.com/facebook/react/pull/25235)) //<Samuel Susla>//
- **[6aa38e74c](https://github.com/facebook/react/commit/6aa38e74c )**: Flow: enable unsafe-addition error ([#25242](https://github.com/facebook/react/pull/25242)) //<Jan Kassens>//
- **[ba7b6f418](https://github.com/facebook/react/commit/ba7b6f418 )**: Flow: upgrade to 0.132 ([#25244](https://github.com/facebook/react/pull/25244)) //<Jan Kassens>//
- **[9328988c0](https://github.com/facebook/react/commit/9328988c0 )**: Flow: fix Fiber typed as any ([#25241](https://github.com/facebook/react/pull/25241)) //<Jan Kassens>//
- **[c739cef2f](https://github.com/facebook/react/commit/c739cef2f )**: Flow: ReactFiberHotReloading recursive type ([#25225](https://github.com/facebook/react/pull/25225)) //<Jan Kassens>//
- **[c156ecd48](https://github.com/facebook/react/commit/c156ecd48 )**: Add some test coverage for some error cases ([#25240](https://github.com/facebook/react/pull/25240)) //<Sebastian Markbåge>//
- **[3613284dc](https://github.com/facebook/react/commit/3613284dc )**: experimental_use(context) for server components and ssr ([#25226](https://github.com/facebook/react/pull/25226)) //<mofeiZ>//
- **[269c4e975](https://github.com/facebook/react/commit/269c4e975 )**: Prevent infinite re-renders in StrictMode + Offscreen ([#25203](https://github.com/facebook/react/pull/25203)) //<Samuel Susla>//
- **[8003ab9cf](https://github.com/facebook/react/commit/8003ab9cf )**: Flow: remove explicit object syntax ([#25223](https://github.com/facebook/react/pull/25223)) //<Jan Kassens>//
- **[492c6e29e](https://github.com/facebook/react/commit/492c6e29e )**: Flow: upgrade to 0.127 ([#25221](https://github.com/facebook/react/pull/25221)) //<Jan Kassens>//
- **[8a9e7b6ce](https://github.com/facebook/react/commit/8a9e7b6ce )**: Flow: implicit-inexact-object=error ([#25210](https://github.com/facebook/react/pull/25210)) //<Jan Kassens>//
- **[37cc6bf12](https://github.com/facebook/react/commit/37cc6bf12 )**: Remove useDeferredValue and useTransition from Flight subset ([#25215](https://github.com/facebook/react/pull/25215)) //<Sebastian Markbåge>//

Changelog:
[General][Changed] - React Native sync for revisions c28f313...0cac4d5

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D39696377

fbshipit-source-id: 113878d22d6244b8555b5fb86db1da5d43f7cfd9
2022-09-21 17:41:50 -07:00
Ramanpreet Nara 6529383675 Always flush in NativeAnimatedTurboModule
Summary:
## Summary
In the past, NativeAnimatedModule could animate **both** Paper **and** Fabric components.

For Fabric nodes, we needed to manually flush NativeAnimatedModule's operations queue. So, we started tracking which nodes were Fabric owned in NativeAnimatedModule.

## Changes
With bridgeless mode, all components must be Fabric-owned. So, should be able to remove this fabric ownership tracking logic and **always flush.**

## Is this safe?
In the worst case, we over-flush. This doesn't seem bad. cc sammy-SC.

## Do we still need flushing?
Arguably, all this manual flushing should be unnecessary, because we already migrated AnimatedModule's Paper integration to RCTSurfacePresenterObserver, here: D14336760 (544d9fb10b).  So, do we still need this flushing?

Yes. Here's what happens when you disable all the manual flushing in bridgeless mode: https://pxl.cl/2dqPf.

Long-term, we need to re-think this operations queuing in NativeAnimatedTurboModule. I left my thoughts in T130668424 (Investigation - Day 5).

Changelog: [Internal]

Reviewed By: p-sun

Differential Revision: D39592477

fbshipit-source-id: e971edc0d99661a37b5f430bce46c78acaa121c0
2022-09-21 12:59:09 -07:00
Saad Najmi 6ba5fa946d Update pressable hover props (#34740)
Summary:
This is a mirror of https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62344 . I am updating some typescript types for props that were added with https://github.com/facebook/react-native/issues/32405

## 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] - Fixed missing Pressable hover props in typescript definition

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

Test Plan: Added a test case.

Reviewed By: lunaleaps

Differential Revision: D39688606

Pulled By: cortinico

fbshipit-source-id: 98ea5f64e6ac264772466455e6d5ab99a8427d3a
2022-09-21 11:50:21 -07:00
Pieter De Baets eddff32b6f Update Hermes
Summary: Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D39657809

fbshipit-source-id: 21a4a39c5c21d3932db0e8513dad8f005ea46148
2022-09-21 07:16:37 -07:00
Nicola Corti 596111fabf Cleanup of ReactAndroid/build.gradle after AGP 7.3.x bump (#34747)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34747

Just a minor cleanup after the AGP bump.

Changelog:
[Internal] [Changed] - Cleanup of ReactAndroid/build.gradle after AGP 7.3.x bump

Reviewed By: cipolleschi

Differential Revision: D39687286

fbshipit-source-id: 441e449b51b25e4152cf1e7e7e22c7c9f1432d05
2022-09-21 04:28:34 -07:00
Pieter De Baets d9f93d30e0 Disable default clipping in Fabric's SafeAreaView implementation
Summary:
This behaviour diverges from the original SafeAreaView implementation and causes issues when you try to use SafeAreaView in non-root placements (not recommended)

Changelog: [iOS][Internal]

Reviewed By: sammy-SC

Differential Revision: D39497303

fbshipit-source-id: 03bc288557f611bd4a8c16b3a6df8887e89ee9ec
2022-09-21 04:16:43 -07:00
Gianluca Spada 2f6b2127d9 Fix: Codegen template error in RCTThirdPartyFabricComponentsProvider (#34738)
Summary:
When `GenerateRCTThirdPartyFabricComponentsProviderCpp.js` generates `RCTThirdPartyFabricComponentsProvider.mm` an edge case happens in the following situation:
- The same library exports multiple modules with one component each (i.e. one component per file);
- The **first component** is excluded for iOS via the `excludedPlatforms` property in *codegenNativeComponent*.

A "loose" comma appears in the generated template, breaking the code.

```c++
Class<RCTComponentViewProtocol> RCTThirdPartyFabricComponentsProvider(const char *name) {
  static std::unordered_map<std::string, Class (*)(void)> sFabricComponentsClassMap = {
, // <-- the offending comma
    {"NativeComponent2", NativeComponent2Cls}, // rnmylibrary
  };
}
```

At some point, `GenerateRCTThirdPartyFabricComponentsProviderCpp.js` does not properly filter out empty arrays resulting from excluded components. This does not seem to be a problem when the excluded component is not the first being processed, as the comma gets added at the end of the previous line, after the comment with the name of the library.

## 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] - Fix error in the Codegen template for ThirdPartyFabricComponentsProvider

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

Test Plan:
<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. -->

This is the schema that leads to the bug. Notice that the first component was excluded for iOS.
```json
{
  "modules": {
    "ComponentFile1": {
      "type": "Component",
      "components": {
        "NativeComponent1": {
          "excludedPlatforms": ["iOS"]
          "extendsProps": [
            {
              "type": "ReactNativeBuiltInType",
              "knownTypeName": "ReactNativeCoreViewProps"
            }
          ],
          "events": [],
          "props": [],
          "commands": []
        }
      }
    },
    "ComponentFile2": {
      "type": "Component",
      "components": {
        "NativeComponent2": {
          "extendsProps": [
            {
              "type": "ReactNativeBuiltInType",
              "knownTypeName": "ReactNativeCoreViewProps"
            }
          ],
          "events": [],
          "props": [],
          "commands": []
        }
      }
    }
  }
```

`GenerateRCTThirdPartyFabricComponentsProviderCpp.js` should generate a template without the comma in the wrong position (before NativeComponent2).

I also added an additional test case to cover this problem. All the other tests passed.

Reviewed By: sammy-SC

Differential Revision: D39686573

Pulled By: cipolleschi

fbshipit-source-id: 6054464d024218eb0b2e02974aa5cc7c8aebbbc9
2022-09-21 04:13:12 -07:00
Nenad Vojnovic 8745a148b6 Fix HERMES_ENABLED check in scripts/react-native-xcode.sh (#34675)
Summary:
Checking if Hermes is enabled is failing because there is no `podfile.lock` file in the directory where this script is executed and `USE_HERMES` will be set to `false` which will prevent building Hermes binary jsbundle.

## Changelog

[iOS] [Fixed] - `HERMES_ENABLED` check fixed in react-native-xcode.sh

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

Test Plan:
1. Enable Hermes
2. Make a release build
3. Verify the `main.jsbundle` file is Hermes binary bundle

Reviewed By: cortinico

Differential Revision: D39686608

Pulled By: cipolleschi

fbshipit-source-id: 237c77ced484d4ab77e576c7a2bb7b6826228017
2022-09-21 03:40:44 -07:00
Nicola Corti 67bc498b24 Bump AGP to 7.3.0 inside the template (#34739)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34739

AGP 7.3.0 just got released which is glorious!
This allows us to remove a lot of unnecessary boilerplate to handle correct task ordering
inside the template

This requires "react-native-gradle-plugin" version 0.71.1 to be published on NPM.

Changelog:
[Android] [Changed] - Bump AGP to 7.3.0 inside the template

Reviewed By: mdvacca, dmytrorykun

Differential Revision: D39653419

fbshipit-source-id: 517363c952cbad2be0f2766c0a2b7daf3e75048b
2022-09-20 19:31:17 -07:00
Nicola Corti 765a4a97e4 Bump react-native-gradle-plugin to 0.71.1
Summary:
As we're shipping the AGP 7.3.x bump which requires
changes of the Gradle Plugin, I'm bumping a version so I can use it
already in the new template.

Changelog:
[Internal] [Changed] - Bump react-native-gradle-plugin to 0.71.1

Reviewed By: mdvacca, dmytrorykun

Differential Revision: D39653418

fbshipit-source-id: 9e898530345f1a3461c44c04b4cc5e7736a0f6a5
2022-09-20 19:31:17 -07:00
Nick Gerleman de8d31a5aa Fix crash in DEV when VirtualizedList_EXPERIMENTAL is loaded
Summary:
`verifyVirtualizedList` chokes on missing displayName in DEV, due to a mistake in D39648806 (a0d1585cdb). Not sure why this isn't triggered in Jest tests (maybe it is able to fill displayName via transform?), but this fixes the issue in dev mode.

Changelog:
[Internal][Fixed] - Fix crash in DEV when VirtualizedList_EXPERIMENTAL is loaded

Reviewed By: mdvacca

Differential Revision: D39670991

fbshipit-source-id: b1a784aa3fffdc5f2f025eb1f689307132aad9b6
2022-09-20 16:21:55 -07:00
Rob Hogan c27501bb87 Update to Jest 29 (#34724)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34724

Following on from the recent upgrade from Jest 26->27, this brings us up to present day Jest 29 for tests of React Native itself, Metro, and Meta-internal code. An update to the template for RN apps will follow.

Changelog:
[Internal][Fixed] Update to Jest 29

Reviewed By: huntie

Differential Revision: D39543504

fbshipit-source-id: b47fdb678212b475881ec19085f6cd45a4530333
2022-09-20 14:15:50 -07:00
Luna Wei 6eee307778 Fix: Publish types folder (#34727)
Summary:
From changes in https://github.com/facebook/react-native/pull/34614, I forgot to actually export the types directory.

## 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] - Add types directory as part of the npm package

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

Test Plan: Verified on [`build_npm_package_1`](https://app.circleci.com/pipelines/github/facebook/react-native/15799/workflows/4fd57bfc-0142-49d9-a1a6-83fa43f0e371/jobs/295438) job where we create the commitly, that `types` folder is included and `__typetests__` are ignored

Reviewed By: cipolleschi

Differential Revision: D39646310

Pulled By: lunaleaps

fbshipit-source-id: 361f7925fa1cdc30d0865d291933c7fce9e0fa49
2022-09-20 12:39:58 -07:00
Luna Wei bcb58089c4 Create PointerEventState
Summary: Changelog: [Internal] - A refactor to pass the object PointerEventState containing relevant state / and also properties for pointerEvent objects

Reviewed By: vincentriemer

Differential Revision: D39626285

fbshipit-source-id: e2ff5313ef03d7d2d36c35ca459950ec07650df2
2022-09-20 12:01:07 -07:00
Luna Wei 4ca089f94c Simplify Coalescing Key
Summary:
Changelog: [Internal]
Stop using `TouchEventCoalescingKeyHelper` for tracking and stop making the distinction between traditional touch events (down, up, move) vs hover only events. The only events that currently coalesce are `onpointermove` events. This change uses just one counter now that we increment whenever some non-move event is fired.

Let me know if there's a simpler way to ensure counter doesn't overflow.
This change also ensures we're overriding `getCoalescingKey` which isn't used by Fabric but for old event emitter it might be (which we use for native animations). Part of that requires the `coalescingKey` to be a short so updated to that.

There was also a bug where I forgot to pass `mLastButtonState` to one of the dispatch calls. Will be wrokign on refactor so its less argument soup.

Reviewed By: javache

Differential Revision: D39530927

fbshipit-source-id: 689fa98580b206a480cc08121971cdf96bdbbfaa
2022-09-20 12:01:07 -07:00
Nick Gerleman 773615bc9d Remove listKey from TS typings
Summary:
The prop is removed as part of D39589089 (bc5cb7cd79) (no longer does anything). Remove from the TS declarations.

Changelog:
[General][Removed] - Remove listKey from TS typings

Reviewed By: lunaleaps

Differential Revision: D39650827

fbshipit-source-id: dd9b5eccba1b9f6964a6d60ea5bae9913e8396e3
2022-09-20 11:39:05 -07:00
Rob Hogan a0483991f4 CircleCI: Remove `test_codegen` (#34733)
Summary:
The CircleCI `test_codegen` job currently runs tests under `packages/react-native-codegen`. Because it runs from that working directory, it doesn't pick up the project root's `jest.config.js`, which is a problem for https://github.com/facebook/react-native/pull/34724 (snapshot format configuration in `jest.config.js`)

`react-native-codegen` tests are *already run* by the `test_js` job, as can be seen from the CircleCI logs
https://app.circleci.com/pipelines/github/facebook/react-native/15818/workflows/41034d00-7061-46e8-a03d-abdcc7fd7e2f/jobs/295804/parallel-runs/0/steps/0-107 , so the job isn't necessary, and this PR removes it. CC cipolleschi

## Changelog

[Internal] [Fixed] - Remove redundant `test_codegen` job from CircleCI.

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

Test Plan: CircleCI!

Reviewed By: lunaleaps

Differential Revision: D39660829

Pulled By: robhogan

fbshipit-source-id: d7b09cc90a30e7604e2645e2bd0c16f840443153
2022-09-20 11:08:28 -07:00
Luna Wei 2f6e0358a9 Add id property
Summary:
Changelog: [Internal] - Apply changes from recent `id` property adds. These are changes by
gabrieldonadel from https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62019

Reviewed By: cipolleschi

Differential Revision: D39646408

fbshipit-source-id: d75f2e2b5b3d157825c4aaf21775e0d5165383ee
2022-09-20 10:57:58 -07:00
Luna Wei 88bfc65803 Update Accessibility types for aria props
Summary: Changelog: [Internal] - Update the base accessibility props to include the added aria props. See https://github.com/facebook/react-native/compare/0.70-stable...main for changes.

Reviewed By: cipolleschi

Differential Revision: D39633224

fbshipit-source-id: 6c08ab8540b8b6e2b57f066a35754376c5ae3d68
2022-09-20 10:57:58 -07:00
Nicola Corti 9f6711fda0 Bump AGP to 7.3.0 inside ReactAndroid (#34707)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34707

AGP 7.3.0 just got released which is glorious!
This allows us to remove a lot of unnecessary boilerplate to handle correct task ordering
on both React Android & the template

Changelog:
[Android] [Changed] - Bump AGP to 7.3.0

Reviewed By: mdvacca

Differential Revision: D39553534

fbshipit-source-id: 9680893e9f48cac867206aeb7eb468dbf91c1643
2022-09-20 10:30:40 -07:00
Gabriel Donadel Dall'Agnol f63d4e7deb refactor: Convert Animated directory to use ESModule imports/exports (#34539)
Summary:
This PR refactors the Animated directory to use ESModule imports/exports instead of using a mixture of the 2 module formats, as requested on https://github.com/facebook/react-native/issues/34425.

## Changelog

[Internal] [Changed] - Convert all files in the Animated directory to use ESModule imports/exports

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

Test Plan: This doesn't really add or modify any existing features so checking if CI passes should be enough

Reviewed By: yungsters

Differential Revision: D39235720

Pulled By: yungsters

fbshipit-source-id: 84b4c0a71dc9fca1ab7053263f1cf7c336df58c1
2022-09-20 10:05:48 -07:00
Nick Gerleman a0d1585cdb Move VirtualizedList_EXPERIMENTAL to ES6 import/export
Summary:
VirtualizedList uses a combination of ES6 and CommonJS imports/exports. This moves fully to ES6 imports and exports, in the experimental version (which should soon replace the original).

Changelog:
[Internal][Changed] - Move VirtualizedList_EXPERIMENTAL to ES6 import/export

Reviewed By: rshest

Differential Revision: D39648806

fbshipit-source-id: a5da40f62a6010cd5b9894b02a91af86d3a8b995
2022-09-20 05:21:08 -07:00
Nick Gerleman 8f0975a3b7 Extract VirtualizedListCellRenderer
Summary:
VirtualizedList is large and complicated, getting larger and more complicated. This splits out a subcomponent, the cell renderer into its own file, since it is relatively isolated already. This uses the copy from VirtualizedList_EXPERIMENTAL, whose only real difference is exposing focus capture events to the containing VirtualizedList.

Changelog:
[Internal][Changed] - Extract VirtualizedListCellRenderer

Reviewed By: rshest

Differential Revision: D39648087

fbshipit-source-id: bb7c2eff0c658713c256650596f86e8788019baf
2022-09-20 05:21:08 -07:00
Nick Gerleman bc5cb7cd79 Remove usages of listKey
Summary:
Now that the prop noops, remove the usages of the property. This is the point of no return for the prop.

Replaced listKey usage with a combination of `flow check`, regex replace, manual inspection.

Changelog:
[General][Removed] - Remove usages of listKey

Reviewed By: fred2028

Differential Revision: D39589089

fbshipit-source-id: 722ebb7dce038a2709656394b7d736e72f488bb7
2022-09-20 04:13:22 -07:00
Rob Hogan 408471f041 CircleCI: Use `nodejs-lts` for Windows tests (#34726)
Summary:
Currently we use `nvm install 16` in the `test_windows` CircleCI job. With the "official" non-Windows NVM, this means latest 16 (16.17.0), but that's not the case for NVM-Windows, [which simply appends `.0.0`](https://github.com/coreybutler/nvm-windows/blob/1.1.7/src/nvm.go#L384) unless [the major version is one character long](https://github.com/coreybutler/nvm-windows/blob/1.1.7/src/nvm.go#L210). The Windows orb includes NVM-Windows 1.1.7 (even on the latest 5.0.0 orb), which does not support `nvm install lts` (added 1.1.9). Updating NVM isn't trivial as the system/orb version takes precedence over any Chocolately installation.

Running tests on 16.0.0 blocks Jest 29, which requires [`^16.10.0`](https://github.com/facebook/jest/blob/v29.0.3/packages/jest-create-cache-key-function/package.json#L17).

I initially tried installing a specific Node JS version with NVM, but NVM-Windows 1.1.7 doesn't support newer Node versions due to https://github.com/npm/cli/issues/4234.

So this PR switches from using NVM-Windows to just using Chocolately Node JS packages. `nodejs-lts` tracks the latest LTS. IMO, given we're only testing against one Node JS version with Windows, the latest LTS is a good option, but versions can be specified with `--version` if we want to pin it instead.

Yarn is available through [corepack](https://nodejs.org/api/corepack.html#corepack) since 16.9, so doesn't need to be installed separately.

## Changelog

[Internal] [Fixed] - CircleCI: Update Node JS version used on Windows tests from 16.0.0 to 16.17.0

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

Test Plan: Tested via painful trial and error on my fork: https://app.circleci.com/pipelines/github/robhogan/react-native/19/workflows/0c23a77f-40d2-4c36-933b-53c14acb7907

Reviewed By: cipolleschi

Differential Revision: D39647377

Pulled By: robhogan

fbshipit-source-id: 733da49c632eab26a09ba9cd0175419b9144f9d2
2022-09-20 03:32:04 -07:00
Marshall Roch 059e41e217 upgrade to flow 0.187.1
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D39643297

fbshipit-source-id: efdd6b41a79cc715b12ea442b6b57e400dbb6cac
2022-09-19 22:19:14 -07:00
fabriziobertoglio1987 f3847eeec2 Text with onPress or onLongPress handler is not accessible with TalkBack (#34284)
Summary:
>Finally, the last catch relates to why these views are considered focusable. We've been working with the assumption that they are only focusable because accessible="true", but this is not the only property that can make a view focusable on Android. Android also makes all elements with onClick listeners or onLongPress listeners focusable

Adding onPress handler to a Text Component does not call setClickable(true) ([test case](https://github.com/facebook/react-native/issues/30851#issuecomment-1194957300)) https://github.com/facebook/react-native/issues/30851#issuecomment-1196297746

Pressable, TouchableOpacity, Switch, TextInput, and TouchableNativeFeedback are focusable/accessible by default without an onPress handler or accessible prop.

```jsx
<TouchableOpacity />
```
The TouchableOpacity is accessible

```jsx
<TouchableOpacity accessible={false} />
```
The TouchableOpacity is not accessible

```jsx
<TouchableOpacity accessible={false} onPress={() => console.log('pressed')} />
```

The TouchableOpacity is accessible.

a70354df12/Libraries/Components/Touchable/TouchableOpacity.js (L249-L251)

This and other PRs fixes https://github.com/facebook/react-native/issues/30851

## Changelog

[Android] [Fixed] - Text with onPress or onLongPress handler is not accessible with TalkBack

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

Test Plan:
main branch https://github.com/facebook/react-native/issues/30

<details><summary>pr branch</summary>
<p>

<video src="https://user-images.githubusercontent.com/24992535/181207388-bbf8379b-71b8-44e9-b4b2-b5c44e9ac14d.mp4" width="1000" />
</p>
</details>

Reviewed By: cipolleschi

Differential Revision: D39179107

Pulled By: blavalla

fbshipit-source-id: 3301fb2b799f233660e3e08f6a87dad294ddbcd8
2022-09-19 20:38:29 -07:00
Brett Lavalla 353b1b0f8b Simplify Accessibility Heading role for React Native (Android)
Summary:
The previous approach to set a heading in Android required us to trick the accessibility service into thinking that this element was the heading inside of a list, which used to be the only place you could use headings on Android.

This worked for the most part, but could cause problems in specific circumstances, such as if that element actually *was* part of a list. Since we were overriding its CollectionItemInfo, and presenting it as the first item in a single column list, the parent list could have confusing announcements such as announcing this item as "Item 1" even if it was not the first item in the actual list.

Since API 28, there has been an API to set any view as a heading (https://developer.android.com/reference/android/view/View#setAccessibilityHeading(boolean)).

This switches our implementation to use this new API via the AccessibilityNodeInfoCompat class for backwards compatibility to older API versions.

Changelog:
[Android][Changed] - Simplify Accessibility Heading role implementation.

Differential Revision: D39076827

fbshipit-source-id: 583dc1e9d2779a4efa5f98cabef506df2770d892
2022-09-19 20:30:22 -07:00
Nick Gerleman 010da67bef Remove dependence on VirtualizedList `listKey` prop
Summary:
Following up on the previous diff to remove the only usage of `listKey` for persistent association, we can remove the need for a manual `listKey`, and instead rely on per-instance association via refs.

A followup change will remove the existing usages.

Changelog:
[General][Removed] - Remove VirtualizedList `listKey` prop

Reviewed By: p-sun

Differential Revision: D39466677

fbshipit-source-id: 6b49f45c987fff9836918ba833fbb16f24414ff8
2022-09-19 19:25:09 -07:00
Luna Wei c5217f199d Update Keyboard, Alert TS Types
Summary: Changelog: [Internal] - Update changes to Keyboard, Alert from differences in those files from https://github.com/facebook/react-native/compare/0.70-stable...main

Reviewed By: NickGerleman

Differential Revision: D39629997

fbshipit-source-id: 85bb91d00a165e708dbf4e32d7f37ce8a6c02a72
2022-09-19 14:56:36 -07:00
Steven Kuo e2a446694f Sync Themes, keep lowercase font weights
Summary:
Keeping the lowercase values but keeping the conversion values the same.

D39478951 (ea1ec29ba6) reverted some changes that moved it back to uppercase but needed to add new values to `____FontWeight_Internal`. This diff removes the need for the uppercase values

Changelog: [Internal]

Differential Revision: D39506944

fbshipit-source-id: 079f73c1adcf2db28b961523b05562e21fcf3630
2022-09-19 12:59:35 -07:00
Luna Wei 6b2a511cbb Move TypeScript declarations into react-native (#34614)
Summary:
## Changelog
[General] [Added] - Add `types` folder to house TypeScript types.

Release TypesScript types with react-native and eventually deprecate [types/react-native](https://www.npmjs.com/package/types/react-native).

The current plan is to release types/react-native for 0.70 and 0.71 while also maintaining types here. This will result in some double maintenance until 0.72 but will give community time to move off of types/react-native.

After this lands, there have been changes on `main` of types that we need to update. Then, when we release 0.71 from DefinitelyTyped, we can simply copy over the `types` folder from this repo.

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

Test Plan:
`yarn run test-typescript` for linting types

* Created a new project using the TS template and my local clone of `react-native` on this branch.
`npx react-native init MyTSApp --version <path-to-my-local-rn-repo> --template react-native-template-typescript`
* Updated the `package.json` to remove `types/react-native`
* Deleted my node_modules and re-ran yarn
* Opened MyTSApp in VSCode and verified the type suggestions appeared and cmd+click to defnitions took me to the node_module dependency `react-native/types`

## Danger is failing on this PR and it's expected
 as it runs off the changes on `main`.  [This is expected](https://docs.github.com/en/github-ae@latest/actions/using-workflows/events-that-trigger-workflows?fbclid=IwAR2_AE0Jwndt8Gu-iTQnxGxLJq7nakbi7sz8jwZ6U62JWLSdcZuvjcQ6WvE#pull_request_target). However testing it locally passes. Once merged, and these changes are on `main`, danger will pass again.

```
$ react-native/packages/react-native-bots
❯ yarn danger pr https://github.com/facebook/react-native/pull/34614
yarn run v1.22.19
$ ..react-native/node_modules/.bin/danger pr https://github.com/facebook/react-native/pull/34614
Starting Danger PR on facebook/react-native#34614

Danger: ✓ found only warnings, not failing the build
## Warnings
🔒 package.json - <i>Changes were made to package.json. This will require a manual import by a Facebook employee.</i>

  Done in 13.24s.
```

Reviewed By: mdvacca

Differential Revision: D39479137

Pulled By: lunaleaps

fbshipit-source-id: 1d506f812d566b783b6e79104cd6339b077a42a7
2022-09-19 12:26:00 -07:00
Luna Wei ab5f26bf02 Back out "Fix `Alert` not showing in an app using `UIScene`"
Summary:
Changelog: [Internal] - Revert https://github.com/facebook/react-native/pull/34562

re: [iOS] [Fixed] - Fix Alert not showing in an app using UIScene

Reviewed By: alsun2001

Differential Revision: D39591113

fbshipit-source-id: ba707c11b3fb97eb3a6fee32e57b92403aa8b3d8
2022-09-17 07:05:37 -07:00
David Vacca d15a82dc31 Remove test BUCK configuration for cxxcomponents
Summary:
This diff removes the 'test' BUCK configuration for cxxcomponents, the goal of the diff is to fix a sandcastle issue:
https://www.internalfb.com/intern/sandcastle/log/?instance_id=36028797791859555&step_id=36028805144809956&step_index=6&name=Run%20arc%20focus-android

build-break
overriding_review_checks_triggers_an_audit_and_retroactive_review
Oncall Short Name: react_native

changelog: [internal] internal

Differential Revision: D39589523

fbshipit-source-id: 9cb6ab1e8a5929e7d288771f2f980db00a5a4adb
2022-09-16 16:56:54 -07:00
Luna Wei dc56eb99f1 Fix missing renames from bots to react-native-bots (#34713)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34713

Changelog: [Internal] - Fix up missing bots usage after we moved everything to packages/react-native-bots in 767f8e0249

Reviewed By: NickGerleman

Differential Revision: D39583230

fbshipit-source-id: 6cc6b7923e67139dc3c81dfe0c39005dde905248
2022-09-16 12:41:06 -07:00
David Vacca 7003fcd6eb Delete react/fabric/components folder
Summary:
Delete react/fabric/components folder as this is not needed anymore

changelog: [internal] internal

Reviewed By: cortinico, makovkastar

Differential Revision: D39560229

fbshipit-source-id: b27ba1acd3bf46472bd022e78e171d7d22d7979d
2022-09-16 12:33:15 -07:00
David Vacca 93c6d2a8e5 update documentation for enableCppRenderSystem feature flag
Summary:
This diff updates the documentation for enableCppRenderSystem feature flag

This is a follow up of D38725771 (399907fe4a)

changelog: [internal] internal

Reviewed By: cortinico, makovkastar

Differential Revision: D39558834

fbshipit-source-id: e079ee688a912dfa2670c66e5adf347a902a45e1
2022-09-16 12:33:15 -07:00
David Vacca 85e9b073cb Move react/fabric/components -> react/cxxcomponents
Summary:
This diff moves Component and ComponentManager classes -> react/cxxcomponents. The purpose is to be able to use these classes from any platform, not only Android

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D39531533

fbshipit-source-id: 4732aa7bf59d82dae11441212975f0e225c6d458
2022-09-16 12:33:15 -07:00
Luna Wei c9966e417d Alert
Summary: Changelog: [Internal] Add flow declaration for Alert. Couldn't figure out how to do type statics on interfaces in Flow.

Reviewed By: yungsters

Differential Revision: D39186533

fbshipit-source-id: 928ee76080490a133c9773d2330473a688e0612d
2022-09-16 11:46:00 -07:00
Adrian Hartanto 2aba3522ab fix: adjust clipboard mock (#34672)
Summary:
Currently, Clipboard's methods (setString, getString) can't be asserted when writing tests as the mock targeted `Libraries/BatchedBridge/NativeModules` instead of `Libraries/Components/Clipboard/Clipboard` that's used on react-native [entry point](https://github.com/facebook/react-native/blob/main/index.js#L270) so it won't be considered as `mock 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
-->

[General] [Changed] - Update `Clipboard` mock path

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

Test Plan:
```js
// App-test.js

import { Clipboard } from 'react-native';
import React from 'react';

it('renders correctly', () => {
  Clipboard.setString('string');
  expect(Clipboard.setString).toBeCalled();
});
```

### before

<img width="473" alt="Screen Shot 2022-09-13 at 16 24 30" src="https://user-images.githubusercontent.com/5382429/189864957-6b926478-6781-4291-a1eb-4493779de1a2.png" />

### after

<img width="598" alt="Screen Shot 2022-09-13 at 16 26 34" src="https://user-images.githubusercontent.com/5382429/189865131-e7c39f97-1cc1-4eb9-b4c0-d9ddf7a05c9c.png" />

Reviewed By: yungsters

Differential Revision: D39575916

Pulled By: cortinico

fbshipit-source-id: 34a3f93986a18d349ac033bb13a10ed77689935c
2022-09-16 08:54:05 -07:00
Tim Yung 527ac2f2c5 JS: Upgrade to `yargs@^17.5.1`
Summary:
Upgrades all of our JavaScript tooling to use `yargs@^17.5.1`.

Of all [release notes](https://github.com/yargs/yargs/releases), these are the major version notes:

- [v17.0.0](https://github.com/yargs/yargs/releases/tag/v17.0.0)
- [v16.0.0](https://github.com/yargs/yargs/releases/tag/v16.0.0)

A cursory inspection suggests that these breaking changes are unlikely to seriously impact our use cases (or can be fixed forward).

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D39550338

fbshipit-source-id: 5b2c5265f8c7a95ab0cc9bab62873f9e4355f32f
2022-09-16 08:25:34 -07:00
Tommy Nguyen 49c90f7a7e `@react-native/tester` should be private (#34570)
Summary:
Made `react-native/tester` private.

## Changelog

[Internal] [Fixed] - Made `react-native/tester` private

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

Test Plan: n/a

Reviewed By: lunaleaps

Differential Revision: D39235797

Pulled By: cortinico

fbshipit-source-id: d5dee20f1ddfc198b3a776464a91de470ce824f6
2022-09-16 03:46:03 -07:00