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

25169 Коммитов

Автор SHA1 Сообщение Дата
Nikita Lutsenko 610bb7f688 rn | Improve bridging, allowing implicit conversion of jsi types wrapped in SyncCallback/AsyncCallback/AsyncPromise.
Summary:
`toJs()` resolution trips up on converting the plain old jsi values.
In order to help it - remove the automatic inference of template types, since we already know that `T` in this case is going to be the concrete jsi type.
This allows using implicit conversions on Sync/Async Callback types, as well as AsyncPromise.

Without it - AsyncPromise/Callback trip up on trying to convert Convertor<T> to jsi type.

Changelog:
[General][Added] SyncCallback/AsyncCallback/AsyncPromise bridging types in C++ now allow wrapping JSI types.

Reviewed By: JoshuaGross

Differential Revision: D38529799

fbshipit-source-id: 860de2d771899f331bf1a4ff0dade4eccc875618
2022-08-09 16:41:34 -07:00
Vincent Riemer 647542c6c8 Add a pointer event attributes test variant for no-hover pointers
Summary:
Changelog: [RNTester][Internal] - Add a pointer event attributes test variant for no-hover pointers

This adds a slightly different version of the existing PointerEventAttributesHoverablePointers test but for pointers that cannot hover (such as touches)

Reviewed By: lunaleaps

Differential Revision: D38401888

fbshipit-source-id: 4ed782cc2157dcaa8f6c294ae3589843d020bc92
2022-08-09 16:37:56 -07:00
Christoph Purrer 477663cba8 Avoid keypress event when text is pasted on macOS
Summary:
There is an issue on react-native-macOS in which clipboard pastes cause a keyPress event both for SingleLine and Multiline text fields.

This problem does not exist on iOS.

However, we can fix it for macOS and keep the iOS behavior unchanged.

# Invocation order on macOS

## macOS Singeline textField
- https://github.com/microsoft/react-native-macos/blob/main/Libraries/Text/TextInput/Multiline/RCTUITextView.m#L309 is called
- [NSTextView(NSPasteboard) paste:] () is called
- [NSTextView(NSSharing) shouldChangeTextInRanges:replacementStrings:] () is called
- https://github.com/microsoft/react-native-macos/blob/main/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m#L382 is called
- https://github.com/microsoft/react-native-macos/blob/main/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m#L323 is called
- https://github.com/microsoft/react-native-macos/blob/main/Libraries/Text/TextInput/RCTBaseTextInputView.m#L436

There is the issue. As ```!backedTextInputView.textWasPasted``` is still ```NO``` we accidently send a keyPress event

## macOS Multiline textView
- [NSTextView(NSSharing) shouldChangeTextInRanges:replacementStrings:] () is called
- https://github.com/microsoft/react-native-macos/blob/main/Libraries/Text/TextInput/Singleline/RCTUITextField.m#L438 is called
- https://github.com/microsoft/react-native-macos/blob/main/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m#L91 is called
- https://github.com/microsoft/react-native-macos/blob/main/Libraries/Text/TextInput/RCTBaseTextInputView.m#L436

There is the issue. As ```!backedTextInputView.textWasPasted``` is still ```NO``` we accidently send a keyPress event

# Invocation order on iOS
Problem does not arise as https://github.com/facebook/react-native/blob/main/Libraries/Text/TextInput/RCTBaseTextInputView.m#L381 is not called as [UIPasteboard _performAsDataOwner:block:] () is used, not causing an side-effects

Changelog:
[macOS][Fixed] - Avoid keypress event when text is pasted on macOS

Reviewed By: sammy-SC

Differential Revision: D38460692

fbshipit-source-id: 343425d3866d32973b118c90a5bfd8ee9db146b6
2022-08-09 14:30:35 -07:00
Seph Soliman 1bc9ddbce3 Enable Flipper for custom Xcode configurations (#34333)
Summary:
Fixed Flipper not recognizing app when using custom Xcode configuration names.

This fixes the problem that renaming the "Debug" Xcode configuration causes Flipper to not work. Despite using the recommended `:configurations` parameters and instructing Cocoapods that it was a debug build (see https://github.com/facebook/react-native/issues/34332), it still wouldn't recognize the app due to missing C preprocessor flags, specifically it was missing `-DFB_SONARKIT_ENABLED=1`.

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

[General] [Fixed] - Flipper now supports custom Xcode build configuration names

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

Test Plan:
I applied the PR change to 0.68.2 (which work similarly but code was refactored since then). I then used `patch-package` to test the change and the fix worked on 2 separate projects.
Patch-package change equivalent:
```diff
 diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb
index f2ceeda..2ea57d6 100644
 --- a/node_modules/react-native/scripts/react_native_pods.rb
+++ b/node_modules/react-native/scripts/react_native_pods.rb
@@ -180,7 +180,7 @@ def flipper_post_install(installer)
     # Enable flipper for React-Core Debug configuration
     if target.name == 'React-Core'
       target.build_configurations.each do |config|
-        if config.name == 'Debug'
+        if config.debug?
           config.build_settings['OTHER_CFLAGS'] = "$(inherited) -DFB_SONARKIT_ENABLED=1"
         end
       end
```

**Screen shot of Xcode after the patch has been applied, for RN v0.68.2:**
![Screen Shot 2022-08-02 at 14 31 49](https://user-images.githubusercontent.com/895369/182477178-387df1b2-d86c-4d82-859c-a2d1e6e6d1d0.jpg)

Reviewed By: dmitryrykun

Differential Revision: D38373812

Pulled By: cipolleschi

fbshipit-source-id: d2949927084160bf0c6f8af37a7966dd22fea9a6
2022-08-09 10:14:23 -07:00
Nicola Corti 665b5bedd3 Let danger run on `pull_request_target` (#34370)
Summary:
This is a nit. Did some cleanups on our Danger setup.
The most substantial work is:
- Moved over danger to run on `pull_request_target`. This allow us to re-use the Github Action access token without having to provide one.
- Fixed an issue with the `Pick Request` label which was not applied correctly.
- Removed the danger_id as we were not passing it correctly.

## Changelog

[Internal] - Let danger run on `pull_request_target`

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

Test Plan: Tested locally with `yarn danger pr https://github.com/facebook/react-native/pull/34197`

Reviewed By: cipolleschi

Differential Revision: D38533144

Pulled By: cortinico

fbshipit-source-id: 178ce411eb956870563c4d51719ed4dae1f1536d
2022-08-09 06:34:32 -07:00
Nicola Corti da961f480b Setup Automatic Rebase given a /rebase comment (#34369)
Summary:
This is a nit, but at least will help us reduce requests to rebase for PRs which maybe have a broken CI due to a stale base commit.

I've limited the scope to members and owners. A `/rebase` will trigger a rebase authored by Github Action bot.

We can play a bit around with it, and remove it if it doesn't really work well for us.

## Changelog

[Internal] - Setup Automatic Rebase given a /rebase comment

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

Test Plan: Nothing to test here.

Reviewed By: cipolleschi

Differential Revision: D38509480

Pulled By: cortinico

fbshipit-source-id: 1df3927638b162d4a787c81372a835d583159498
2022-08-09 04:38:56 -07:00
Nick Gerleman 77c256ca91 Expose UI_MODE_TYPE_VR_HEADSET in PlatformConstants
Summary:
The Android version of PlatformConstants exposes the device's [UI Mode]( https://developer.android.com/guide/topics/resources/providing-resources#UiModeQualifier). It is missing the case for 'vrheadset', added in Android API 26. We should return the expected result when this is queried.

Changelog:
[Android][Added] - Expose UI_MODE_TYPE_VR_HEADSET in PlatformConstants

Reviewed By: rshest

Differential Revision: D38495875

fbshipit-source-id: fd904bd11213448415b7d75145d9ba6311ed407b
2022-08-08 23:41:07 -07:00
Nick Gerleman 584b968683 Add "KeyboardExample" to RNTester
Summary:
This adds a simple debug UI to verify the keyboard events "keyboardDidShow" and "keyboardWillShow"

Changelog:
[Internal][Added] - Add "KeyboardExample" to RNTester

Reviewed By: cortinico

Differential Revision: D38500869

fbshipit-source-id: 99913a05849a7dd27dfdee2d622058b9c2604a7f
2022-08-08 19:45:51 -07:00
Samuel Susla 434adbdb00 React Native sync for revisions d300ceb...9e3b772
Summary:
Sync goes to v18.2 release.

I had to manually trigger CircleCI builds because TTL for build artefacts is 30 days.

This sync includes the following changes:
- **[060505e9d](https://github.com/facebook/react/commit/060505e9d )**: Fix misapplying prod error opt-out ([#24688](https://github.com/facebook/react/pull/24688)) //<Josh Story>//
- **[47944142f](https://github.com/facebook/react/commit/47944142f )**: `now` isn't part of the react-reconciler config anymore ([#24689](https://github.com/facebook/react/pull/24689)) //<Mathieu Dutour>//
- **[b34552352](https://github.com/facebook/react/commit/b34552352 )**: [Fizz] Support abort reasons ([#24680](https://github.com/facebook/react/pull/24680)) //<Josh Story>//
- **[79f54c16d](https://github.com/facebook/react/commit/79f54c16d )**: Bugfix: Revealing a hidden update ([#24685](https://github.com/facebook/react/pull/24685)) //<Andrew Clark>//
- **[7e8a020a4](https://github.com/facebook/react/commit/7e8a020a4 )**: Remove extra Server Context argument ([#24683](https://github.com/facebook/react/pull/24683)) //<Sebastian Markbåge>//
- **[4f29ba1cc](https://github.com/facebook/react/commit/4f29ba1cc )**: support errorInfo in onRecoverableError ([#24591](https://github.com/facebook/react/pull/24591)) //<Josh Story>//
- **[1cd90d2cc](https://github.com/facebook/react/commit/1cd90d2cc )**: Refactor of interleaved ("concurrent") update queue ([#24663](https://github.com/facebook/react/pull/24663)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions d300ceb...9e3b772

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross

Differential Revision: D38496392

fbshipit-source-id: 3ecffc2b3354104562eb23a2643fe0a37a01a7e6
2022-08-08 16:44:55 -07:00
Christoph Purrer 377aa7a30f Make clang-format work in M1 (Apple Silicon)
Summary:
- Current version of clang-format does not work on Apple M1/M2/... chipsets https://github.com/angular/clang-format/issues/78

Changelog:
[General][Fixed] - Make clang-format work in M1 (Apple Silicon)

Reviewed By: cortinico

Differential Revision: D38505844

fbshipit-source-id: c94a71dea82217e725a3609d72692a15a8fe22e0
2022-08-08 13:40:38 -07:00
Riccardo Cipolleschi a4599225f5 Silence deprecation warning for react-native dependency. (#34368)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34368

When a user runs `RCT_NEW_ARCH_ENABLED=1 pod install` to install the dependencies for the New Architecture, Cocoapods prints a warning because of React Native is still set up with a legacy configuration.

This diff silences these warnings because they can confuse the final user.

**Note:** We need to keep this legacy configuration to support both the legacy and the New Architecture.

## Changelog

[iOS][Changed] - Silence warning due to react-native internal details.

Reviewed By: cortinico

Differential Revision: D38503405

fbshipit-source-id: b89857aa88435b1c64da52875606003239ff2e05
2022-08-08 12:34:47 -07:00
Lorenzo Sciandra bd17d83be1 add 0.68.3 changelog (#34366)
Summary:
Adds changelog for new patch.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Changed] - add changelog entry for 0.68.3

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

Test Plan: N/A

Reviewed By: christophpurrer

Differential Revision: D38500055

Pulled By: dmitryrykun

fbshipit-source-id: 0ef857ef1822522372a5743e9471b791d11e0181
2022-08-08 12:09:37 -07:00
Nicola Corti dfd7f70eff Update the new app template to use CMake instead of Android.mk (#34354)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34354

This change simplifies the setup for New Architecture for users on Android.
Instead of using the Android.mk file, users can now use a CMake file which
encapsulate a lot of the complexities and reduces the maintainance cost.

Android.mk support is kept for backward compatibility.

Changelog:
[Android] [Changed] - Update the new app template to use CMake instead of Android.mk

Reviewed By: cipolleschi

Differential Revision: D38460536

fbshipit-source-id: 9d4c3b15be751921d34023b24c174044537e6f02
2022-08-08 08:10:29 -07:00
Muhammad Hur Ali be35c6dafb fix: react android kotlin plugin version conflict (#34255)
Summary:
Fixes https://github.com/facebook/react-native/issues/34229

Basically, the react android conflicts with the kotlin version that's defined in the top level build.gradle. To resolve it, the approach was to get the `kotlinVersion` defined in top level build.gradle and use it. If it's not defined, we use the default(1.6.10 as of now).

The reason behind not using the DSL is that it doesn't allow us to use the variables due to it's constrained syntax.
See [here](https://docs.gradle.org/current/userguide/plugins.html#sec:constrained_syntax)

So the idea was to use the build script to resolve the kotlin plugin and it works 👍 .

Kindly asking for review cortinico :)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Android] [Changed] - refactored usage of kotlin plugin

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

Test Plan: Ran the node ./scripts/run-ci-e2e-tests.js --js --android --ios to verify it doesn't introduce any unexpected issues.

Reviewed By: dmitryrykun

Differential Revision: D38468567

Pulled By: cortinico

fbshipit-source-id: f9ab635fcf033f1d337ed90793ba1667957b8e01
2022-08-08 08:06:05 -07:00
Peter Velkov a98da32229 Fix `HBC_SOURCEMAP_FILE` in `scripts/react-native-xcode.sh` (#34111)
Summary:
## Summary

Fixes https://github.com/facebook/react-native/issues/32497
Fixes https://github.com/facebook/react-native/issues/34212

The assigned HBC_SOURCEMAP_FILE path is incorrect as it does not reference the hermes bundle source map file

See: https://github.com/facebook/react-native/issues/32497#issuecomment-1171379674

## Changelog
[General] [Fixed] - using SOURCEMAP_FILE during xcode build phase with Hermes enabled

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

Test Plan:
1. In a blank react-native project
1. Enable Hermes
1. Go to xCode -> Project -> Build Phases -> Bundle React Native code and images
3. Add `export SOURCEMAP_FILE="$(pwd)/../ios.jsbundle.map"` before `react-native-xcode.sh`
   e.g.
   ```sh
   export NODE_BINARY=node
   export SOURCEMAP_FILE="$(pwd)/../ios.jsbundle.map"

   ../node_modules/react-native/scripts/react-native-xcode.sh
   ```
4. Make a release build `npx react-native run-ios --configuration Release` or `CMD + I` in xCode
5. Verify the build is successful
6. Verify the `.map` file is outputted at the specified path (`ios.jsbundle.map` in project root for the example above)

Reviewed By: cipolleschi

Differential Revision: D38460586

Pulled By: dmitryrykun

fbshipit-source-id: 54c1594b37fa2253896ce9739c1a9a712deecd0f
2022-08-08 07:16:36 -07:00
Lorenzo Sciandra 84fc580ccc add 0.69.4 changelog (#34367)
Summary:
Adds changelog for new patch.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Changed] - add changelog entry for 0.68.3

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

Test Plan: N/A

Reviewed By: dmitryrykun

Differential Revision: D38500554

Pulled By: huntie

fbshipit-source-id: f2fd48b3a0a608d488c1edb85ea8c424029bd9c9
2022-08-08 05:52:36 -07:00
Samuel Susla dfbf7d4e14 Early exit in scrollToOffset if contentOffset wouldn't change
Summary:
changelog: [internal]

Calling `scrollToOffset` with already set content offset doesn't make sense.

Reviewed By: cipolleschi

Differential Revision: D38499666

fbshipit-source-id: ee0bb155fa1619dfd49bca434bf2eee7ad7df9e0
2022-08-08 05:01:19 -07:00
Samuel Susla 904b3b67e2 Remove redundant _forceDispatchNextScrollEvent calls
Summary:
changelog: [internal]

`_forceDispatchNextScrollEvent` is already called inside `- (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated`. No need to call it before.

Reviewed By: cipolleschi

Differential Revision: D38499299

fbshipit-source-id: cf6635e02bf582346869f77194cf06be7939351f
2022-08-08 05:01:19 -07:00
Nicola Corti b4f6262bcc Setup a build matrix for test_android_template (#34355)
Summary:
I'm extending `test_android_template` to use a CI Matrix. This will allow us to make sure that we test a new app template against Debug/Release and against New/Old Arch.

This will make sure we catch a lot of bugs early on 👍

## Changelog

[Internal] - Setup a build matrix for test_android_template

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

Test Plan: Will wait for a green CI

Reviewed By: cipolleschi

Differential Revision: D38499773

Pulled By: cortinico

fbshipit-source-id: 5a24c21d111fb4ae0f4600d86b786021f6ad2abe
2022-08-08 04:44:48 -07:00
Alexander Eggers 7a911e0730 Bump Gradle to 7.5.1 (#34359)
Summary:
https://github.com/facebook/react-native/pull/34310 introduced Gradle 7.5.0, but I noticed that the Gradle team actually missed to remove the `Incubating` annotation for the Java 18 support. The latest 7.5.1 is fixing that. More details can be found here: https://github.com/gradle/gradle/releases/tag/v7.5.1

## Changelog

[Android] [Changed] - Bump Gradle to 7.5.1

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

Test Plan: Successfully build on a local project. I can share the actual branch if needed.

Reviewed By: cipolleschi

Differential Revision: D38497804

Pulled By: cortinico

fbshipit-source-id: 792b83707d5b6aaf7ef29531f82a1bc9224b3204
2022-08-08 04:03:59 -07:00
Nicola Corti 9a80bb7197 Update caniuse-lite with `npx browserslist@latest --update-db`
Summary:
We have a older version of caniuselite in the yarn.lock.
This is causing several warnings on console which I'm resolving with:
`npx browserslist@latest --update-db`

Changelog:
[Internal] [Changed] - Update caniuse-lite with `npx browserslist@latest --update-db`

Reviewed By: cipolleschi

Differential Revision: D38459471

fbshipit-source-id: 4476e2f925f693e4aff457b80906faa51247772c
2022-08-08 04:02:06 -07:00
Chiara Mooney 33dbb6c40c Fix Make Unused Not Compiler Specific (#34357)
Summary:
Use of `__attribute__` and `__unused` is compiler specific. Opt for standard `[[maybe_unused]]` instead.

## Changelog

[General] [Fixed] - Remove compiler-specific syntax.

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

Test Plan: Built on react-native-windows.

Reviewed By: cipolleschi

Differential Revision: D38498481

Pulled By: javache

fbshipit-source-id: af43206788f54dda3b747b6417e20096c7d520e8
2022-08-08 03:50:58 -07:00
Andreas Eulitz 60e7eb4d53 Fix reload hang after debugger break and continue (#34342)
Summary:
When using Hermes and direct debugging, creating a new React instance within the same process hangs when the previous instance was broken into and continued with a debugger (see test Test Plan section below for repro steps). This problem is tracked by issue [9662](https://github.com/microsoft/react-native-windows/issues/9662) in the react-native-windows repo.

In coarse strokes, the following code actions lead to the problem:
1. During the creation of the first React instance, the [lambda in ConnectionDemux::addPage](https://github.com/facebook/react-native/blob/main/ReactCommon/hermes/inspector/chrome/ConnectionDemux.cpp#L121) creates a LocalConnection object that adds a page title into the [inspectedContexts_](https://github.com/facebook/react-native/blob/main/ReactCommon/hermes/inspector/chrome/ConnectionDemux.h#L52) set (a singleton within the process).
2. React instance teardown does not clean up the inspectedContexts_ set.
3. Upon creating the second React instance, ConnectionDemux::enableDebugging sets [waitForDebugger](https://github.com/facebook/react-native/blob/main/ReactCommon/hermes/inspector/chrome/ConnectionDemux.cpp#L89) to true because it still finds the same title in the inspectedContexts_ set.
4. waitForDebugger being true results in the creation of a [PausedWaitEnable FSM state](https://github.com/facebook/react-native/blob/main/ReactCommon/hermes/inspector/InspectorState.h#L256) that hangs the Hermes VM [here](https://github.com/facebook/react-native/blob/main/ReactCommon/hermes/inspector/InspectorState.cpp#L118).

The change proposed here causes the inspectedContexts_ set to get cleaned up on instance teardown, thus resulting in the creation of the proper FSM starting state for the second React instance in the process.

## 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] - Fix reload hang after debugger break and continue

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

Test Plan:
### Repro Steps

The following repro steps involve the [Playground](https://github.com/microsoft/react-native-windows/tree/main/packages/playground) app from the react-native-windows repo. This is only illustrative; the same problem should occur with any RN host.

1. Start Metro bundler in [packages/playground](https://github.com/microsoft/react-native-windows/tree/main/packages/playground) folder.
4. Start Playground app. Adjust settings to use Hermes and direct debugging.
6. Select a package from the package dropdown and press the "Load" button.
7. Start Chrome and navigate to chrome://inspect. Wait a few seconds if necessary, then select "Hermes React Native" from the list of debug targets.
8. In the Chrome Inspector window, break script execution via the "Break" button.
9. Resume script execution via the "Play" button.
10. In the Playground app, select the same or another package, then press the "Load" button.

Result: Playground app hangs while displaying "Loading bundle" banner. Note that script execution cannot be resumed via the Chrome Inspector as step 6. above has already switched the debugger frontend into a "running" state.

With the change proposed here, step 7. does not hang (package reloads and executes). I've added an automated test for this scenario in the react-native-windows scenario (https://github.com/aeulitz/react-native-windows/blob/DebugHang2/packages/debug-test/DebuggingFeatures.test.ts#L245))

Reviewed By: jpporto

Differential Revision: D38423447

Pulled By: javache

fbshipit-source-id: 3a4699dfce229bd820bf1202868599bdcb18d832
2022-08-08 03:27:43 -07:00
Genki Kondo 3f8071d638 Back out "TalkBack support for ScrollView accessibility announcements (list and grid) - Javascript Only Changes"
Summary:
Original commit changeset: 7ba4068405fd

Original Phabricator Diff: D37668064 (463af23753)

D37668064 (463af23753) caused issues in VR Store where on tail load, the scroll position would reset and go back to the top.

Changelog:
[Android][Removed] - Backing out "Accessibility announcement for list and grid in FlatList"

Reviewed By: mullender

Differential Revision: D38473805

fbshipit-source-id: f454c15ca0d31294a44f5fd3f6b73e658ca4f00d
2022-08-05 17:58:41 -07:00
Joshua Gross 9ac0c01d8c Fix layout MountItem logging
Summary:
After. D38153924 (e24ce708ab), layout mount items have 7 int arguments but the logger only pulls out and displays 6, which leads to the following exception: "Caught exception trying to print java.lang.IllegalArgumentException: Invalid type argument to IntBufferBatchMountItem"

Changelog: [Internal]

Created from CodeHub with https://fburl.com/edit-in-codehub

Differential Revision: D38472664

fbshipit-source-id: 1583a5514c2ab662eaf5c4ce4bf33c958cb05282
2022-08-05 17:27:36 -07:00
Dark Knight 39fb2cccb2 Revert D38242964: Multisect successfully blamed D38242964 for test or build failures
Summary:
This diff is reverting D38242964 (d19cee3492)
D38242964 (d19cee3492) has been identified to be causing the following test or build failures:
Tests affected:
- https://www.internalfb.com/intern/test/281475044166194/
- https://www.internalfb.com/intern/test/562950020887755/

Here's the Multisect link:
https://www.internalfb.com/intern/testinfra/multisect/1117138
Here are the tasks that are relevant to this breakage:
T101319872: 14 tests started failing for oncall ar_engine in the last 2 weeks
We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it.

Changelog: [Internal]

Reviewed By: jpporto

Differential Revision: D38452063

fbshipit-source-id: 8d89fe742f04b60fcc110ab3163874ad5eb2af9a
2022-08-05 15:05:35 -07:00
Samuel Susla 4899f8c5e6 Remove react_native_new_architecture.enable_runtimescheduler_in_turbomodule_android flag
Summary:
changelog: [internal]

Turbomodules with RuntimeScheduler on Android are shipped. Let's remove the flag.

jest_e2e[run_all_tests]

Reviewed By: RSNara

Differential Revision: D38456492

fbshipit-source-id: 3dd77c4dc644f1f84b5b74f346fefd701d4cb515
2022-08-05 08:57:42 -07:00
Nick Gerleman 051a67784f VirtualizedList up-to-date state: Enforce correct `setState()` usage
Summary:
This diff is part of an overall stack, meant to fix incorrect usage of `setState()` in `VirtualizedList`, which triggers new invariant checks added in `VirtualizedList_EXPERIMENTAL`. See the stack summary below for more information on the broader change.

## Diff Summary

This adds a `StateSafePureComponent`, which will override `setState`, along with `this.props` and `this.state`, in order to add runtime enforcement that `this.props` and `this.state` are not accessed during a state update where we should be relying on parameter instead. This should be landed after the fixes for unsafe `this.props`/`this.state` usage.

## Stack Summary
`VirtualizedList`'s component state is a set of cells to render. This state is set via the `setState()` class component API. The main "tick" function `VirtualizedList._updateCellsToRender()` calculates this new state using a combination of the current component state, and instance-local state like maps, measurement caches, etc.

From: https://reactjs.org/docs/state-and-lifecycle.html#state-updates-may-be-asynchronous
 ---
> React may batch multiple setState() calls into a single update for performance. Because this.props and this.state may be updated asynchronously, you should not rely on their values for calculating the next state. For example, this code may fail to update the counter:

```
// Wrong
this.setState({
  counter: this.state.counter + this.props.increment,
});
```
> To fix it, use a second form of setState() that accepts a function rather than an object. That function will receive the previous state as the first argument, and the props at the time the update is applied as the second argument:
```
// Correct
this.setState((state, props) => ({
  counter: state.counter + props.increment
}));
```
 ---
`_updateCellsToRender()` transitively calls many functions which will read directly from `this.props` or `this.state` instead of the value passed by the state updater. This intermittently fires invariant violations, when there is a mismatch.

This diff migrates all usages of `props` and `state` during state update to the values provied in `setState()`. To prevent future mismatch, and to provide better clarity on when it is safe to use `this.props`, `this.state`, I overrode `setState` to fire an invariant violation if it is accessed when it is unsafe to:

{F756963772}

Changelog:
[Internal][Changed] - Enable setState() hooks

Reviewed By: rshest

Differential Revision: D38294338

fbshipit-source-id: d04ff39f68df90adc9f4680887d308d997903675
2022-08-05 07:44:13 -07:00
Christoph Purrer 521011d4cc Avoid full copy of large folly::dynamic objects in JSIExecutor#defaultTimeoutInvoker [RFC]
Summary:
Current creation of the errorProcessor lambda does a full copy of folly::dynamic object, which for large objects can cause 1000's of memory allocations, and thus increasing app's memory footprint and speed.

Changelog:
[General][Fixed] - Avoid full copy of large folly::dynamic objects in JSIExecutor#defaultTimeoutInvoker

Reviewed By: sammy-SC

Differential Revision: D38368392

fbshipit-source-id: 88579a7069891828cf6dae130c4964db6b494565
2022-08-04 16:19:17 -07:00
Matt Blagden d19cee3492 Use RuntimeAdapter to disable debugging
Summary:
Make the interface to enable/disable debugging symmetrical; both enabling and disabling are done by passing in a reference to the RuntimeAdapter.

Doing so requires moving ownership of the RuntimeAdapter, so each caller (java2js, arfx engine, React Native, react-native-github, and venice) has been updated to own their adapter.

Additionally, the two implementations of the Inspector connection (react-native-github and arfx engine) have been updated to expect and use the new argument.

`Connection::getRuntime` could be removed and replaced with calls to `Connection::getRuntimeAdapter::getRuntime`. I've left that choice to a followup diff, as this one is getting messy enough as it is.

Changelog: [Internal]

Reviewed By: jpporto

Differential Revision: D38242964

fbshipit-source-id: f2a3354f9d424b203a76d2c15122a6515a0926f2
2022-08-04 14:50:45 -07:00
Matt Blagden 3afe4c64f3 Use HermesRuntime to disable debugging
Summary:
Changelog: [Internal]

Debugging is enabled via `enableDebugging` with a `RuntimeAdapter` that provides a `HermesRuntime`. This same `HermesRuntime` should be passed to `disableDebugging`, not a decorated version. Change the argument type of `disableDebugging` to steer callers in the right direction.

Reviewed By: jpporto

Differential Revision: D38051662

fbshipit-source-id: ae436a4af12fa01143bfbcdb97e65e4fca90154d
2022-08-04 14:50:45 -07:00
Matt Blagden c9c2b4f662 Provide a HermesRuntime from RuntimeAdapter
Summary:
Changelog: [Internal]

Provide a `HermesRuntime` from the `RuntimeAdapter` (instead of a decorated Hermes runtime).

As the Inspector can now directly access the `HermesRuntime` (which exposes access to the debugger), `RuntimeAdapter::getDebugger` is no longer necessary; remove it.

Reviewed By: jpporto

Differential Revision: D38050821

fbshipit-source-id: fa83165a9348bdff0dce1b04ec1afb81d2b1c3e2
2022-08-04 14:50:45 -07:00
Matt Blagden 04e0ffdfa5 Make RuntimeAdapter use only HermesRuntime
Summary:
Changelog: [Internal]

Make runtime use more consistent, always using the same undecorated runtime. This prevents the previous mixing of decorated and undecorated runtimes.

Reviewed By: jpporto

Differential Revision: D38035166

fbshipit-source-id: 81929e42ccc4de6d5c5c09ee7ee31f055af82735
2022-08-04 14:50:45 -07:00
Luna Wei 402b00a513 Add isPrimary and other properties on PointerEvent
Summary: Changelog: [Internal] Add logic for `isPrimary` for PointerEvent object and set other properties to their default value

Reviewed By: javache

Differential Revision: D38363163

fbshipit-source-id: 5ec9de69fb5b34295f1da6daedd5c67e3bd3727e
2022-08-04 12:46:18 -07:00
Luna Wei e0387d9010 PointerEvents: Fix targetting for secondary touches
Summary: Changelog: [Internal] - Fix to use correct x,y coordinates for target determination for secondary touch pointers.

Reviewed By: javache

Differential Revision: D38362070

fbshipit-source-id: c3177fa27f07840e97dac8e4184bf365b5b3b309
2022-08-04 12:46:18 -07:00
Luna Wei cec20c3b97 PointerEvents: Use event.getSource() to distinguish
Summary:
Changelog: [Internal] - Instead of using toolType which is a property per pointer in the MotionEvent, let's use [getSource](https://developer.android.com/reference/android/view/MotionEvent#getSource()) which is the source for the entire event (all pointers).

This aligns with what we've seen on Android when we have a mouse and touch input, there is only one active source input device.

And removes the need for checking a flag we set here: D36958947

Reviewed By: NickGerleman

Differential Revision: D37702090

fbshipit-source-id: ba2a4f0c28e1aff2b8b04314fe6f737b66ed0be3
2022-08-04 12:46:18 -07:00
evanbacon 333583bfbe feat: prevent removing globalEvalWithSourceUrl in RELEASE builds (#34319)
Summary:
Expo Go was using `nativeInjectHMRUpdate` for [snack](https://snack.expo.io/) to provide stack traces to OTA errors. `nativeInjectHMRUpdate` was replaced with `globalEvalWithSourceUrl` [here](71c84cf6be). The issue with `globalEvalWithSourceUrl` is that it is stripped in RELEASE builds, and Expo Go is installed via the App Store, making it a release build.

I propose we keep the method, `eval` is still exposed in production so there's no increase in security risk, simply provides a better DX for multipurpose development clients.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Android] [Added] - Expose `globalEvalWithSourceUrl` in production builds.
[iOS] [Added] - Expose `globalEvalWithSourceUrl` in production builds.

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

Test Plan: - Function should be available as `global.globalEvalWithSourceUrl` in a production build.

Reviewed By: christophpurrer

Differential Revision: D38312111

Pulled By: motiz88

fbshipit-source-id: adcd83ad1103c8fd4c6d5d7aec765f27881e0432
2022-08-04 09:25:08 -07:00
JoseLion 7fcdb9d9d8 fix(android): Append `.exe` to hermesc binary path for Windows users (#34151)
Summary:
Resolves https://github.com/facebook/react-native/issues/34116.

In a nutshell, the problem was a missing `.exe` extension on the `hermesc` binary path when running on Windows OS. The missing extension causes the method `.exists()` of the File instance to always return false, so none of the conditions ever met and an error was thrown whenever a release build with Hermes enabled was run on Windows. More details can be found in the comments on the above issues.

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

[Android] [Fixed] - Fix error of release builds with Hermes enabled for Windows users

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

Test Plan:
### Reproduce

Changes on Gradle scrips are better tested on an actual application. To reproduce the issue you can:
1. Create or reuse a React Native application with version `v0.69.1` on a Windows machine
2. Enable Hermes on Android following the steps on the [documentation](https://reactnative.dev/docs/hermes#enabling-hermes)
3. Clean the build folder: `cd android && ./gradlew clean`
4. Bundle the JS and assets for a release version: `./gradlew bundleReleaseJsAndAssets`
5. The build fails with the following error:
```shell
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> java.lang.Exception: Couldn't determine Hermesc location. Please set `project.ext.react.hermesCommand` to the path of the hermesc binary file. node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc
```

### Test the changes

Follow the same steps above using the fix on this PR and the error should disappear 🙂

Reviewed By: NickGerleman

Differential Revision: D37755468

Pulled By: cortinico

fbshipit-source-id: 2ad0ced583555b907259df116f64a45da6d153f3
2022-08-04 08:33:16 -07:00
Sparsha Saha 54a4fcbfdc Removing reactnativeutilsjni as it is built from the same sources as reactnativejni (#34339)
Summary:
This Pull Request aims at removing the making of reactnativeutilsjni as it is built from the same sources as reactnativejni. It also replaces references to reactnativeutilsjni with reactnativejni.

This should get rid of `reactnativeutilsjni.so` while reusing `reactnativejni.so` in it's place. This should give us some size improvements in the finally built apk.
## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Android] [Changed] - Replaced reactnativeutilsjni with reactnativejni in the build process to reduce size

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

Test Plan:
1. Ran the CMakelist.txt file using CMake and I could see that reactnativeutilsjni.dir is no longer generated with my changes.
2. Built the aar from this branch in Android Studio and build happened successfully.

I am not sure if we could run any more tests. Please let me know in case anymore testing is required and I can do accordingly

Reviewed By: cortinico

Differential Revision: D38400481

Pulled By: genkikondo

fbshipit-source-id: 592736e56441328389ae89135667c336ff8018e6
2022-08-04 03:11:56 -07:00
Marshall Roch 39b48b1c1d Upgrade to Flow 0.184.0
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D38415143

fbshipit-source-id: f5c672dc7fca7e0e81a65963cbd148bfca5deaf3
2022-08-03 21:07:47 -07:00
Pieter Vanderwerff 0ccbe5f704 Add missing class annotations and lock xplat/js
Reviewed By: SamChou19815

Differential Revision: D38374141

fbshipit-source-id: 967291a5c1a29f39b7272726c8b41bc74d1be043
2022-08-03 17:45:53 -07:00
Pieter Vanderwerff c687dd3a77 Add missing class annotations xplat/js [android]
Reviewed By: SamChou19815

Differential Revision: D38375460

fbshipit-source-id: 265f36635c3bc672ee222b78a852034c1f865bcc
2022-08-03 17:18:33 -07:00
Pieter Vanderwerff 2e649006f1 Add missing class annotations xplat/js [suppressions]
Reviewed By: SamChou19815

Differential Revision: D38374117

fbshipit-source-id: 72a5c5f5ee989e0629660dd6e46868675bfb02b6
2022-08-03 12:43:58 -07:00
Pieter Vanderwerff ee3d3c248d Add missing class annotations xplat/js
Reviewed By: SamChou19815

Differential Revision: D38373443

fbshipit-source-id: 1222c4845ebd6b72bd6f54af1a27cf8542dd883a
2022-08-03 12:43:58 -07:00
Riccardo Cipolleschi 2fa04be062 Fix edge case where prepare_hermes_workspace and build_hermes_macos where using different hermes commits (#34329)
Summary:
This PR fixes an edge case where `prepare_hermes_workspace` job was using a commit to build hermes but `build_hermes_macos` was using a different one. This resulted in cache poisoning where subsequent jobs thoughts to be using a version of Hermes while the restored cache was loading a different one.

<img width="1440" alt="Screenshot 2022-08-03 at 06 26 14" src="https://user-images.githubusercontent.com/11162307/182570809-5c6d9323-c3fb-4834-952f-7d07b99c4880.png">

This PR simplifies the flow, creating a single `.hermesversion` file in the `prepare_hermes_workspace` workspace and using that file as key for all the caches.

## Changelog

[iOS] [Changed] - upload test result as artifact

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

Test Plan:
CircleCI is now green and all the caches are using the same file to create the checksum.

We can verify that by looking at the `Save cache`/`Restore cache` commands related to Hermes. (In the workflow, their hash is always `B1NEL0P0OKhQYtk8DE150bXSoGrdWUweedHKmqNqnjo`)

Also, we removed completely the code that could create a version misalignment.

Reviewed By: cortinico

Differential Revision: D38382895

Pulled By: cipolleschi

fbshipit-source-id: 5f5501a7ef313eb56abda336716b24b486a34a1f
2022-08-03 03:34:29 -07:00
fabriziobertoglio1987 463af23753 TalkBack support for ScrollView accessibility announcements (list and grid) - Javascript Only Changes (#33180)
Summary:
This is the Javascript-only changes from D34518929 (dd6325bafe), split out for push safety. Original summary and test plan below:

This issue fixes [30977][17] . The Pull Request was previously published by [intergalacticspacehighway][13] with [31666][19].
The solution consists of:
1. Adding Javascript logic in the [FlatList][14], SectionList, VirtualizedList components to provide accessibility information (row and column position) for each cell in the method [renderItem][20] as a fourth parameter [accessibilityCollectionItem][21]. The information is saved on the native side in the AccessibilityNodeInfo and announced by TalkBack when changing row, column, or page ([video example][12]). The prop accessibilityCollectionItem is available in the View component which wraps each FlatList cell.
2. Adding Java logic in [ReactScrollView.java][16] and HorizontalScrollView to announce pages with TalkBack when scrolling up/down. The missing AOSP logic in [ScrollView.java][10] (see also the [GridView][11] example) is responsible for announcing Page Scrolling with TalkBack.

Relevant Links:
x [Additional notes on this PR][18]
x [discussion on the additional container View around each FlatList cell][22]
x [commit adding prop getCellsInItemCount to VirtualizedList][23]

## Changelog

[Android] [Added] - Accessibility announcement for list and grid in FlatList

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

Test Plan:
[1]. TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer ([link][1])
[2]. TalkBack announces pages and cells with Vertical Flatlist in the Paper Renderer ([link][2])
[3]. `FlatList numColumns={undefined}` Should not trigger Runtime Error NoSuchKey exception columnCount when enabling TalkBack. ([link][3])
[4]. TalkBack announces pages and cells with Nested Horizontal Flatlist in the rn-tester app ([link][4])

[1]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/6#issuecomment-1050452894
[2]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/6#issuecomment-1050462465
[3]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/6#issuecomment-1032340879
[4]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/6#issuecomment-1050618308
[10]:1ac46f932e/core/java/android/widget/AdapterView.java (L1027-L1029) "GridView.java method responsible for calling setFromIndex and setToIndex"
[11]:https://github.com/fabriziobertoglio1987/react-native-notes/issues/6#issuecomment-1042518901 "test case on Android GridView"
[12]:https://github.com/fabriziobertoglio1987/react-native-notes/issues/6#issuecomment-1050452894 "TalkBack announces pages and cells with Horizontal Flatlist in the Paper Renderer"
[13]:https://github.com/intergalacticspacehighway "github intergalacticspacehighway"
[14]:80acf523a4/Libraries/Lists/FlatList.js (L617-L636) "FlatList accessibilityCollectionItem"
[16]:5706bd7d3e/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java (L183-L184) "logic added to ReactScrollView.java"
[17]: https://github.com/facebook/react-native/issues/30977
[18]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/6
[19]: https://github.com/facebook/react-native/pull/31666
[20]: https://reactnative.dev/docs/next/flatlist#required-renderitem "FlatList renderItem documentation"
[21]: 75147359c5 "commit that introduces fourth param accessibilityCollectionItem in callback renderItem"
[22]: https://github.com/facebook/react-native/pull/33180#discussion_r826748664 "discussion on the additional container View around each FlatList cell"
[23]: d50fd1a681 "commit adding prop getCellsInItemCount to VirtualizedList"

Reviewed By: lunaleaps

Differential Revision: D37668064

Pulled By: blavalla

fbshipit-source-id: 7ba4068405fdcb9823d0daed2d8c36f0a56dbf0f
2022-08-02 19:49:05 -07:00
Antoine Doubovetzky cc19cdcdbe Fix/flat list not calling render items for nullish values when numColumns > 1 (#34205)
Summary:
Fixes https://github.com/facebook/react-native/issues/34034.

The FlatList doesn't call renderItem on nullish values when numColumns > 1, but it does when numColumns is not set (or equals 1).
I think the behavior should be consistent, so I updated the code so renderItems is called for every items.

I believe the condition `item != null` was here to make sure renderItem isn't called for index outside of data range, so I replaced it with `itemIndex < data.length`.

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

[General] [Fixed] - Fix FlatList not calling render items for nullish values when numColumns > 1

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

Test Plan:
- I added a failing test corresponding to the issue, and the test now succeeds.
- I used the same code as in the test on a newly initialized app on RN 0.69 and made sure renderItem was called for every items as expected.

Reviewed By: NickGerleman

Differential Revision: D38185103

Pulled By: lunaleaps

fbshipit-source-id: 4baa55caef9574c91c43c047f9e419016ceb39db
2022-08-02 18:11:24 -07:00
Ruslan Shestopalyuk a142a78473 Fix regression when setting shadow node properties in D38272966 (github PR merge)
Summary:
Changelog:

[Android][Fixed] - Fix regression when setting shadow node properties.

Also simplified the corresponding macros to avoid using lambdas altogether, as they are not required.

Note that this **does not** modify any constexpr-related semantics of the existing code, as the main constexpr macro, `CONSTEXPR_RAW_PROPS_KEY_HASH` evaluation result is still contstexpr value, and the other ones already involved non-const parts (see my comments).

Reviewed By: NickGerleman

Differential Revision: D38356411

fbshipit-source-id: 22c330d3425c8aed36693f4652f1b257d2dc96be
2022-08-02 15:14:16 -07:00
Daniel Leong c7c263dda8 Fix unexpected ScrollView fling behavior due to Android P bug workaround (#34233)
Summary:
Some custom logic is applied to workaround a platform bug where velocity may be incorrect on Android P. [The bug in question](https://issuetracker.google.com/issues/112385925) appears to have been fixed before Android `Q` was released, so we shouldn't *need* to apply the workaround on other versions.

As described in https://github.com/facebook/react-native/issues/34226 the workaround can adversely affect certain scroll behaviors, which can easily be reproduced when you briefly scroll one direction then quickly fling the opposite direction (see the video in the linked ticket).

This PR changes the workaround to *only* be applied on Android P, in order to avoid causing weird scroll behavior on versions that are not actually affected by the bug the workaround is working around.

## Changelog

```
[Android] [Fixed] - Fix occasionally incorrect ScrollView fling behavior
```

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

Test Plan:
- Repro the strange fling behavior in the current version (See video attached in https://github.com/facebook/react-native/issues/34226)
- Verify that the string fling behavior is fixed with this patch
- Verify that fling behavior still works as expected on Android versions affected by the [original bug](https://issuetracker.google.com/issues/112385925), and those immediately following it (to verify that the bug being worked around was, in fact, fixed as expected).

Reviewed By: javache

Differential Revision: D38287277

Pulled By: ryancat

fbshipit-source-id: 2c786872c4d41655b3849bb92e02f1f16c663b41
2022-08-02 13:45:31 -07:00
Riccardo Cipolleschi 1bba59023d Run ESLint in Danger (#34305)
Summary:
This PR runs eslint in PR using Danger.

## Changelog

[General] [Changed] - Run ESLint in CI

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

Test Plan:
1. Add a JS lint error in the package/react-native-codegen package.
2. Observe the CI task post a message with the errors
3. Fix the errors
4. Observe the CI task report completion with no errors

Reviewed By: cortinico

Differential Revision: D38315268

Pulled By: cipolleschi

fbshipit-source-id: 9984402ee427dd62d47dd716f73c030e6d0f7b5e
2022-08-02 06:53:35 -07:00