Commit Graph

7163 Commits

Author SHA1 Message Date
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
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
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 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
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
Lorenzo Sciandra 232e4474e6 chore: re-align version to be 1000.0.0 on main everywhere (#34817)
Summary:
While working on https://github.com/facebook/react-native/pull/34513 I noticed that on main branch the versioning is not really consistent everywhere. So this PR is an attempt at realigning so that on the main branch, RN is 1000.0.0 everywhere - in a way, it's cleaning up the room for the monorepo work to go flawlessly).

It's just a pass of `node scripts/set-rn-version.js --to-version 1000.0.0`.

There's the small chance that some versions where kept to 0.0.0 on purpose (build tools are weird), so we might just have to close this off. No big deal :)

## 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] -  re-align version to be 1000.0.0 on main everywhere

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

Test Plan: CI is green and when imported, nothing breaks.

Reviewed By: cortinico

Differential Revision: D39926953

Pulled By: cortinico

fbshipit-source-id: ff66530382f891e17c00b35edf97c03591b6a9a8
2022-10-04 08:36:21 -07:00
andrejborstnik 43cf78d99e chore: add headers.Content-type to openFileInEditor call (#33517)
Summary:
Currently the `Content-type` is not defined and defaults to `text/plain`. This makes it more accurate.

## 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] [Changed] - add `headers.Content-type` to `openFileInEditor` call

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

Test Plan: - [x] in development trigger `openFileInEditor`, e.g. by pressing on a line in a stack trace -> code editor opens

Reviewed By: cipolleschi

Differential Revision: D40022413

Pulled By: cortinico

fbshipit-source-id: 00ad3cdcdd1f82436c04aed3643c9f0b55778592
2022-10-03 10:32:29 -07:00
Aelita e0a495899d Sync new changes in @types/react-native (TextProps, TouchableWithoutFeedbackProps) (#34794)
Summary:
Sync the changes in `types/react-native` https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62394 to here as required by lunaleaps

## Changelog
[Internal] [Added] - Sync new changes in `types/react-native`

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

Test Plan: Tested in `types/__typetests__/index.tsx`

Reviewed By: cortinico

Differential Revision: D39846101

Pulled By: cortinico

fbshipit-source-id: cebe62aa97f764d9a10c8371936870c515fb9be3
2022-10-03 08:01:20 -07:00
Gabriel Donadel Dall'Agnol 32b6f319ba feat: Add support for verticalAlign style (#34567)
Summary:
This adds support for the `verticalAlign` style attribute, mapping the already existing `textAlignVertical` attribute as requested on https://github.com/facebook/react-native/issues/34425. This PR also updates the TextExample.android on the RNTester in order to facilitate the manual QA of this.

## Changelog

[Android] [Added] - Add support for verticalAlign style

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

Test Plan:
1. On Android open the RNTester app and navigate to the Text page
2. Check the text alignment through the `Text alignment` section

https://user-images.githubusercontent.com/11707729/188051914-bf15f7eb-e53f-4de5-8033-d1b572352935.mov

Reviewed By: jacdebug

Differential Revision: D39771237

Pulled By: cipolleschi

fbshipit-source-id: d2a81bec1edd8d49a0fcd36a42fea53734909739
2022-10-03 05:57:30 -07:00
Tim Yung 494c47360f RN: Sort Imports via ESLint
Summary:
Applies the autofix from the newly introduced `lint/sort-imports` ESLint rule.

Changelog:
[Internal]

Reviewed By: cortinico, skinsshark

Differential Revision: D39907798

fbshipit-source-id: 17f5f11b08a5b4bb66286816b78eb26e07e829b8
2022-09-30 14:28:48 -07:00
Tim Yung cf98495f7b RN: Fix Copyright on EventEmitter-test.js
Summary:
Fixing the copyright header on `EventEmitter-test.js`.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D39961297

fbshipit-source-id: 37867c785e52455f72b489e62892a1ac676339a2
2022-09-30 01:15:29 -07:00
Evan Yeung 8a7f7af753 Deploy 0.188.0 to xplat
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D39919034

fbshipit-source-id: a8329aab9bf8f8da93a1c8d414518705048f0d8f
2022-09-29 14:31:12 -07:00
Rujin Cao bc1bc36a0c @emails -> @oncall (misc)
Differential Revision: D39905970

fbshipit-source-id: 020901c455628bfbb7163adf0a7b7672fc39123a
2022-09-28 17:04:06 -07:00
Luna Wei 4cdacb1bab Image Background
Summary: Changelog: [Internal] Flow ImageBackground

Reviewed By: christophpurrer

Differential Revision: D39754591

fbshipit-source-id: dfd1386e32186a3f903f7c01f77698a54c58939d
2022-09-28 15:48:40 -07:00
Luna Wei 167965aedd Image
Summary: Changelog: [Internal] Flow Image

Reviewed By: christophpurrer

Differential Revision: D39754592

fbshipit-source-id: 2866bbdbdf7b743a55c58079981765d57bce914a
2022-09-28 14:06:42 -07:00
Luna Wei 5014a39286 FlatList
Summary: Changelog: [Internal] Flow declaration for FlatList

Reviewed By: yungsters

Differential Revision: D39831687

fbshipit-source-id: 35d962b7dfe4b10fc5640320a2d5037a7057a49d
2022-09-28 13:41:29 -07:00
Luna Wei 628db1fcd3 PixelRatio
Summary: Changelog: [Internal] Flow typing PixelRatio

Reviewed By: yungsters

Differential Revision: D39588444

fbshipit-source-id: c1c358799e8012398b0b66f46bb58964a5d6c77f
2022-09-28 11:47:44 -07:00
Vic 7f061f8651 Refactor: removed duplicated words in comments (#34807)
Summary:
Found and removed duplicates of the word "the" in comments.

## Changelog

[Internal] [Removed] – Removed duplicates of the word "the" in comments.

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

Test Plan: Not applicable.

Reviewed By: yungsters, cipolleschi

Differential Revision: D39880587

fbshipit-source-id: b7277aa70604902929903c31ab69d4c532f2667a
2022-09-28 09:08:27 -07:00
Tim Yung 7c08d07115 RN: Change Internal Imports to Relative Paths
Summary:
Fixes all internal import statements directly referencing the `react-native` package to instead use relative paths.

Changelog:
[Internal]

Reviewed By: christophpurrer

Differential Revision: D39831223

fbshipit-source-id: 510123e5fc8f6845f96d1b55c67e0e59cb401beb
2022-09-27 09:22:58 -07:00
Tim Yung 908571de2f RN: Fix Existing Lint Warnings
Summary:
Fixes all existing lint warnings in React Native.

Changelog:
[Internal]

Reviewed By: christophpurrer

Differential Revision: D39831224

fbshipit-source-id: 6ad3fc3fc7dbb9c24cdb4ff4a99639bad27c1901
2022-09-27 09:22:58 -07:00
Nick Gerleman b788b6e1c9 Fix analyze_code CircleCI Job (#34801)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34801

D39796598 (https://github.com/facebook/react-native/commit/8cdc9e7f04e2dd3026d15dcd5765952bfb2c5c08) broke this CircleCI job, causing failures for `dtslint` and `prettier`. This fixes both issues, by upating formatting, and removing types from `legacy-properties.d.ts` that we no longer export.

These were not flagged by sandcastle. It looks like this is because:
1. We run eslint, but not dtslint internally
2. Arcanist will ignore anything under a "vendor" directory, while we do not exlude anything from the prettier check in OSS.

I also updated the eslint config to lint any TypeScript that appears outside the types directory, since typings are now spread out.

Changelog:
[Internal][Fixed] - Fix `analyze_code` CircleCI Job

Reviewed By: cipolleschi

Differential Revision: D39848604

fbshipit-source-id: 844dfe26e4b618059542b29df163402079c39322
2022-09-27 07:11:10 -07:00
Gabriel Donadel Dall'Agnol 14c91cdf59 feat: Add string support for aspectRatio (#34629)
Summary:
This updates `aspectRatio` to support string values and ratio formats, i.e., `'16 / 9'`, thus aligning it with the [CSS Box Sizing Module Level 4](https://drafts.csswg.org/css-sizing-4/#aspect-ratio) specification as requested on https://github.com/facebook/react-native/issues/34425. This also adds unit tests to the `processAspectRatio` function ensuring the style processing works as expected.

## Changelog

[General] [Added] - Add string support for aspectRatio

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

Test Plan:
This can be tested either through `processAspectRatio-tests` or by using the following code:

```js
 <View
   style={{
     backgroundColor: '#527FE4',
     aspectRatio: '16 / 9',
  }} />
```

https://user-images.githubusercontent.com/11707729/189029904-da1dc0a6-85de-46aa-8ec2-3567802c8719.mov

Reviewed By: jacdebug

Differential Revision: D39423304

Pulled By: cipolleschi

fbshipit-source-id: d323de93d6524e411e7ab9943335a8ca323b6e61
2022-09-27 04:05:52 -07:00
Gabriel Donadel Dall'Agnol 71fda5e0c2 feat: Add alt prop to Image component (#34550)
Summary:
This adds the `alt` prop to the `Image` component as requested on https://github.com/facebook/react-native/issues/34424. Using this new `alt` prop enables the `accessibility` prop and passes down the alt text to `accessibilityLabel`. This PR also updates RNTester ImageExample in order to facilitate the manual QA.

#### Open questions
 - ~~On web `alt` text is displayed on the page if the image can't be loaded for some reason, should we implement this same behavior if the `Image` component fails to load `source`?~~ Not for now

## Changelog

[General] [Added] - Add alt prop to Image component

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

Test Plan:
1. Open the RNTester app and navigate to the Image page
2. Test the `alt` prop through the `Accessibility Label via alt prop` section, this can be tested either by enabling Voice Over if you're using a real device or through the Accessibility Inspector if you're using a simulator

https://user-images.githubusercontent.com/11707729/187790249-0d851363-c30e-41b6-8c24-73e72467f4ba.mov

Reviewed By: lunaleaps

Differential Revision: D39618453

Pulled By: cipolleschi

fbshipit-source-id: 0e26b2574514e76ce7e98ddb578f587a9cc30ee9
2022-09-27 04:05:15 -07:00
Pavol Fulop f85e2ecc40 Include existing height when calculating new one for KeyboardAvoidingView (#34749)
Summary:
Currently, height is sometimes the only valid option for pushing `TextInput` up in the layout on Android. The problem is when switching keyboards. For instance, switching from ABC to emojis. This will trigger keyboard show events and recalculate the height for the `KeyboardAvoidingView`. Since the keyboard is still showing, the view has the height that was previously calculated and thus `frame` represents that. This means the `frame.height` has adjustments for the keyboard calculated in it, but it is used the same way as if the keyboard was not showing. This results in wrong calculation and the input showing at the incorrect place in the layout (mostly hidden under the keyboard)

This fix simply uses the previous calculation to offset `frame.height`, resulting in the correct height and smooth switching between keyboards. It's also scoped only to height mode since that's where the problem shows.

_Note: I mention android here, but it fixes it for both platforms. It's just that iOS usually works best with different behaviour so it's rarely used there._

## Changelog

[General] [Added] - Include `this.state.bottom` when calculating new keyboard height to fix android keyboard switching

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

Test Plan:
With simple code:

```jsx
import { StatusBar } from "expo-status-bar";
import React from "react";
import {
  KeyboardAvoidingView,
  StyleSheet,
  Text,
  TextInput,
  View,
} from "react-native";

export default function App() {
  return (
    <KeyboardAvoidingView style={styles.container} behavior="height">
      <Text>Open up App.js to start working on your app!</Text>
      <StatusBar style="auto" />
      <TextInput style={{ backgroundColor: "red", width: "100%" }} />
    </KeyboardAvoidingView>
  );
}

const styles = StyleSheet.create({
  container: {
    padding: 32,
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "space-between",
  },
});
```

Notice the consistency of the TextInput after the changes, while before it would just move around more you switch the keyboards.

|  Before  | After  |
|---|---|
| ![2022-09-21 13-59-09 2022-09-21 14_01_44](https://user-images.githubusercontent.com/3984319/191499509-b41280a0-2969-4fe6-8796-c5695b999f27.gif)  | ![2022-09-21 14-03-33 2022-09-21 14_04_30](https://user-images.githubusercontent.com/3984319/191499628-a5832b88-e511-448d-8081-ac48d3a3690a.gif)  |

Reviewed By: cipolleschi

Differential Revision: D39718812

Pulled By: NickGerleman

fbshipit-source-id: 2550182e846f3f8e719d727fa8e6d87165faebf6
2022-09-26 15:10:27 -07:00
Nick Gerleman 8cdc9e7f04 Place TypeScript Declarations Alongside Source Files
Summary:
React Native's TS definitions are currently mostly stored in one monolithic file. This change splits the definitions up to correspond to the source files they came from, and are placed next to the source files. I think this should help inform, and make it easy to update the TS declarations when touching the Flow file.

I noticed as part of the change that the typings have not yet removed many APIs that were removed from RN. This is bad, since it means using the removed/non-functional API doesn't cause typechecker errors. Locating typings next to source should prevent that from being able to happen.

The organization here means individual TS declarations can declare what will be in the RN entrypoint, which is a little confusing. Seems like a good potential next refactor, beyond the literal translation I did.

Changelog:
[General][Changed] - Place TS Declarations Alongside Source Files

Reviewed By: lunaleaps, rshest

Differential Revision: D39796598

fbshipit-source-id: b36366466fd1976bdd2d4c8f7a4104a33c457a07
2022-09-26 12:09:45 -07:00
Sharon Zheng 77e79d6308 Animated.ScrollView with RefreshControl applying Animated transform twice
Summary:
There was a bug on Android when an Animated.ScrollView had a RefreshControl while an Animated style was applied, ie `transform`:
```
<Animated.ScrollView
  refreshControl={<RefreshControl />}
  style={{
    transform: [{
      translateY: new Animated.Value(200, {useNativeDriver: true})
    }]
  }}
/>
```

The transform value was being incorrectly applied twice. Since the styles were applied once on RefreshControl and once on NativeScrollView, the transform style is effectively applied twice:

**1. ScrollView.js**
- RefreshControl gets the transform through Fabric commit
- [The RefreshControl gets wrapped around ScrollView](https://fburl.com/code/k60krxbj) while on iOS there is no change in the parent/child relationship. [Outer/inner styles are split and applied to RefreshControl/ScrollView](https://fburl.com/code/b2to75er), and transform styles are applied on the parent (RefreshControl)

**2. createAnimatedComponent.js**
- NativeScrollView gets the transform through Animated
- [ScrollView forwards its ref to NativeScrollView](https://fburl.com/code/w1whtl5f), which means AnimatedComponent is setting the transform styles on NativeScrollView and not RefreshControl as ScrollView.js did

This diff fixes this bug by using the `useAnimatedProps` hook which makes both RefreshControl and ScrollView components into animated components. Otherwise, the components don't know what to do with Animated values.
 ---
Changelog:
[Internal][Fixed] - Animated transform style properties were being applied twice when used on an Animated.ScrollView with RefreshControl on Android

Reviewed By: javache

Differential Revision: D38815633

fbshipit-source-id: 2b76639d2237176b6aae4fb1e22cf1a1ec70a69a
2022-09-26 11:28:56 -07:00
Tim Yung 8edf4e9e3a Pressability: Eliminate Unit Test Timing Flakiness
Summary:
Currently, it is possible in one of the "minimum press duration" unit tests for certain instructions to take longer than expected, skewing the return value of `Date.now()` by at least 10ms.

This changes the unit test to mock `Date.now()` more accurately so that the test is no longer flakey.

Changelog: [Internal]

Reviewed By: jacdebug

Differential Revision: D39804152

fbshipit-source-id: ab62fd1921bd015d969da9595bd3267c38c6e59c
2022-09-26 08:49:51 -07:00
Pieter Vanderwerff ff14ff3d92 Add explicit React useState annotations in xplat/js
Reviewed By: SamChou19815

Differential Revision: D39756144

fbshipit-source-id: d34c86b62e82e771723714fb7896058b7f27670f
2022-09-23 15:18:54 -07:00
Chenglin Liu 065db683a2 add link group label to fbios deps
Summary:
Currently, fbios link groups depend on supermodules to generate. To continue supporting
link groups while allowing us to migrate off supermodules, we'll add a `fbios_link_group` label on all fbios targets to persist the current hierarchical information.

Reviewed By: jkeljo

Differential Revision: D39543862

fbshipit-source-id: 2abe5b3ee883e77336076d88436a1c84139b5a97
2022-09-22 22:52:22 -07:00
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
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
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 (https://github.com/facebook/react-native/commit/544d9fb10b5a73bd499feb18dab1a7dc11738748).  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
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 (https://github.com/facebook/react-native/commit/a0d1585cdb5ae86e5d4e5bc51fdfa9ae7e049b4b). 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
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
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.

https://github.com/facebook/react-native/blob/a70354df12ef71aec08583cca4f1fed5fb77d874/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
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
Steven Kuo e2a446694f Sync Themes, keep lowercase font weights
Summary:
Keeping the lowercase values but keeping the conversion values the same.

D39478951 (https://github.com/facebook/react-native/commit/ea1ec29ba67c837c82c74357e313bd4505b81eb8) 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
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 (https://github.com/facebook/react-native/commit/399907fe4ad843ac6aa0aa2f553ba3aee3c83006)

changelog: [internal] internal

Reviewed By: cortinico, makovkastar

Differential Revision: D39558834

fbshipit-source-id: e079ee688a912dfa2670c66e5adf347a902a45e1
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
Luna Wei 1cdeb20d54 TextInput
Summary: Changelog: [Internal] Add a flow type for TextInput

Reviewed By: yungsters

Differential Revision: D38883693

fbshipit-source-id: 798c1cfac55479420e683bd79d685a46c866c5d1
2022-09-15 17:06:17 -07:00
Rujin Cao b2ac528156 @emails -> @oncall (remaining ones)
Differential Revision: D39536169

fbshipit-source-id: 6c8d6787328eefecd23f3498b14a6d9ff750a670
2022-09-15 15:54:10 -07:00
Marshall Roch a8ece43a50 upgrade to flow 0.187.0
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D39542847

fbshipit-source-id: 2eeb8740dd0a142b7e411fbee4765a8f38685c76
2022-09-15 12:24:13 -07:00
David Vacca 399907fe4a Create Feature Flag to Enable/Disable C++ Render System in JS
Summary:
This diff creates a new Feature Flag to Enable/Disable C++ Render System in JS

Changelog: [Internal] Internal

Reviewed By: sammy-SC

Differential Revision: D38725771

fbshipit-source-id: 3a238781bec427274dbd8f7c045d360135d1803e
2022-09-15 09:48:25 -07:00