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

25659 Коммитов

Автор SHA1 Сообщение Дата
Matt Blagden 4a0aa8f7c7 Simplify runtime type in Inspector Connection
Summary:
A previous change made the RuntimeAdapter contain a HermesRuntime (as opposed to an arbitrary JSI Runtime).

Now that it's known to be a HermesRuntime, expose that type information to the Inspector, so a runtime type check can be skipped (which is failing in some builds, despite the concrete type being what's expected).

Changelog: [internal]

Reviewed By: neildhar

Differential Revision: D39429109

fbshipit-source-id: ad5ae0604ac208da2002fd37e38d24319b45aebd
2022-09-13 08:43:43 -07:00
Alex Smeshkov 71c0d2e369 Add `accessibilityContext` to CKOverlayLayoutComponent
Summary: Changelog: [Internal]

Reviewed By: Andrey-Mishanin

Differential Revision: D38906662

fbshipit-source-id: f0501f48df6a9debebd9211d388c6c89d29d149d
2022-09-13 07:08:01 -07:00
Nicola Corti 59ae0487ce Further simplify the New App Template by don't requiring the dynamic library name (#34671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34671

I'm simplifying the template further by:
- Do not expose a configurable dynamic library name. Let's use `appmodules`
and still allow the users to configure it, if needed.
- Move all the initialization logic inside the `JNI_OnLoad` method
- Cleanup the `DefaultReactNativeHost` to don't require a dynamic library
name but just a boolean.

Changelog:
[Android] [Changed] - Further simplify the New App Template by don't requiring the dynamic library name

Reviewed By: cipolleschi

Differential Revision: D39462948

fbshipit-source-id: 737733fc263162a0baf3b7a451e48b8616679d3b
2022-09-13 06:42:37 -07:00
Danilo Bürger 6bdcb49966 Align android image style / source logic with ios (#34655)
Summary:
This aligns the logic of setting style (width / height) and source of Android with iOS.
iOS handles nullish uris with set width and heigth by passing them through. Android did not.

## Changelog

[Android] [Fixed] - Align android image style / source logic with ios

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

Test Plan:
```
<Image source={{width: 100, height: 100}} />
```

Before this Patch:
* iOS: Renders a blank image with 100x100
* Android: Renders a blank image with 0x0

After this Patch:
* iOS: Renders a blank image with 100x100
* Android: Renders a blank image with 100x100

Reviewed By: sammy-SC

Differential Revision: D39423391

Pulled By: cipolleschi

fbshipit-source-id: 997c06dea42e9b69fda12b678a1b82ad8319537f
2022-09-13 05:18:45 -07:00
Roman Melnyk 0cae4959b7 #34610 Fix invalid range "t-5" in string transliteration [iOS] (#34636)
Summary:
Fix invalid range "t-5" in string transliteration [iOS] for M1 pod install issue.

This should fix pod install error for M1 machines.

## Changelog
[iOS] [Fixed] - Fix ios pod install error

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

Test Plan: Run pod install on M1 machine.

Reviewed By: sammy-SC

Differential Revision: D39423276

Pulled By: cipolleschi

fbshipit-source-id: 4ec95af7103395792facba0f93fd8de05a3fe78d
2022-09-13 04:14:04 -07:00
Nicola Corti 406c9d097a Remove :packages:react-native-codegen:android from top level settings (#34579)
Summary:
The folder `/packages/react-native-codegen/android` is not existing anymore, I'm removing it.

## Changelog

[Internal] - Remove :packages:react-native-codegen:android from top level settings

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

Test Plan: Will rely on a green CI

Reviewed By: cipolleschi

Differential Revision: D39440292

Pulled By: cortinico

fbshipit-source-id: 492722b1b697e0bf03cf2803b25fb9604cf0778a
2022-09-13 04:07:44 -07:00
Luna Wei 767f8e0249 Add bots as a yarn workspace and update danger action (#34652)
Summary:
allow-large-files

When working on https://github.com/facebook/react-native/pull/34614, danger is failing because it doesn't share `node_modules` with the root directory where `typescript` is installed as we added it as a parser in our eslint config.

By setting `bots` as a yarn workspace, dependencies are all installed under the root `node_modules` folder and in local testing (detailed in test section) we no longer have the `typescript module not found` error. However, danger will continue to fail on https://github.com/facebook/react-native/pull/34614 as the `danger_pr` Github action runs from what's defined on `main`.

Once these changes land, I can rebase https://github.com/facebook/react-native/pull/34614 on it and danger's eslint should pass.

## 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][Fixed] - Add `bots` directory as a yarn workspace and update `danger_pr` Github action

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

Test Plan:
To verify this fix I had to run:
```
react-native $ yarn && cd bots
react-native/bots$ yarn run danger pr https://github.com/facebook/react-native/pull/34614
```

which resulted in
```
❯ yarn run danger pr https://github.com/facebook/react-native/pull/34614
yarn run v1.22.19
$ lunaleaps/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 12.78s.
```
Verified this also on another PR:
```
yarn run danger pr https://github.com/facebook/react-native/pull/34650
```

Reviewed By: NickGerleman

Differential Revision: D39435286

Pulled By: lunaleaps

fbshipit-source-id: 8c82f49facf162f4fc0918e3abd95eb7e4ad1e37
2022-09-12 22:03:34 -07:00
Tianyu Yao bfb36c2163 Stop inspecting when an element is selected
Summary:
Changelog:
[General][Fixed] In RN devtools, call that method, and then set component state to not inspecting.

Reviewed By: lunaruan

Differential Revision: D38852009

fbshipit-source-id: d14bd4cc4461f0f7ec4ae9cd6098a58eef3e6ab9
2022-09-12 16:56:19 -07:00
Tianyu Yao 6163029d4a Fix selectNode in fabric
Summary:
Changelog:
[General][Fixed] - Currently selectNode doesn't work for Fabric. Passing the instance instead of a tag to `selectNode` works.

Reviewed By: lunaruan

Differential Revision: D38851141

fbshipit-source-id: 7640d0f31fb099346a4d8205981e262da6be4990
2022-09-12 16:56:19 -07:00
Danilo Bürger 2d5db284b0 Support PlatformColor in borderColor on Android (#33544)
Summary:
PlatformColor should work on all *color style attributes on all platform.

Partially fixes https://github.com/facebook/react-native/issues/32942

## Changelog

[Android] [Fixed] - Support PlatformColor in borderColor

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

Test Plan: Open rn tester (USE_FABRIC=false) platform color api examples. Without the changes to ViewProps.java, it will error out.

Reviewed By: lunaleaps

Differential Revision: D39413519

Pulled By: NickGerleman

fbshipit-source-id: 58962ba2956aa3df45144108eec194aedf23886b
2022-09-12 15:07:19 -07:00
Vincent Riemer 93b51b5f86 Add MoveAcross test for pointer events
Summary:
Changelog: [RNTester][Internal] - Add "move across" test for pointer events

This diff adds a new platform test ported from the wpt's [mousemove-across test](https://github.com/web-platform-tests/wpt/blob/master/uievents/order-of-events/mouse-events/mousemove-across.html) along with a rough port of the wpt's event recorder class which is made to work in a react component environment.

Reviewed By: lunaleaps

Differential Revision: D39221252

fbshipit-source-id: 16b2e03dbc71a2e83cc43af1e950803feaf6657b
2022-09-12 14:48:39 -07:00
Elliott Kember 7be829f2c9 Fix ImageLoader.getSize jest mock (#34653)
Summary:
`getSize` should resolve with an array of `[width, height]` but this mock resolves with `{ width, height }`.

It should be `ReadOnlyArray<number>` instead of `{width: number, height: number}`

The native image loader call is [here](https://github.com/facebook/react-native/blob/main/Libraries/Image/NativeImageLoaderIOS.js#L18):
```js
  +getSize: (uri: string) => Promise<$ReadOnlyArray<number>>;
```

but in the [jest setup file](https://github.com/facebook/react-native/blob/main/jest/setup.js):
```js
  getSize: jest.fn(url => Promise.resolve({width: 320, height: 240})),
```

My tests were failing on `Image.getSize()` - `TypeError: Invalid attempt to destructure non-iterable instance.`

I managed to trace this down to this object being returned by the Jest mock - looks like it's returning a size object instead of a dimensions array.

## Workaround

If you are hitting this issue, you can work around this mock by using:

```js
ReactNative.NativeModules.ImageLoader.getSize = jest.fn((_) => Promise.resolve([320, 240]));
```

## Changelog

[JavaScript] [Changed]: Changed the mocked return value of `ImageLoader.getSize` to be `[320, 240]` instead of `{ width: 320, height: 240 }`

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

Test Plan: TBD? I think a test with `Image.getSize(path)` will cover it. That's where I hit the error with the ios-specific imageLoader's getSize method.

Reviewed By: robhogan

Differential Revision: D39413522

Pulled By: NickGerleman

fbshipit-source-id: 7f18d7acde0cf94da0b4aec8fe2d0cad3fb0cc55
2022-09-12 14:11:28 -07:00
Nicola Corti b0aba1b6fa Update the New App template to reduce the amount of C++ code in user space (#34666)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34666

This diff updates the new app template and reduces the amount of C++ code in user space.
From now on users will have to only:
1. Create a CMakeLists.txt file
2. Create an OnLoad.cpp file with the Modules/Components they want to provide.

Changelog:
[Android] [Changed] - Update the template to Reduce the amount of C++ code in user space for New Architecture

Reviewed By: cipolleschi

Differential Revision: D39381762

fbshipit-source-id: 7309b6c61ba9ddd8856cb4aaa6d923ddd816741c
2022-09-12 12:48:43 -07:00
Nicola Corti e89bd4a375 Reduce the amount of C++ code in user space for RN-Tester
Summary:
This diff reduces the amount of C++ code in user space by:
- Moving all the C++ implementation of the .defaults package inside a `react_newarchdefaults` shared library
- Exposing only the entrypoint logic inside the RN-Tester's `OnLoad.cpp` file.

Changelog:
[Android] [Changed] - Reduce the amount of C++ code in user space for New Architecture

Reviewed By: cipolleschi

Differential Revision: D39381820

fbshipit-source-id: 9c4b5596b67b5a7ee58824319c80e325348ed06c
2022-09-12 12:48:43 -07:00
Vincenzo Vitale 90e7f510dc Test the Android Template with the JSC engine (#34664)
Summary:
https://www.internalfb.com/T131530362

We are testing the New App template in CircleCI.

For Android we test the combination of Debug/Release and Old/New Architecture, and always use the Hermes engine.
We don't test the JSC engines (in iOS this is already happening).

We're not automatically testing that we can create a new project with JSC, forcing release managers to do it manually.

## Changelog

[Android] [Added] - Automatic testing of the new project template with the JSC engine.

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

Test Plan:
- Open the circle-ci dashboard
- Verify there are now 8 jobs adeed to the pipeline:
```
test_android_template-Debug-Hermes-false
test_android_template-Debug-Hermes-true
test_android_template-Debug-JSC-false
test_android_template-Debug-JSC-true
test_android_template-Release-Hermes-false
test_android_template-Release-Hermes-true
test_android_template-Release-JSC-false
test_android_template-Release-JSC-true
```
- Verify they are all passing.

Reviewed By: cortinico

Differential Revision: D39426388

Pulled By: vincenzovitale

fbshipit-source-id: e5d606b1cc3ace53f8dab0f7d6d7d06ab11a2b46
2022-09-12 12:33:07 -07:00
Luna Wei 5198d56f28 Stop sending PointerEvents when view is native gesture handling
Summary:
Changelog: [Internal] - Stop dispatching pointer events when a child view has indicated it wants to handle a native gesture.

In discussion and alignment with web standards, we've decided to not dispatch any pointer events during a native gesture.

Currently, on ACTION_HOVER_MOVE, we remove child views of the native gesture handling view and continue dispatching onPointerMove for ancestor views. This change removes this logic and won't dispatch a onPointerMove event at all.

For all other MotionEvent actions, this is already the case.

Also adding an example in RNTester that involves a scrollView (which handles gestures during scrolling)

Reviewed By: javache

Differential Revision: D39377157

fbshipit-source-id: cb0a719f67136e31b68d6f6e794fee10b256bf21
2022-09-12 12:17:21 -07:00
Samuel Susla 9929eadcb4 Remove MC for runtime scheduler
Summary:
Remove redundant feature flag.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D39382607

fbshipit-source-id: fb0292258e6722160a6a1104aa1c8e35a4281a15
2022-09-12 07:57:51 -07:00
Samuel Susla 56c28f3740 React Native sync for revisions 4ea064e...c28f313
Summary:
This sync includes the following changes:
- **[c28f313e6](https://github.com/facebook/react/commit/c28f313e6 )**: experimental_use(promise) for SSR ([#25214](https://github.com/facebook/react/pull/25214)) //<Andrew Clark>//
- **[d6f9628a8](https://github.com/facebook/react/commit/d6f9628a8 )**: Remove some RSC subset entry points that were removed in the main entry point ([#25209](https://github.com/facebook/react/pull/25209)) //<Sebastian Markbåge>//
- **[a473d08fc](https://github.com/facebook/react/commit/a473d08fc )**: Update to Flow from 0.97 to 0.122 ([#25204](https://github.com/facebook/react/pull/25204)) //<Jan Kassens>//
- **[7028ce745](https://github.com/facebook/react/commit/7028ce745 )**: experimental_use(promise) for Server Components ([#25207](https://github.com/facebook/react/pull/25207)) //<Andrew Clark>//
- **[bfb65681e](https://github.com/facebook/react/commit/bfb65681e )**: experimental_use(context)([#25202](https://github.com/facebook/react/pull/25202)) //<mofeiZ>//
- **[f0efa1164](https://github.com/facebook/react/commit/f0efa1164 )**: [flow] remove custom suppress comment config ([#25170](https://github.com/facebook/react/pull/25170)) //<Jan Kassens>//
- **[2e7f422fe](https://github.com/facebook/react/commit/2e7f422fe )**: Refactor: its type is Container ([#25153](https://github.com/facebook/react/pull/25153)) //<bubucuo>//
- **[2c2d9a1df](https://github.com/facebook/react/commit/2c2d9a1df )**: [eslint-plugin-react-hooks] only allow capitalized component names ([#25162](https://github.com/facebook/react/pull/25162)) //<Jan Kassens>//
- **[36c908a6c](https://github.com/facebook/react/commit/36c908a6c )**: Don't use the Flight terminology in public error messages ([#25166](https://github.com/facebook/react/pull/25166)) //<Sebastian Markbåge>//
- **[8d1b057ec](https://github.com/facebook/react/commit/8d1b057ec )**: [Flight] Minor error handling fixes ([#25151](https://github.com/facebook/react/pull/25151)) //<Sebastian Markbåge>//
- **[9ff738f53](https://github.com/facebook/react/commit/9ff738f53 )**: [devtools][easy] Fix flow type ([#25147](https://github.com/facebook/react/pull/25147)) //<Tianyu Yao>//
- **[0de3ddf56](https://github.com/facebook/react/commit/0de3ddf56 )**: Remove Symbol Polyfill (again) ([#25144](https://github.com/facebook/react/pull/25144)) //<Ricky>//
- **[b36f72235](https://github.com/facebook/react/commit/b36f72235 )**: Remove ReactFiberFlags MountLayoutDev and MountPassiveDev ([#25091](https://github.com/facebook/react/pull/25091)) //<Samuel Susla>//
- **[b6978bc38](https://github.com/facebook/react/commit/b6978bc38 )**: experimental_use(promise) ([#25084](https://github.com/facebook/react/pull/25084)) //<Andrew Clark>//
- **[11ed7010c](https://github.com/facebook/react/commit/11ed7010c )**: [Transition Tracing] onMarkerIncomplete - Tracing Marker/Suspense Boundary Deletions ([#24885](https://github.com/facebook/react/pull/24885)) //<Luna Ruan>//
- **[b79894259](https://github.com/facebook/react/commit/b79894259 )**: [Flight] Add support for Webpack Async Modules ([#25138](https://github.com/facebook/react/pull/25138)) //<Sebastian Markbåge>//
- **[c8b778b7f](https://github.com/facebook/react/commit/c8b778b7f )**: Fix typo: supportsMicrotask -> supportsMicrotasks ([#25142](https://github.com/facebook/react/pull/25142)) //<kwzr>//
- **[d0f396651](https://github.com/facebook/react/commit/d0f396651 )**: Allow functions to be used as module references ([#25137](https://github.com/facebook/react/pull/25137)) //<Sebastian Markbåge>//
- **[38c5d8a03](https://github.com/facebook/react/commit/38c5d8a03 )**: Test the node-register hooks in unit tests ([#25132](https://github.com/facebook/react/pull/25132)) //<Sebastian Markbåge>//
- **[3f70e68ce](https://github.com/facebook/react/commit/3f70e68ce )**: Return closestInstance in `getInspectorDataForViewAtPoint` ([#25118](https://github.com/facebook/react/pull/25118)) //<Tianyu Yao>//
- **[3d443cad7](https://github.com/facebook/react/commit/3d443cad7 )**: Update fixtures/flight to webpack 5 ([#25115](https://github.com/facebook/react/pull/25115)) //<Tim Neutkens>//
- **[5d1ce6513](https://github.com/facebook/react/commit/5d1ce6513 )**: Align StrictMode behaviour with production ([#25049](https://github.com/facebook/react/pull/25049)) //<Samuel Susla>//
- **[9e67e7a31](https://github.com/facebook/react/commit/9e67e7a31 )**: Scaffolding for useMemoCache hook ([#25123](https://github.com/facebook/react/pull/25123)) //<Joseph Savona>//
- **[19e9a4c68](https://github.com/facebook/react/commit/19e9a4c68 )**: Add missing createServerContext for experimental shared subset ([#25114](https://github.com/facebook/react/pull/25114)) //<Jiachi Liu>//
- **[6ef466c68](https://github.com/facebook/react/commit/6ef466c68 )**: make preamble and postamble types explicit and fix typo ([#25102](https://github.com/facebook/react/pull/25102)) //<Josh Story>//
- **[796d31809](https://github.com/facebook/react/commit/796d31809 )**: Implement basic stylesheet Resources for react-dom ([#25060](https://github.com/facebook/react/pull/25060)) //<Josh Story>//
- **[32baab38f](https://github.com/facebook/react/commit/32baab38f )**: [Transition Tracing] Add Tag Field to Marker Instance ([#25085](https://github.com/facebook/react/pull/25085)) //<Luna Ruan>//
- **[8ef3a7c08](https://github.com/facebook/react/commit/8ef3a7c08 )**: Resume immediately pinged fiber without unwinding ([#25074](https://github.com/facebook/react/pull/25074)) //<Andrew Clark>//
- **[7bcc68772](https://github.com/facebook/react/commit/7bcc68772 )**: Remove argument committedLanes from reappearLayoutEffects and recursivelyTraverseReappearLayoutEffects ([#25080](https://github.com/facebook/react/pull/25080)) //<Samuel Susla>//
- **[ca990e9a7](https://github.com/facebook/react/commit/ca990e9a7 )**: Add API to force Scheduler to yield for macrotask ([#25044](https://github.com/facebook/react/pull/25044)) //<Andrew Clark>//
- **[b4204ede6](https://github.com/facebook/react/commit/b4204ede6 )**: Clean up unused Deletion flag ([#24992](https://github.com/facebook/react/pull/24992)) //<Andrew Clark>//
- **[e193be87e](https://github.com/facebook/react/commit/e193be87e )**: [Transition Tracing] Add Offscreen Test ([#25035](https://github.com/facebook/react/pull/25035)) //<Luna Ruan>//
- **[9fcaf88d5](https://github.com/facebook/react/commit/9fcaf88d5 )**: Remove rootContainerInstance from unnecessary places ([#25024](https://github.com/facebook/react/pull/25024)) //<Sebastian Markbåge>//
- **[80f3d8819](https://github.com/facebook/react/commit/80f3d8819 )**: Mount/unmount passive effects when Offscreen visibility changes ([#24977](https://github.com/facebook/react/pull/24977)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 4ea064e...c28f313

Reviewed By: rickhanlonii

Differential Revision: D39384898

fbshipit-source-id: 20b080a53851d6dd9d522c8468dd02aab9ba76db
2022-09-12 06:54:35 -07:00
Andreas Eulitz 545366aea3 Pass execution context ID in Debugger.scriptParsed event (#34640)
Summary:
As generated by ReactCommon code, the CDP [Debugger.scriptParsed](https://chromedevtools.github.io/devtools-protocol/tot/Debugger/#event-scriptParsed) event carries a zero execution context ID. It should match the execution context ID contained in the []() argument of the [Runtime.executionContextCreated](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-executionContextCreated) event. Tracking issue is RN:34639](https://github.com/facebook/react-native/issues/34639).

## Changelog

[General] [Changed] - Correct execution context ID in Debugger.scriptParsed event.

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

Test Plan: Verified via packet tracer (Wireshark, Chrome DevTools protocol monitor) that Debugger.scriptParsed carries execution context ID.

Reviewed By: jpporto

Differential Revision: D39385622

Pulled By: mattbfb

fbshipit-source-id: 9060041cfa2a784adf4ad371fbe63f530e3362ad
2022-09-12 06:41:21 -07:00
Rob Hogan 09a910f80b Prepare for Jest 27+ by making legacy fake timer use explicit
Summary:
Jest 27 [flips defaults](https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults), making "modern" fake timers (ie, `sinonjs/fake-timers`) the default, over "legacy", which we currently use.

We're not quite ready for modern timers yet, partly due to Promise polyfills (https://github.com/facebook/react-native/pull/34659), and also some internal issues with specific tests.

This makes our use of legacy timers explicit in preparation for an update to Jest. A switch to modern timers may follow later.

Changelog:
[Internal][Changed] - Prepare for Jest 27+ by making legacy fake timer use explicit

Reviewed By: jacdebug

Differential Revision: D39383719

fbshipit-source-id: 6a3dc6f8547cc76f7702a5a39c9b30a184303f17
2022-09-12 04:59:18 -07:00
Daksh Bhardwaj 095f19a681 feat: added aria-modal as alias for accessibilityViewIsModal(iOS) (#34506)
Summary:
This adds the `aria-modal` prop to the components where it's used as requested on https://github.com/facebook/react-native/issues/34424, mapping web [aria-modal](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-modal) to equivalent [accessibilityViewIsModal](iOS)

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

## TestPlan
Checked manually we are receiving the values by props.

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

Reviewed By: jacdebug

Differential Revision: D39060396

Pulled By: cipolleschi

fbshipit-source-id: 80da100ff412b17ba29ddc6d811afb4b0207ac9f
2022-09-12 04:41:13 -07:00
Nicola Corti 3120ae053f Update Android-prebuilt.mk to use the correct paths for turbomodule & fabricjni
Summary:
When I moved the C++ file around I only updated the Android-prebuilt.cmake
I haven't update the Android.mk equivalent. I'm doing it here.

Changelog:
[Internal] [Changed] - Update Android-prebuilt.mk to use the correct paths for turbomodule & fabricjni

Reviewed By: cipolleschi

Differential Revision: D39397567

fbshipit-source-id: f9f412ef4a9402f9528414af24eac06a0657f6f5
2022-09-12 04:29:33 -07:00
Rob Hogan f1fdc8b9b6 Stop polyfilling Promise in Jest tests (#34659)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34659

We've used this Promise polyfill in Jest setup since at least 2015 ([`3ff3987`](3ff39870ce)), when native Promise implementations were either non-existent or new and unstable. We no longer need it.

It causes issues with "modern" timers in Jest, as documented in:
 - https://github.com/facebook/react-native/issues/29303
 - https://github.com/facebook/jest/issues/10221

It can also obscure real issues due to its default silent handling of uncaught rejections, eg: D39418412.

Changelog:
[General][Changed] - Don't polyfill Promise in Jest setup

Reviewed By: huntie

Differential Revision: D39417597

fbshipit-source-id: d12433ed66c06a402632c2e1d525aad112ef9b0c
2022-09-12 03:57:45 -07:00
Rob Hogan feead8f299 Allow LogBoxLog-test to work with native promises
Summary:
This test currently uses `jest.runAllTicks()` to execute cached, immediately-resolving promises, under Jest "legacy" timers (the RN default) - this works only because [we polyfill Promise](https://github.com/facebook/react-native/blob/main/jest/setup.js#L24) using a userland JavaScript implementation that internally uses mocked-out timer functions.

Here we change to a more universal approach by adding a new microtask/promise to the end of the queue and awaiting it.

This allows us to remove our Promise polyfill from Jest setup (to follow).

Changelog:
[Internal][Fixed] - Prepare `LogBoxLog-test.js` for native promises

Reviewed By: huntie

Differential Revision: D39418413

fbshipit-source-id: 1384ef385b1e10261754513369af8997d296ffea
2022-09-12 03:57:45 -07:00
Rob Hogan 8e0168fe9d Fix `LogBoxSymbolication-test.js`
Summary:
This test was causing uncaught promise rejections, because the mocked `symbolicateStackTrace` in this test returns a different type from the real one, causing `LogBoxSymbolication`'s unawaited, cached promises to reject.

This wasn't picked up as a test failure because our `promise` polyfill silently swallows uncaught rejections, but it does cause a failure if we use native promises in tests.

Changelog:
[Internal][Fixed] - Fix LogBoxSymbolication-test.js

Reviewed By: huntie

Differential Revision: D39418412

fbshipit-source-id: 0be8f1551c4a58dc47faf1597caf47271af40af2
2022-09-12 03:57:45 -07:00
ankit-tailor f1c1f8116b Feat/fontweight number value (#34598)
Summary:
This PR adds support for number values for `fontWeight` as requested in https://github.com/facebook/react-native/issues/34425.

## 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] [Added] - Added support for number values in fontWeight.

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

Test Plan:
```js
<Text style={{ fontWeight: 900, color: 'red' }}>
  Hello World
</Text>
```

Reviewed By: jacdebug

Differential Revision: D39268920

Pulled By: cipolleschi

fbshipit-source-id: 9bb711677bf173f9904b74f382659042856efd83
2022-09-12 02:12:23 -07:00
Paige Sun 4e70376dc7 Modularlize RCTBridgeModule.h 3/n - Move RCTTurboModuleRegistry.h to its own file in ReactInternal target (#34514)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34514

Changelog: [Internal][iOS] Modularlize RCTBridgeModule.h 3/n -  Move RCTTurboModuleRegistry.h to its own file in ReactInternal target

# Why clean up RCTBridgeModule.h?
Clean up one unnecessary import of RCTBridgeModule.h.

RCTBridgeModule includes a lot of header files, and this header is imported everywhere. The ultimate goal is that files (especially React Native infra files) should only import only what they need and not import the entirety of RCTBridgeModule.h whenever possible.

This way, certain headers that are Bridge-only can be compiled out of the new architecture with a flag.

Reviewed By: RSNara

Differential Revision: D38971168

fbshipit-source-id: 3b1b23d422f965a5a14bc4178d32b844906f2c8b
2022-09-09 15:10:14 -07:00
Gabriel Donadel Dall'Agnol 3e97d5fe58 feat: Add id prop to Text, TouchableWithoutFeedback and View components (#34522)
Summary:
This adds the `id` prop to `Text`, `TouchableWithoutFeedback` and `View` components as requested on https://github.com/facebook/react-native/issues/34424 mapping the existing `nativeID` prop to `id`. As this components are inherited by others this also adds the `id` prop support to `Image`, `TouchableBounce`, `TouchableHighlight`, `TouchableOpacity` and `TextInput`.
This PR also adds android tests ensuring that the `id` property is passed to the native view via the `nativeID` prop, these tests were based on the existing `nativeID` tests ([NativeIdTestCase.java](https://github.com/facebook/react-native/blob/main/ReactAndroid/src/androidTest/java/com/facebook/react/tests/NativeIdTestCase.java)).

## Changelog

[General] [Added] - Add id prop to Text, TouchableWithoutFeedback and View components

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

Test Plan: Ensure that the new `id` prop android tests pass on CircleCI

Reviewed By: lunaleaps

Differential Revision: D39089639

Pulled By: cipolleschi

fbshipit-source-id: 884fb2461720835ca5048004fa79096dac89c51c
2022-09-09 11:16:28 -07:00
Viraj-10 720cdbc658 feat: adding aria-label alias for accessibilityLabel (#34502)
Summary:
- Adding [aria-label](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) alias for [accessibilityLabel](https://reactnative.dev/docs/accessibility#accessibilitylabel)

https://github.com/facebook/react-native/issues/34424

## Changelog

[General] [Added] - Add `aria-label` prop to `Button`, `View`, `Pressable` component

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

Test Plan:
```
<Button
     onPress={() => onButtonPress('cancelled')}
     testID="cancel_button"
     color={theme.SystemRedColor}
     title="Cancel Application"
     aria-lable="Press to cancel your application!"
/>
```

Reviewed By: NickGerleman

Differential Revision: D39055178

Pulled By: cipolleschi

fbshipit-source-id: 7513a4518dedd0834e99fa8e72b07e0dc0132b41
2022-09-09 11:16:28 -07:00
Rubén Norte 0f980419f2 Add option to disable inspector in AppContainer to avoid showing it in nested AppContainer views
Summary: Changelog: [internal]

Reviewed By: jacdebug

Differential Revision: D39383213

fbshipit-source-id: 1e3cb7e2d72df1ddbc254c789bd10b12229fe1ae
2022-09-09 09:16:24 -07:00
Rubén Norte 460153fc33 Restore fix for ScrollView error on iOS
Summary:
Changelog: [internal]

This brings back a fix for ScrollView on iOS that we removed because we thought it was no longer necessary, but it actually is.

Reviewed By: jacdebug

Differential Revision: D39382967

fbshipit-source-id: f052b4fb899f4e60e8c530990caf07344a907c43
2022-09-09 09:16:24 -07:00
Zihan Chen (MSFT) 624bdc7ec6 Support TypeScript type `(T)` for turbo module codegen (module only) (#34621)
Summary:
1. In some situation (I don't know exactly how it is triggered but I found that during porting it to `react-native-windows`), `ExportNamedDeclaration.exportKind` is missing. Just skip the checking to `exportKind` because the rest of the checking is sufficient without reading this field.
2. Add `TSParenthesizedType` to module codegen in TypeScript, so that type `(T)` is treated like `T`.

## Changelog

[General] [Changed] - codegen: support TypeScript type `(T)` for turbo module codegen (module only)

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

Test Plan: `yarn jest` passed in `packages/react-native-codegen`

Reviewed By: RSNara

Differential Revision: D39322001

Pulled By: cipolleschi

fbshipit-source-id: 1855711da7062a065c05a10f275e26baa88cf75f
2022-09-09 08:05:29 -07:00
Fabrizio Cucci 9788db0ae5 Comment unsupported `flex` prop
Summary:
Changelog:
[Internal] - Add comment on `flex` prop for visibility

Reviewed By: Andrey-Mishanin

Differential Revision: D39383844

fbshipit-source-id: 0fc64a2dd04a8ab0099389e7e5c49ee5816ba01f
2022-09-09 07:25:59 -07:00
Samuel Susla 71dd83afca Delete preemtive view allocation on iOS
Summary:
changelog: [internal]

preemtive view allocation has been disabled on iOS for over a year. We kept the code in but didn't do anything with it. This diff removes the code and related mobile config.

Post where we decided to turn preemtive view allocation off: https://fb.workplace.com/groups/215742978987717/permalink/832644567297552/

jest_e2e[run_all_tests]

Reviewed By: mdvacca

Differential Revision: D37922589

fbshipit-source-id: 1af8949cbbd9d48a2d80ca238b280178cbe2ead5
2022-09-09 06:25:58 -07:00
Daksh Bhardwaj e8739e962d feat: added accessibility value aliases (#34535)
Summary:
This adds aliasing for accessibility Value, it's used as requested on https://github.com/facebook/react-native/issues/34424.

- [aria-valuemax](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax) to equivalent [accessibilityValue.max](https://reactnative.dev/docs/accessibility#accessibilityvalue)
- [aria-valuemin](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin) to equivalent [accessibilityValue.min](https://reactnative.dev/docs/accessibility#accessibilityvalue)
- [aria-valuenow](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow) to equivalent [accessibilityValue.now](https://reactnative.dev/docs/accessibility#accessibilityvalue)
- [aria-valuetext](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext) to equivalent [accessibilityValue.text](https://reactnative.dev/docs/accessibility#accessibilityvalue)

## Changelog

[General] [Added] - Add `aria-valuemax`, `aria-valuemin`, `aria-valuenow`, `aria-valuetext` as alias prop to `TouchableOpacity`, `View`, `Pressable` `TouchableHighlight` `TouchableBounce` `TouchableWithoutFeedback` `TouchableOpacity` components

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

Test Plan:
- Enable `talkback`.
 - Open the RNTester app and navigate to the Api's tab
 - Go to the `fake Slider Example for Accessibility Value `modes section

<Image src="https://user-images.githubusercontent.com/22423684/187472543-05200d8d-2742-4096-a56c-41f81b440a97.png" height="600" width="300" />

Reviewed By: cipolleschi

Differential Revision: D39206362

Pulled By: jacdebug

fbshipit-source-id: e7ed263badac789d529dd21e961cda5302b031e3
2022-09-09 04:48:41 -07:00
Riccardo Cipolleschi 82e9c6ad61 Simplify the dependencies migration for new libraries (#34619)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34619

When it comes to migrate existing libraries, users needs to update their .podspec files with a bunch [of changes](https://reactnative.dev/docs/0.69/new-architecture-library-ios#add-folly-and-other-dependencies).
This diff groups those changes in a single function, so that contributors can just invoke that function to prepare their dependencies.

## Changelog

[iOS][Changed] - Add function to simplify podspecs

Reviewed By: cortinico

Differential Revision: D39312203

fbshipit-source-id: ed631839e07d472a1fdcba33310f9b1d94fe2fd7
2022-09-09 04:25:56 -07:00
Nicola Corti 54e50ea449 Always enable TurboModuleExample for RN Tester
Summary:
For some reason the turbomodule example inside RN Tester was not enabled by default. I'm enabling it.

Changelog:
[Internal] - Always enable TurboModuleExample for RN Tester

Reviewed By: cipolleschi

Differential Revision: D39381821

fbshipit-source-id: 711c20a51a2f3b274f1b9396d00898b0f60a6f86
2022-09-09 04:08:13 -07:00
Zihan Chen (MSFT) 737ce367b1 Ensure equivalent Flow and TypeScript turbo module definition generates the same output (#34620)
Summary:
Pull request https://github.com/facebook/react-native/issues/34251 only partially worked because I didn't notice that there is ` 1` after the snapshot name. In this change I fixed the issue and find out there is one case that Flow and TypeScript parser generate different result.

It is expected since the test inputs are different. TypeScript removes one member because there is no `{...X, ...}` type in TypeScript. We could make the codegen support intersection type and rewrite it to `X & {...}`, but this will not be included here anyway.

## Changelog

[General] [Changed] - codegen: ensure equivalent Flow and TypeScript TM definition generates the same output

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

Test Plan: `yarn jest` passed in `packages/react-native-codegen`

Reviewed By: NickGerleman

Differential Revision: D39321965

Pulled By: cipolleschi

fbshipit-source-id: aec60f5c9c18323cbd833bf5705af544d7db2e73
2022-09-09 03:27:53 -07:00
Nicola Corti 5cb02ee5be Cleanup the Kotlin code in the .defaults package
Summary:
With the IDE autocompletion now working \o/ I was able to apply some suggestions
to the Kotlin code I wrote inside the .defaults package (like remove redudant qualifiers and similar).

Changelog:
[Internal] [Changed] - Cleanup the Kotlin code in the .defaults package

Reviewed By: cipolleschi

Differential Revision: D39348983

fbshipit-source-id: b443a6be179c85d2a4f4293051c4f26af93eb5f1
2022-09-09 03:12:13 -07:00
Nick Gerleman 5e1c4d4203 Add VirtualizedList tests for handling non-zero initialScrollIndex before scroll metrics
Summary:
This adds a a couple of tests to run existing behavior where VirtualizedList avoids batched renders until it has seen scroll metrics when the list is not initialized to the zero position.

Changelog:
[Internal][Added] - Add VirtualizedList tests for handling non-zero initialScrollIndex before scroll metrics

Reviewed By: yungsters

Differential Revision: D39247250

fbshipit-source-id: 530f58f9c7421949c388048c376fc5b0ab7835d9
2022-09-08 22:27:19 -07:00
Paige Sun 5745c1df26 Modularlize RCTConstants.h - Move Bridge-only constants into a separate file
Summary:
Changelog: [Internal] Move Bridge-only constants into a separate file

- Move Bridge only constants from RCTBridge.h into  RCTBridgeConstants.h.
- Move shared constants from RCTBridge.h into RCTConstants.h.

This way, new architecture does not need to import RCTBridge.h just for the constants.

Reviewed By: sammy-SC

Differential Revision: D39085713

fbshipit-source-id: 40177cbed72a326b40ec448c98751d1dd3464504
2022-09-08 19:56:22 -07:00
Tommy Nguyen 153aedce41 Fix `Alert` not showing in an app using `UIScene` (#34562)
Summary:
In an app using `UIScene`, `Alert` no longer pops up because the window
that gets created are not attached to a scene.

## Changelog

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

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

Test Plan: Use the test plan in https://github.com/facebook/react-native/issues/29295. This should not regress that fix.

Reviewed By: cipolleschi

Differential Revision: D39276976

Pulled By: lunaleaps

fbshipit-source-id: e48e985ed4abec77d6f01a6c17292d664ed88f13
2022-09-08 12:54:08 -07:00
Agastya Darma Laksana b2452ab216 feat: Adding support for objectFit a partial equivalent to the resizeMode style and prop of <Image>. (#34576)
Summary:
This PR aims to add support for objectFit a partial equivalent to the resizeMode style and prop of Image.

## Changelog

[General] [Added] - Add support for objectFit style of Image.

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

Test Plan:
1. Open the RNTester app and navigate to the Image page
2. See the Object Fit section.

![Screenshot_1662112702](https://user-images.githubusercontent.com/8868908/188115315-5d5aa971-93ba-4437-a54b-c5ea69b00c08.png)

Reviewed By: rickhanlonii

Differential Revision: D39261176

Pulled By: jacdebug

fbshipit-source-id: 1eefd76b6c11ed5fc52b2c524ad78c91051077f6
2022-09-08 11:52:10 -07:00
Rubén Norte 4d04b1d4c8 Remove last direct references to utilities in Paper from react-native
Summary:
Changelog: [internal]

This replaces all direct references to the `ReactNative` module (which is the Paper renderer) to `RendererProxy` which would select between Paper and Fabric correctly.

The implementation of these functions is exactly the same right now.

As per the removal of the fix for T55744311 in `ScrollView`, I verified this doesn't cause any issues in the screen where it failed before.

Reviewed By: javache

Differential Revision: D39270691

fbshipit-source-id: 03882748fe4b754b9a2c5e9d4c4f003b94ed49ef
2022-09-08 11:12:06 -07:00
Rubén Norte 699dabb2e3 Use findNodeHandle from RendererProxy instead of Paper in usages within the react-native package
Summary:
This replaces all direct references to `ReactNative` within the `react-native` package to use `findNodeHandle` with a reference obtained from `RendererProxy`, which will allow us to select the correct renderer.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D39270689

fbshipit-source-id: a39875281ba7b7b1b00128564124b6adcacebc4d
2022-09-08 11:12:06 -07:00
Rubén Norte b06cae3681 Extract use of renderer to its own module
Summary:
This diff creates a proxy module to interact with the React Native renderer. The goal of this proxy is to decouple usages of several functions (e.g.: `findNodeHandle`, etc.) from the actual renderer used in an app. This way, we can easily switch between renderers without having to change code depending on it.

This will be useful to remove a specific renderer from an app bundle when it's no longer used (e.g.: Paper on the Facebook App).

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D39205975

fbshipit-source-id: 05289c0c3c8cd26d81aa1d2163097c73ec40c6ad
2022-09-08 11:12:06 -07:00
Rubén Norte 5efb4f09fd Remove (bad) implementation of the User Timing API from Systrace
Summary:
The `Systrace` module implements a polyfill for the User Timing API that's:
1. Incompatible with the Web standard. This polyfill expects `performance.mark` and `performance.measure` to be used exactly like `Systrace.beginEvent` and `Systrace.endEvent` respectively. If not used like those functions, they throw an error at runtime, which is really bad.
2. Never actually used. See below.

This polyfill is only installed if we're actually profiling on startup:
https://www.internalfb.com/code/fbsource/[4d888a933920]/xplat/js/react-native-github/Libraries/Core/setUpSystrace.js?lines=17-21

While the only code that we have that uses this API is actually not installed if we're profiling:

https://www.internalfb.com/code/fbsource/[4d888a933920]/xplat/js/react-native-github/Libraries/Core/setUpDeveloperTools.js?lines=20-21

This should be safe to remove then.

We have plans to add proper support for this API in the short term, so this also gets out of the way of doing that.

Additionally, installing this polyfill was the only reason why we had `setupSystrace`, so we can get rid of that too :)

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D39210813

fbshipit-source-id: a90b6237c311d2157069b41975d10b33f1f464ef
2022-09-08 11:12:06 -07:00
Rubén Norte 9e3156f4c2 Remove unused code from Systrace
Summary: Changelog: [internal]

Reviewed By: javache

Differential Revision: D39210814

fbshipit-source-id: 7129e36d114de3717cfda75b3cc6ac597f06bc4b
2022-09-08 11:12:06 -07:00
Gabriel Donadel Dall'Agnol 73abcba40f feat: Unify TextInput autoComplete and textContentType props (#34523)
Summary:
This unifies the Android only  `autoComplete` and the iOS only `textContentType` TextInput props with the web `autoComplete` values as requested on https://github.com/facebook/react-native/issues/34424. I left the `textContentType` prop and the current supported `autoComplete` values untouched in order to avoid having a breaking change. This also updates RNTester to include test cases using the new `autoComplete` values

## 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] - Unify TextInput autoComplete and textContentType props

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

Test Plan:
1. Open the RNTester app and navigate to the TextInput page
2. Test the `TextInput` component through the `Text Auto Complete` section

https://user-images.githubusercontent.com/11707729/187118267-3b509631-7b84-47b7-a580-567a7f5b483f.mov

Reviewed By: NickGerleman

Differential Revision: D39104545

Pulled By: cipolleschi

fbshipit-source-id: a0d4b1b9ab336854a741a9efe4a62c3da0b5c0f4
2022-09-08 10:36:23 -07:00
Mayank Sunil Pagar 7ea54a4087 feat: added aria-live as a alias for accessibility-live-region (#34555)
Summary:
This adds `aria-live` alias for `accessibilityLiveRegion`, it unifies aria-live and accessibilityLiveRegion and also maps `aria-live='off'` to `accessibilityLiveRegion='none'` as requested on https://github.com/facebook/react-native/issues/34424

## 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][Added] - Added aria-live alias for accessibilityLiveRegion.

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

Test Plan:
```js
<View aria-live="polite">
  <Text>Clicked {this.state.count} times</Text>
</View>

<View aria-live="off">
  <Text>Clicked {this.state.count} times</Text>
</View>
```

Reviewed By: cipolleschi

Differential Revision: D39206291

Pulled By: jacdebug

fbshipit-source-id: fd2019e7047ff7ff6133fed39f1a70b5a9396f89
2022-09-08 10:03:46 -07:00