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

25492 Коммитов

Автор SHA1 Сообщение Дата
Matt Blagden 6fcfe2e1b3 Identify debug sessions with a token
Summary:
The `RuntimeAdapter` may be used after `disableDebugging` has been called. To ensure the `RuntimeAdapter` is alive long enough for this use, the Inspector should continue to control `RuntimeAdapter`'s lifetime (which is currently done via a `unique_ptr` that's moved into the Inspector).

Callers need a way to identify the `RuntimeAdapter` after it has been moved into the Inspector so that debugging can be disabled via `disableDebugging`.

This could be done by switching from a `unique_ptr` to a `shared_ptr` (so the caller can keep a copy), but consumers don't really have a reason to hang onto the `RuntimeAdapter` instance. Instead, leave the `RuntimeAdapter` inside a `unique_ptr`, and have consumers use a token to identify instances.

Update all consumers of this API to use this new token interface.

Changelog: [Internal]

Reviewed By: jpporto

Differential Revision: D38513256

fbshipit-source-id: 33580747cd8365d25dbddbe289f0c41141e3bc6a
2022-08-12 06:43:46 -07:00
Nicola Corti 296d7db7a2 Do not store .cpp/.h files inside src/main/java - reactperflogger (#34386)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34386

Current we expose native code (.h, .cpp) inside the src/main/java folder.
This is making impossible for users on New Architecture to open the project
inside Android Studio.

The problem is that the src/main/java is reserved to Java/Kotlin sources only.
AGP 7.2 also removed support for mixed source roots:
https://developer.android.com/studio/releases/gradle-plugin#duplicate-content-roots

This is essentially forcing users to write Java code without any autocompletion
as all the React Native Java classes are considered C++ files.

I'm addressing this issue folder by folder by moving them
from `ReactAndroid/src/main/java/com/facebook/...` to `ReactAndroid/src/main/jni/react/...`

This is the diff for reactperflogger

Changelog:
[Internal] [Changed] - Do not store .cpp/.h files inside src/main/java - reactperflogger

Reviewed By: cipolleschi

Differential Revision: D38584681

fbshipit-source-id: 8b65b3fa47a7f106c7fea79fd739f0e4e37efa2a
2022-08-12 05:05:39 -07:00
Tim Yung 7783f88d71 Revise Prop Types Error Message (#34392)
Summary:
Improves upon the existing prop types error messages to first recommend migrating to a type system (before recommending the usage of `deprecated-react-native-prop-types`).

## Changelog

[General][Changed] - Minor change to PropTypes error message.

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

Test Plan: Careful code inspection.

Reviewed By: rickhanlonii

Differential Revision: D38632723

Pulled By: yungsters

fbshipit-source-id: 88e44116475c7d93bc561c9ab6883855d6d79a7e
2022-08-11 14:34:30 -07:00
Genki Kondo ffaa1a6de1 Add needsOffscreenAlphaCompositing to view config
Summary:
needsOffscreenAlphaCompositing is supported on both iOS and Android, but was missing from the view config for Android.
https://reactnative.dev/docs/view#needsoffscreenalphacompositing
https://fburl.com/code/hfxkrur1

Changelog:
[Internal][Fixed] - Add needsOffscreenAlphaCompositing to view config

Reviewed By: NickGerleman

Differential Revision: D38580371

fbshipit-source-id: 9b577079e575d73c94d7c0d0298ba880c1438099
2022-08-11 14:14:56 -07:00
Nicola Corti 50e8430a82 Do not use kwargs which are not known in Buck OSS (#34388)
Summary:
This is an attempt to fix the `test_buck` CI after the land of 063c2b4668

There were references to internal args that are causing Buck OSS to fail. I'm removing them all.

## Changelog

[Internal] - Do not use kwargs which are not known in Buck OSS

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

Test Plan: If CI is green, we can merge this 👍

Reviewed By: motiz88

Differential Revision: D38619542

Pulled By: cortinico

fbshipit-source-id: e00b4b5da7e181365e63e10aa50d0ecde8024359
2022-08-11 10:27:26 -07:00
Lulu Wu fc065151ce Add ability to store and retrieve a list of MapBuffer
Summary:
Add ability to store and retrieve a list of MapBuffer as an entry of MapBuffer.

```
Example:

MapBuffer1
{
 key1: "test string",
 key2: MapBuffer2,
 key3: [MapBuffer3, MapBuffer4]
}
```

Changelog:
[General][Added] Add ability to store and retrieve a list of MapBuffer

Reviewed By: JoshuaGross

Differential Revision: D38460204

fbshipit-source-id: 3e721418be2dca6d5f15f665753844d6f531e31c
2022-08-11 10:14:38 -07:00
Lorenzo Sciandra 7e580b97bf chore(deps): bump CLI to latest v9 alpha (#34385)
Summary:
Bump CLI to latest v9 alpha so that I can then chery-pick in 0.70-stable branch for next RC

## 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] -  bump CLI to latest v9-alpha11

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

Test Plan: N/A

Reviewed By: robhogan

Differential Revision: D38615615

Pulled By: dmitryrykun

fbshipit-source-id: ea5dd7b93f4ed3bb82347fd730b8e65e8a89a6ca
2022-08-11 07:24:53 -07:00
Nicola Corti 9214da1238 Do not load Flipper via reflection (#34383)
Summary:
Followup to https://github.com/facebook/react-native/issues/34379 by danilobuerger

Loading Flipper via reflection is type unsafe and requires extra code + exception handling that we can get rid of. The recommended way to use Flipper on Android is either via a `no-op` artifact or by using build flavors.

As we already had a setup for Flipper for `debug`, I'm creating the `release` equivalent which is just a stub. This allows us to get rid of some code inside `MainApplication.java`

## Changelog

[Android] [Changed] - Do not load Flipper via reflection

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

Test Plan: Will wait for a CI result on this.

Reviewed By: cipolleschi

Differential Revision: D38615257

Pulled By: cortinico

fbshipit-source-id: 66bb2c46c5df36a15c1b27512209a849f55d64c9
2022-08-11 05:10:39 -07:00
Pieter De Baets 450fa4d1d3 Remove molly dep from react-native buck graph
Summary:
Folly's molly target combines a number of targets that are supposed to be useable on mobile. Since we're trying to move away from folly, we should instead list explicitly which parts of folly we're using so we can remove them over time, and track which targets no longer have any folly dependencies.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D38352060

fbshipit-source-id: 09d0d84793692f97f4d49390c99c38b23441df54
2022-08-11 04:53:34 -07:00
Nick Gerleman 063c2b4668 Enable -Wpedantic for targets inside ReactCommon
Summary:
React Native is compiled downstream with MSVC, meaning the introduction of code depending on language extensions specific to gcc/clang may cause breakage.

We can enable `-Wpedantic` to flag any behavior not officially supported by the specified C++ standard. This will includes rules beyond what MSVC has trouble with, but seems to not have too many "noisy warnings".

This change enables -Wpedantic in BUCK targets within ReactCommon.

This makes the OSS C++ build for Android/iOS slightly more permissive than the internal build, A followup is to add the changes to OSS build logic as well, to avoid contributors seeing more errors upon internal submission. (checking with cortinico on how to do this for Android).

react-native-windows uses a higher warning level than `-Wall`, which is an additional cause of compilation failures, but is not addressed as part of this change.

Changelog:
[Internal][Changed] - Enable -Wpedantic for targets inside ReactCommon

Reviewed By: rshest

Differential Revision: D38457812

fbshipit-source-id: 014da1ac0b7ad8f78154e6e447ed58def6bd0d47
2022-08-11 04:37:35 -07:00
Nicola Corti 4699a39489 Isolate the buck OSS commands inside test_buck (#34378)
Summary:
This isolates and parallelize all the BUCK related work inside a `test_buck` job, so it's immediately clear where a failure happend.

I've also added a couple of minor improvements:
- Don't clone okbuck just to consume a script. I've copied the script over instead.
- Removed unnecessary `buck_cache_key`

This should reduce ~5 minute of build time from Test Android which was already beyond 10 minutes.

## Changelog

[Internal] - Isolate the buck OSS commands inside test_buck

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

Test Plan: Let's wait for a `test_buck` and `test_android` output.

Reviewed By: cipolleschi

Differential Revision: D38580359

Pulled By: cortinico

fbshipit-source-id: 8b3915bbc28b4a7a169011fe9047f402c2d1f6ee
2022-08-11 02:46:00 -07:00
Pieter De Baets e0be14a310 Correctly reset pivot when recyling views
Summary:
Calling `setPivotX` and `setPivotY` internally sets `isPivotExplicitlySet` in Android UI, which causes some transforms to no longer use the right transform. Instead use `resetPivot` to get the desired behaviour.

Changelog: [Android][Fixed] Bug with view transforms when view recycling is enabled

Reviewed By: NickGerleman

Differential Revision: D38579267

fbshipit-source-id: 36186286c6765f92aabaa44994546e06f34c2be0
2022-08-11 02:36:44 -07:00
Nick Gerleman 1e48274223 Use WindowInsetsCompat for Keyboard Events
Summary:
RN for Android fires `keyboardDidShow` and `keyboardDidHide` by observing changes to viewable window size. This isn't always reliable, such as when an activity has `awindowSoftInputMode` set to not have the system adjust the viewport when a keyboard is opened.

Android 11 added the direct ability to measure and check visibility of the soft keyboard via `WindowInsets`, which fixes these issues. This is exposed downlevel to API 23 via WindowInsetsComapt` with the same limitations as previously, but using it simplifies our calculations a lot.

Changelog:
[Android][Fixed] - Use WindowInsetsCompat for Keyboard Events

Reviewed By: javache

Differential Revision: D38500859

fbshipit-source-id: d4ad41d7e75e4b9c14a485539a5f9de19de74362
2022-08-11 02:22:20 -07:00
Danilo Bürger a379879adf Collapse catch blocks in template (#34379)
Summary:
Collapse catch blocks in template

## Changelog

[Android] [Changed] - Collapse catch blocks in template

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

Test Plan: No test plan required.

Reviewed By: cortinico

Differential Revision: D38593529

Pulled By: makovkastar

fbshipit-source-id: a26b00d88421f3e9201f98aabbc8a1b43159c208
2022-08-10 22:46:26 -07:00
Vincent Riemer e532f861ec Fix ghost leave/out events firing due to view recycling
Summary:
Changelog: [iOS][Internal] - Fix ghost pointer leave/out events firing due to view recycling on iOS

While implementing the properties on the PointerEvent object on iOS I noticed that in certain specific scenarios I was seeing pointerLeave events being fired seemingly without corresponding pointerEvent events and even more strangely, when the pointer wasn't even close to the view in question.

After a lot of research I discovered that this was caused by an incompatibility between my strategy of keeping track/identifying views which are being hovered and RN's handling of creating/deleting views on iOS. See on iOS RN has the `RCTComponentViewRegistry` class which manages the creation & deletion of UIViews and adds an optimization of recycling views instead of outright deleting them.

This is causing issues with my tracking of which views are hovered because I compare the view's object references which, while accurate towards confirming equality of an underlying UIView — isn't accurate in confirming the equality of views from react's perspective.

This diff addresses this issue by adding a simple wrapper class that can be used around the UIViews which stores the view's react ID at initialization time ensuring it doesn't get updated even if the underlying view's react id is. As an additional precaution the wrapper class will also not return the view it's wrapping if their react tags do not match.

Reviewed By: lunaleaps

Differential Revision: D38546628

fbshipit-source-id: 8b732d52da0e61a5447001e8940e4439f49c6baf
2022-08-10 16:44:59 -07:00
Genki Kondo 01492296d2 Add pointer events to text view config
Summary:
BaseViewManager.setPointerEnter was never called on ReactTextViews, and thus text views would not receive hover events.

Changelog:
[Internal][Fixed] - Add pointer events to text view config

Reviewed By: lunaleaps, javache

Differential Revision: D38557546

fbshipit-source-id: cfc0e5442efbd7c76d1b47acf56496d10ef78cf5
2022-08-10 13:10:26 -07:00
Alex Hunt 0aed5d9db2 Fix typos in ReactCxxErrorHandler message
Summary: Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D38578690

fbshipit-source-id: d0339bf1db1bb3e36f0cbf1e93cc5853a7ed6570
2022-08-10 10:52:29 -07:00
fabriziobertoglio1987 62021eb8d1 adding importantForAccessibility for Text, Button, ImageBackground (#34245)
Summary:
Previously published by [grgr-dkrk][2] as [https://github.com/facebook/react-native/issues/31296][3], fixes the following issues:

1) ImportantForAccessibility="no" does not work on Text, Button
2) ImportantForAccessibility="no-hide-descendants" does not work on Text, Button, or ImageBackground.

Note: On ImageBackground, focus is prevented on the imageBackground node itself, but focus is not prevented on its descendants.

Note: [Button component expected behavior for prop importantForAccessibility][4]
>Some components like Button seem like atomic units, but they end up rendering a hierarchy of components for example a wrapper View with a Text inside them. Allowing those descendants to become focusable, breaks the model of these being a single component to consider and forcing no-hide-descendants makes sense here.

>The other option is always to render any descendants of these elements with importantForAccessibility="no", so they can never be focusable on their own. This would have the same result, **BUT may potentially cause issues when the descendant content is supposed to automatically get moved up to the focusable ancestor to act as a label** (which is what Talkback does with unfocusable text elements by default).

Note: [importantForAccessibility="no" does not allow screenreader focus on nested Text Components with accessibilityRole="link" or inline Images][5]

fixes https://github.com/facebook/react-native/issues/30850 related https://github.com/facebook/react-native/pull/33690

## Changelog

[Android] [Fixed] - adding importantForAccessibility for Text, Button, ImageBackground

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

Test Plan:
1) testing ImageBackground importantForAccessiblity ([link to test][1])
2) importantForAccessibility="no" does not allow screenreader focus on nested Text Components with accessibilityRole="link" or inline Images ([link to test][5])
3) testing ImageBackground importantForAccessiblity ([link to test][6])
4) Button with importantForAccessibility=no ([link to test][7])

[1]: https://github.com/facebook/react-native/pull/31296#issuecomment-1192341626 ""
[2]: https://github.com/grgr-dkrk "grgr-dkrk"
[3]: https://github.com/facebook/react-native/pull/31296 "https://github.com/facebook/react-native/issues/31296"
[4]: https://github.com/facebook/react-native/pull/31296#discussion_r616184584 "expected behaviour with prop importantForAccessibility in Button component"
[5]: https://github.com/facebook/react-native/issues/30850#issuecomment-1192286477 "importantForAccessibility=no does not allow screenreader focus on nested Text Components with accessibilityRole=link or inline Images"
[6]: https://github.com/facebook/react-native/pull/34245#issuecomment-1192446124 "testing ImageBackground importantForAccessiblity"
[7]: https://github.com/facebook/react-native/pull/34245#issuecomment-1192443589 "Button with importantForAccessibility=no"

Reviewed By: cipolleschi

Differential Revision: D38121992

Pulled By: dmitryrykun

fbshipit-source-id: 368b4dcb47d7940274820aa2e39ed5e2ca068821
2022-08-10 05:30:28 -07:00
Dmitry Rykun 03de19745e Fix USE_HERMES envvar check
Summary:
Hermes is enabled by default. We set `USE_HERMES` envvar to `false` to explicilty disable Hermes. The only valid way to check it would be to compare it against `false`. Everything else will produce invalid results if `USE_HERMES` is not defined. For example `$USE_HERMES != true` will turn into `'' != true`, which evaluates to `true`.
Due to this bug source maps were not generated by default.

Changelog:
[iOS][Fixed] - USE_HERMES envvar check fixed in react-native-xcode.sh. Now source maps are generated by default.

Reviewed By: cipolleschi

Differential Revision: D38571971

fbshipit-source-id: bc6b505c225c56d62ee773b401b66d821965e106
2022-08-10 05:24:41 -07:00
Pieter De Baets 1a8ce7a26a Roll out turbo_module_binding_mode experiment
Summary:
We ran an experiment to test different implementations of TurboModules HostObjects, as the current one has various inefficiencies, such as re-creating HostFunctions on every property access. The strategy we found to be most efficient and flexible longer-term is to represent the TurboModule with a plain JavaScript object and use a HostObject as its prototype. Whenever a property is accessed through the prototype, we cache the property value on the plain object, so it can be efficiently resolved by the VM for future accesses.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D38355134

fbshipit-source-id: 59253091412d0c6827ad7a4b1ac7dc0c7fe89cc2
2022-08-10 04:54:25 -07:00
Riccardo Cipolleschi 9344c7aa5a fix: try to run dange in PR correctly (#34375)
Summary:
After https://github.com/facebook/react-native/issues/34370, Danger started failing because the `DANGER_GITHUB_API_TOKEN` was not properly set.
This PR fixes it.

## Changelog

[General] [Changed] - Set back the `DANGER_GITHUB_API_TOKEN`.

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

Test Plan: Danger GitHub action is executed correctly.

Reviewed By: cortinico

Differential Revision: D38571718

Pulled By: cipolleschi

fbshipit-source-id: 51168098b4f910f6fefd2872f917e12daad1ec4c
2022-08-10 04:23:21 -07:00
Riccardo Cipolleschi cb02a6e305 Simplify TurboModule setup (#34373)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34373

By introducing a RCTAppDelegate base class, we can simplify the migration step to supports TM

## Changelog
[iOS][Changed] - Simplified migration steps for TM

Reviewed By: cortinico

Differential Revision: D38509891

fbshipit-source-id: 716c1e668a05ecbd9c679558889564780816e491
2022-08-10 03:25:45 -07:00
Sam Zhou e509f96baf Replace `experimental.env_mode=resolved` with `inference_mode=constrain_writes`
Summary: Changelog: [internal]

Reviewed By: panagosg7

Differential Revision: D38555080

fbshipit-source-id: 67e0de5d8be7d8ab01a85a06cd5c5ce0b3384e61
2022-08-09 19:05:03 -07:00
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