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

25169 Коммитов

Автор SHA1 Сообщение Дата
Christoph Purrer 8b174a57c8 Possible fix for convertIdToFollyDynamic crash in RCTBaseTextInputView and RCTEventDispatcher
Summary:
A crash encountered in react-native-macOS is very similar to one fixed by https://github.com/microsoft/react-native-macos/pull/489#discussion_r451789471 (see discussion), and it's possible this `replacement` string also suffers from sharing the same backing store as the attributed string (maybe only when the range encompasses the entire string?) and therefore should be copied as well.

Changelog:
[iOS][Fixed] - Possible fix for convertIdToFollyDynamic crash in RCTBaseTextInputView and RCTEventDispatcher

Reviewed By: sammy-SC

Differential Revision: D38064551

fbshipit-source-id: 9c15f2a980155ab3cbb3fde79fcb93b24ee2091a
2022-07-25 18:14:46 -07:00
David Vacca 4cbd263173 Un-deprecate DisplayMetrics.getWindowDisplayMetrics() method
Summary:
The purpose of this diff is to un-deprecate the method DisplayMetrics.getWindowDisplayMetrics().

As React Native is used in devices with multiple screens and displays, we need to provide a non-deprecated way to access display metrics (e.g. screen density) for the window that's used to render react native views.

This diff doesn't make any change in behavior, but it un-deprecates the API

changelog: [Android][Added] Un-deprecate DisplayMetrics.getWindowDisplayMetrics() method

Reviewed By: javache

Differential Revision: D37871954

fbshipit-source-id: d8eb97cfae096f2f62ed1389a6de17a892a46b43
2022-07-25 17:48:14 -07:00
Christoph Purrer 7db6c080f5 Fix exception thrown by [RCTTextView description] on macOS
Summary:
This method assumes a semicolon existed before the closing bracket (`>`), but only does on iOS. This instead puts the content before the closing bracket, which is always there on both platforms.

Changelog:
[macOS][Fixed] - Fix exception thrown by [RCTTextView description] on macOS

Reviewed By: sammy-SC

Differential Revision: D38074642

fbshipit-source-id: f46d15c2bf2d966d1c1430568f083e4d501d4b40
2022-07-25 17:17:11 -07:00
Harold Pratt e7a8d21df5 Rewrite CompactValue to avoid undefined behavior from the use of a union for type-punning (#1154)
Summary:
C++ does not, pedantically, allow the use of unions for type-punning in the way that C does. Most compilers, in practice, do support it; however, recent versions of MSVC appear to have a bug that cause bad code to be generated due to this U.B. (see: https://developercommunity.visualstudio.com/t/Bad-code-generated-for-std::isnan-compil/10082631). This led to a series of issues in the react-native-windows project, see:
* https://github.com/microsoft/react-native-windows/issues/4122
* https://github.com/microsoft/react-native-windows/issues/8675

In C++20, the `<bit>` header and `bit_cast` function provide a pleasant API for type-punning. Since C++20 is not universally available, if the feature-test macro for `bit_cast` is not defined, memcpy is used instead.

X-link: https://github.com/facebook/yoga/pull/1154

Reviewed By: Andrey-Mishanin

Differential Revision: D38082048

Pulled By: rozele

fbshipit-source-id: a5da08cfb7d4296c725fb44871c55dbb12dc71e5
2022-07-25 15:35:25 -07:00
Lorenzo Sciandra 246c74724b add 0.69.3 changelog (#34270)
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.69.3

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

Test Plan: N/A

Reviewed By: lunaleaps

Differential Revision: D38116297

Pulled By: dmitryrykun

fbshipit-source-id: 962e34b4cfd58947cf6d95ae05affda7b9271716
2022-07-25 13:19:01 -07:00
Danilo Bürger 653a19a8cd Allow preferred Alert button regardless of the style (#34253)
Summary:
See https://github.com/facebook/react-native/pull/32538 for the discussion

cc robbie-c

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

[iOS] [Fixed] - Allow preferred Alert button regardless of the style

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

Test Plan: Same test plan as PR mentioned above

Reviewed By: lunaleaps

Differential Revision: D38112619

Pulled By: cipolleschi

fbshipit-source-id: 2ac4fc6226a859e69f0df27913898effa5e092eb
2022-07-25 10:19:06 -07:00
Chatura Atapattu a70354df12 Apply lint updates from buildifier in xplat
Summary:
In D37873933, we update the buildifier binaries, which apply some minor changes to existing lint. Specifically, entries are now properly sorted.

Update the files in xplat such that updating buildifier does not cause lint changes in users diffs.

drop-conflicts
allow_many_files
#nocancel
#forcetdhashing

(Note: this ignores all push blocking failures!)

Reviewed By: d16r

Differential Revision: D37873936

fbshipit-source-id: f31d9c50d64ae99f99298977b471bf13e7ed5262
2022-07-24 13:46:21 -07:00
Michael Sokolnicki a67360b0f3 Remove MaskedViewIOS from react-native-github
Summary:
Remove MaskedViewIOS from react-native-github, update deprecation warnings, rebuild CocoaPods.

Changelog:
[General][Removed] - Remove MaskedViewIOS

Reviewed By: lunaleaps

Differential Revision: D37860775

fbshipit-source-id: 963b4b9891eecf5610cfad1e93ac8bf83f29f521
2022-07-22 17:07:26 -07:00
Robbie Coomber 000bbe8013 Add support for "preferred" AlertButton (#32538)
Summary:
Currently, with the Alert API on iOS, the only way to bold one of the buttons is by setting the style to "cancel". This has the side-effect of moving it to the left. The underlying UIKit API has a way of setting a "preferred" button, which does not have this negative side-effect, so this PR wires this up.

See preferredAction on UIAlertController https://developer.apple.com/documentation/uikit/uialertcontroller/

Docs PR: https://github.com/facebook/react-native-website/pull/2839

## Changelog

[iOS] [Added] - Support setting an Alert button as "preferred", to emphasize it without needing to set it as a "cancel" button.

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

Test Plan:
I ran the RNTesterPods app and added an example. It has a button styled with "preferred" and another with "cancel", to demonstrate that the "preferred" button takes emphasis over the "cancel" button.

![Simulator Screen Shot - iPhone 11 - 2021-11-04 at 09 48 35](https://user-images.githubusercontent.com/2056078/140292801-df880c43-c330-40df-b8e4-c1476c1645d6.png)

Luna:
* Also tested this on Catalyst
{F754959632}

Reviewed By: sammy-SC

Differential Revision: D34357811

Pulled By: lunaleaps

fbshipit-source-id: 3d860702c49cb219f950904ae0b9fabef03b5588
2022-07-22 15:41:32 -07:00
Chatura Atapattu ee4ce2df2f Use an SDKRoot based Foundation framework
Summary:
When building `igios-no-extensions` with buck2 on linux, we the following analysis error:

```
When running analysis for `fbsource//fbobjc/Apps/Instagram/Instagram:InstagramNoExtensions (fbsource//tools/build_defs/config/platform/apple:Instagram-125ae32099392ce8)`

Caused by:
    0: When running analysis for `fbsource//fbobjc/Apps/Instagram/Instagram:InstagramARVRFrameworkDylibFramework (fbsource//tools/build_defs/config/platform/apple:Instagram-125ae32099392ce8)`
    1: When running analysis for `fbsource//fbobjc/Apps/Instagram/Instagram:InstagramDependencyPoolForLinkGroupsFramework (fbsource//tools/build_defs/config/platform/apple:Instagram-125ae32099392ce8)`
    2: When running analysis for `fbsource//fbobjc/Libraries/FBReactKit:RCTNetInfo (fbsource//tools/build_defs/config/platform/apple:Instagram-125ae32099392ce8)`
    3: When running analysis for `fbsource//xplat/js/RKJSModules/Libraries/NetInfo:FBReactNativeNetInfoSpecApple (fbsource//tools/build_defs/config/platform/apple:Instagram-125ae32099392ce8)`
    4: When running analysis for `fbsource//xplat/js/react-native-github:RCTTypeSafety (fbsource//tools/build_defs/config/platform/apple:Instagram-125ae32099392ce8)`
    5: Traceback (most recent call last):
         * fbcode/buck2/prelude/apple/apple_library.bzl:48, in <module>
             constructor_params, swift_providers = apple_library_rule_constructor_params_a...
         * fbcode/buck2/prelude/apple/apple_library.bzl:111, in apple_library_rule_constructor_params_and_swift_providers
             args = [cmd_args(get_framework_search_path_flags(ctx))],
         * fbcode/buck2/prelude/apple/apple_frameworks.bzl:46, in get_framework_search_path_flags
             return _get_framework_search_path_flags(_get_non_sdk_framework_directories(ct...
         * fbcode/buck2/prelude/apple/apple_frameworks.bzl:59, in _get_non_sdk_framework_directories
             return dedupe(filter(None, [_non_sdk_framework_directory(ctx, x) for x in fra...
         * fbcode/buck2/prelude/apple/apple_frameworks.bzl:95, in _non_sdk_framework_directory
             expanded_framework_path = _expand_sdk_framework_path(ctx, framework_path)
         * fbcode/buck2/prelude/apple/apple_frameworks.bzl:81, in _expand_sdk_framework_path
             expanded_path = expanded_path.replace(path_variable, path_value)
       error: Type of parameter `new` doesn't match, expected `str`, actual `artifact`
         --> fbcode/buck2/prelude/apple/apple_frameworks.bzl:81:25
          |
       81 |         expanded_path = expanded_path.replace(path_variable, path_value)
          |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          |
```

This is related to running on Linux with buck2 and how we get the framework paths for linux/pika toolchains for non SDK frameworks. However, Foundation is an SDK framework, and updating it to be as such allows us to build, both with buck1 and buck2.

Differential Revision: D38080376

fbshipit-source-id: b226c3511e3312d0bf0ddb792dbe4ca99768cad1
2022-07-22 15:19:12 -07:00
Tony Du 1e3cb91707 Allow multiline TextInputs be submittable without blurring (#33653)
Summary:
For multiline TextInputs, it's possible to send the submit event when pressing the return key only with `blurOnSubmit`. However, there's currently no way to do so without blurring the input and dismissing the keyboard. This problem is apparent when we want to use a TextInput to span multiple lines but still have it be submittable (but not blurrable), like one might want for a TODO list.

![multiline-momentary-blur](https://user-images.githubusercontent.com/22553678/163596940-aae779f5-4d2a-4425-8ed0-e4aa77b90699.gif)

## 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] [Added] - Add `returnKeyAction` prop to `TextInput` component
[General] [Deprecated] - Remove usages of `blurOnSubmit` in native code and convert `blurOnSubmit` to `returnKeyAction` in the JavaScript conversion layer

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

Test Plan:
Verified old usages of combinations of `blurOnSubmit` and `multiline` matched previous behavior and that the new `returnKeyAction` prop behaves as expected.

| Android | iOS |
| --- | -- |
| ![android-returnkeyaction-test](https://user-images.githubusercontent.com/22553678/163597864-2e306f98-7b6e-4ddf-8a35-625d397d3dce.gif) | ![ios-returnkeyaction-test](https://user-images.githubusercontent.com/22553678/163598407-9e059f74-3549-4b46-8e03-c19bfaa6dd3d.gif)  |

With the changes, the TODO list example from before now looks like this:

![multiline-no-momentary-blur](https://user-images.githubusercontent.com/22553678/163598810-f3a71d62-5514-486e-bf6a-79169fe86378.gif)

Reviewed By: yungsters

Differential Revision: D35735249

Pulled By: makovkastar

fbshipit-source-id: 1f2237a2a5e11dd141165d7568c91c9824bd6f25
2022-07-22 13:08:45 -07:00
Riccardo Cipolleschi ccdf9ac985 Reduce flakiness of CI (#34235)
Summary:
How the Hermes cache worked had a concurrency issue. It used to work by asking the Hermes repository for the latest commit and using that commit as cache key to try and retrieve a built version of Hermes to avoid to compile it more than once.

The problem happened when the `build_hermes_macos` was building Hermes using a commit A.
While building, another PR could be merged into `hermes:main`, creating commit B.
When this happened, the tasks `test_ios` and `test_ios_rntester`would try to retrieve a cached version of Hermes using commit B. That version did not exist because Hermes was created using commit A, and the job would either fail or trying to build Hermes from source, ending up taking a lot of time.

This PR attaches the `.hermes-cache-key-file` to the workspace and restores it in the other jobs, making sure that the same cache key is used in all three jobs.

## 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] - Attach the `.hermes-cache-key-file` to the workspace to avoid race conditions for new PR landing on Hermes and changing the head commit between the time Hermes is built and the time it has to be consumed.

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

Test Plan:
Tested manually, looking at the messages in CI.

**build_hermes_macos**
<img width="881" alt="Screenshot 2022-07-21 at 15 40 02" src="https://user-images.githubusercontent.com/11162307/180241834-776f2291-63bb-4bb2-8837-14434b50fe61.png">

**test_ios_rntester**: notice that the `echo` is not executed, meaning that the `if` does not evaluate to true and, therefore, the file has been correctly attached.
<img width="956" alt="Screenshot 2022-07-21 at 15 40 52" src="https://user-images.githubusercontent.com/11162307/180242004-d9db0336-18d3-4321-a997-b538baa6beee.png">

**test_ios**: notice that the `echo` is not executed, meaning that the `if` does not evaluate to true and, therefore, the file has been correctly attached.
<img width="900" alt="Screenshot 2022-07-21 at 15 46 33" src="https://user-images.githubusercontent.com/11162307/180243359-79de5c7a-d2f0-4331-90c6-5bd2c0b5e1ac.png">

Reviewed By: cortinico

Differential Revision: D38037386

Pulled By: cipolleschi

fbshipit-source-id: 4db4f7c478e1afb2e4a18ba3d3f70896ed41d235
2022-07-22 05:56:02 -07:00
LeoTM 77752fc403 Update Podfile for `PRODUCTION=1 pod install` (#34234)
Summary:
### Mentioned
- pr[main]: https://github.com/facebook/react-native/pull/33882
- discussion: https://github.com/reactwg/react-native-releases/discussions/21#discussioncomment-2945972
- pr[0.69-stable]: https://github.com/facebook/react-native/pull/34098

Close: https://github.com/facebook/react-native/issues/33764

Saw the issue ago couple wks too: https://github.com/leotm/react-native-template-new-architecture/issues/757
Fixed similarly: https://github.com/leotm/react-native-template-new-architecture/pull/791

## Changelog

[iOS] [Changed] - Update Podfile to allow `PRODUCTION=1 pod install`

[CATEGORY] [TYPE] - Message

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

Test Plan: Everything builds and runs as expected

Reviewed By: cortinico

Differential Revision: D38029117

Pulled By: cipolleschi

fbshipit-source-id: bdb58200a999cb66f1043a2feb670f9037c8e463
2022-07-22 02:28:07 -07:00
Riccardo Cipolleschi 4b51207735 Simplify logic to choose if we need to build hermes from source or not. (#34232)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34232

This diff simplify the logic to decide whether we want to build hermes from source or not.

The requirement we have is that we don't want our users to build hermes.
So, we don't want to build hermes when there is a precompiled tarball available, while we want to build hermes in CI.

## Changelog

[General][Changed] - Build hermes when in CI and not when there is a tarball

Reviewed By: cortinico

Differential Revision: D37999748

fbshipit-source-id: 7d9cab51c37fb47db216055c057a22081e10df07
2022-07-22 02:13:47 -07:00
Sam Zhou 087f142cb7 Release resolved-env
Summary: Changelog: [internal]

Reviewed By: bradzacher

Differential Revision: D38054157

fbshipit-source-id: 6f859e45623168e5b17b5303adb5955b74fc3641
2022-07-21 21:17:16 -07:00
Sim Sun 1237952d07 Bump SoLoader version to 0.10.4
Summary:
## Changelog

[Android] [Changed] - Bump Soloader to 0.10.4

Reviewed By: cortinico

Differential Revision: D37988583

fbshipit-source-id: 6d2a423f39c2c4077bad29406e8d9fd67141045b
2022-07-21 16:43:01 -07:00
Pieter Vanderwerff 8fbcb0b6a3 Deploy 0.183.0 to xplat
Summary: Changelog: [Internal]

Reviewed By: suvarshibhadra, SamChou19815

Differential Revision: D38020761

fbshipit-source-id: 7e55f270e9fcf6f7991946432cf63aff6ee4d5b2
2022-07-21 13:08:33 -07:00
Daniel Andersson 8cd63de7ea Minor improvements to NativeState
Summary:
Minor improvements to NativeState implementation and test. Does not change the API.

Changelog:
[Internal][Changed] - Minor improvements to jsi::NativeState

Reviewed By: neildhar

Differential Revision: D37961515

fbshipit-source-id: b87dcf2458ace883c784f3127a13f5a6c296d4a2
2022-07-21 12:43:30 -07:00
Pieter Vanderwerff a333eb2ac5 Deploy suppressions ahead of 0.183.0 to xplat
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D38020751

fbshipit-source-id: d32b15429605d2c42195d98de9e5455926f0022b
2022-07-21 12:31:37 -07:00
Dark Knight b9cf207db9 Revert D37912783: Multisect successfully blamed D37912783 for test or build failures
Summary:
changelog: [internal]

This diff is reverting D37912783 (2b57b749fb)
Depends on D38035753
D37912783 (2b57b749fb) has been identified to be causing the following test or build failures:
Tests affected:
- https://www.internalfb.com/intern/test/281475006604971/

Here's the Multisect link:
https://www.internalfb.com/intern/testinfra/multisect/1077515
Here are the tasks that are relevant to this breakage:
T93091116: 1 test started failing for oncall messenger_kids_www_rn 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.

Reviewed By: sammy-SC

Differential Revision: D38035761

fbshipit-source-id: 70034af3275b7b69c0b50f12a377182d4f23e669
2022-07-21 12:21:48 -07:00
Zihan Chen (MSFT) 33d1291e1a Support TypeScript array types for turbo module (component only) (#34216)
Summary:
Turbo module codegen for component parse `readonly T[]` and `readonly Object[][]` incorrectly. In this change, it is fixed, with necessary test cases added.

## Changelog

[General] [Added] - Support TypeScript array types for turbo module (component only)

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

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

Reviewed By: sammy-SC

Differential Revision: D37953004

Pulled By: cipolleschi

fbshipit-source-id: b71ea35eb9c4bd5dc41130f1dcf9201704ec298e
2022-07-21 06:38:59 -07:00
Samuel Susla 2013a203fc Delete mobile config react_fabric:finalize_updates_on_synchronous_update_view_ios
Summary:
changelog: [internal]

This was used as a kill switch, it has been in place for over 4 months, let's get rid of it.

Reviewed By: mdvacca

Differential Revision: D37921377

fbshipit-source-id: 594586033694766e13d0f2ab2bcd73b28ba180a9
2022-07-21 06:08:23 -07:00
Eric Edouard 8993ffc82e Added border curve style prop ("Squircle" effect - iOS only) (#33783)
Summary:
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->
NOTE: PR is based on https://github.com/facebook/react-native/pull/32017 which went stale for quite a long time but can now safely be closed

![](https://preview.redd.it/nuvl4746ys471.png?width=960&crop=smart&auto=webp&s=084a517a645364ac246b70b7fa8e0f2470cc7af3)

Since iOS 13+, it is possible to change the corner curve property on iOS in order to smoothen border radius and make it more "rounded" (also called "squircle")
Here's an [article](https://medium.com/arthurofbabylon/a-smooth-corner-radius-in-ios-54b80aa2d372) explaining in details what it is.
This property is also built in figma, but currently there is no way to implement this directly with react-native despite it being available natively on iOS.

Many open source react-native libraries were created in order to simulate this behaviour:
[react-native-super-ellipse-mask](https://github.com/everdrone/react-native-super-ellipse-mask)
[react-native-squircle-view](https://github.com/everdrone/react-native-squircle-view)
[react-native-figma-squircle](https://github.com/tienphaw/react-native-figma-squircle)

But they rely on creating an SVG shape with the smoothed corners and masking the view behind. This makes it not very performant (flickering on mounting was a common side-effect)

This PR aims at implementing the property natively.

PR for the docs update: https://github.com/facebook/react-native-website/pull/2785

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

[iOS] [Added] - Added `borderCurve` style prop for smooth border radius (squircle effect)

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

Test Plan:
We used the RNTester app and added an example with `cornerCurve ` set to `'continuous'` (only on iOS).

As the difference is quite subtle, we also made some more tests to better illustrate the difference (these are not in the RN-tester app):

![IMG_0810](https://user-images.githubusercontent.com/19872411/133893536-26207c53-aade-4583-9eef-7a1739b6907b.PNG)

We overlapped two views with `position: absolute`, the one in the background has a red background and has `cornerRadius` set to `false`, and the one in the foreground is set to `true`. We can clearly see where the borders differs on the corners.

Reviewed By: sammy-SC

Differential Revision: D37883631

Pulled By: cipolleschi

fbshipit-source-id: 09f06de9628fa326323eba63875de30102c4a59e
2022-07-21 04:11:30 -07:00
Samuel Susla 64528e5faa Fix measure when view is inverted
Summary:
changelog: [internal]

Vertical and horizontal inversion was not taken into account in `computeRelativeLayoutMetrics`. To fix it, we precompute frames to include inversions.

Reviewed By: mdvacca

Differential Revision: D37994809

fbshipit-source-id: 043e6f19b6fa577f61fa3c739ce2d751ef973cc3
2022-07-21 03:34:56 -07:00
Luna Wei 143a0f74b8 Fix (Pointer|Touch)Events not firing after drag and scroll for ScrollView and HorizontalScrollView
Summary:
Changelog: [Android][Fixed] - Fix such that when the scrollviews call `onChildStartedNativeGesture`, they appropriately call `onChildEndedNativeGesture` to unlock the native gesture such that `JSTouchDispatcher` or `JSPointerDispatcher` will continue to emit events.

### How did we find this issue?
As React Native is adding pointer event support for different input types, we noticed after pressing and dragging on a ScrollView, hover events would not fire.

### Why was this not an issue before?
This was always an issue -- it was just that `JSTouchDispatcher` worked its way around it by explicitly setting `mChildIsHandlingNativeGesture = false` on a `ACTION_DOWN` event, [code pointer](https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.java#L76). Similarly, `JSPointerDispatcher` [copied this logic](https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSPointerDispatcher.java#L106).

With new hover support in `JSPointerDispatcher` no similar workaround was put in (or even a good place to insert).

### What's next?
* As a follow-up, we should look at removing this workaround (at least for `JSPointerDispatcher`)
* By searching for usages of where we `notifyNativeGestureStarted`, it looks like `ReactDrawerLayout` and `ReactSwipeRefreshLayout` both do and don't call the symmetric `notifyNativeGestureEnded`. This will likely be an issue in the future (or maybe if we remove the workaround)

Reviewed By: mdvacca

Differential Revision: D37977982

fbshipit-source-id: 0d18767f4debbf24cfb24b54df1310f6f96a0d03
2022-07-20 17:58:01 -07:00
Graham Mendick 27fe6f1079 Fix contentInsetAdjustmentBehavior set to automatic on ScrollView in the new architecture (#34217)
Summary:
Fixes https://github.com/facebook/react-native/issues/34165 and [Large title fails](https://github.com/reactwg/react-native-new-architecture/discussions/43) on the new React Native architecture.

There are problems with setting `contentInsetAdjustmentBehavior` to `automatic` on the `ScrollView` component in the new React Native architecture. The `automatic` setting matters to navigation libraries (like [my Navigation router](https://github.com/grahammendick/navigation)) because it stops the `ScrollView` from overlapping the `UINavigationBar`. The setting also powers important native features like large titles and search bars on iOS.

The `automatic` setting works fine on the old architecture. It doesn’t work on the new architecture because React Native is recycling views. In https://github.com/facebook/react-native/issues/34165 and [Large title fails](https://github.com/reactwg/react-native-new-architecture/discussions/43) there are videos comparing the setting in the old and the new architecture.

## Changelog

[iOS] [Fixed] - Fix `contentInsetAdjustmentBehavior` set to `automatic` on `ScrollView` in the new architecture

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

Test Plan:
I checked the fix in both the repros in https://github.com/facebook/react-native/issues/34165 and [Large title fails](https://github.com/reactwg/react-native-new-architecture/discussions/43). Here is a video of the fix running with large titles in the new architecture.

https://user-images.githubusercontent.com/1761227/179612188-162b896b-82c5-45de-bb5a-ba80f452fbee.mov

Reviewed By: sammy-SC

Differential Revision: D37952506

Pulled By: cipolleschi

fbshipit-source-id: 6cff6c85aa33b579405fe34a9e36c8630f4c24bd
2022-07-20 13:51:28 -07:00
Riccardo Cipolleschi 9923ac1b52 Properly cache sdk/hermes to improve build times (#34209)
Summary:
Currently, iOS jobs takes up to 2 hours to run.
This is firstly due to Hermes being rebuilt at least 3 times during the CI process.

One issue I discovered is that the `Hermes-SDK-Cache-Key` was depending on the `{{ .Environment.CIRCLE_JOB }}` which is different from all the jobs (`test_ios_rntester`, `test_ios` and `build_hermes_macos`) which forced hermes to be build 3 times.

Another issue I found was that we were not caching hermes at all the first time we build it, during the `build_hermes_macos` step.

To ensure that `test_rn_tester` and `test_ios` has a valid version of Hermes from the cache, they now depend on the `build_hermes_macos` job

## Changelog

[iOS] [Changed] - Add caching for Hermes when we build it, updated the hermes_sdk_cache_key, update job dependencies

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

Test Plan:
CircleCI must be green and take less than 2 hrs
**Before**
{F753846143}

**After**
{F753846214}

Reviewed By: cortinico

Differential Revision: D37959500

Pulled By: cipolleschi

fbshipit-source-id: c3435717bfa71e7488326894cd1ad7638044004e
2022-07-20 09:12:47 -07:00
Riccardo Cipolleschi 361d939afd Build Hermes in CI also when it is against stable branch (#34224)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34224

This Diff is a copy of this [PR](https://github.com/facebook/react-native/pull/34228) that we have against 0.69-stable.

This Diff makes sure we can build Hermes also in PR that are created against a stable branch

## Changelog

[General] [Changed] - Make sure we can build Hermes from source when PR are opened agains -stable

Reviewed By: cortinico

Differential Revision: D37961092

fbshipit-source-id: 65577fcc69f0e2a68377cbd46e3bd3a6af24e7c3
2022-07-20 08:53:38 -07:00
Lorenzo Sciandra 3188727793 add 0.69.2 changelog (#34227)
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.69.2

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

Test Plan: N/A

Reviewed By: cipolleschi

Differential Revision: D37993752

Pulled By: cortinico

fbshipit-source-id: 339f2b6bf42547360d0bca9984e2a3fd45299cc0
2022-07-20 07:08:57 -07:00
Nicola Corti a22f30d2ce Fix missing import on New Architecture build script in template (#34230)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34230

The OS static class is accessed inside app/build.gradle but the import is on
the top level Gradle file. This is causing an app created from template to fail
building.

This is needed to be cherry-picked on the 0.70-stable branch.

Changelog:
[Android] [Fixed] - Fix missing import on New Architecture build script in template

Reviewed By: cipolleschi

Differential Revision: D37995897

fbshipit-source-id: aad22100cee004944c4fa0841f5ef0dfc6ea1e94
2022-07-20 07:08:33 -07:00
Dmitry Minkovsky 698b14789c Use readlink instead of realpath in packager.sh (#34145)
Summary:
`realpath` is not available on macOS 12.2 and 12.4. Because of this, the following error is shown when launching an RN app with XCode (which calls `packager.sh` via `launchPackage.command`):

<img width="1123" alt="Screen Shot 2022-07-06 at 1 26 08 PM" src="https://user-images.githubusercontent.com/218725/177608681-0cf4dc5a-b71c-4ddc-8fbe-4d37b2d3e2cb.png">

I am running Bash 5 but realpath is also not available with zsh.

This issue was introduced in bb8ddd6c12 (diff-6ca7c99209bdf630550bb9e2946ce8611948c5a23b32ffb25028792ef5d48b8d), which interestingly did not change `launchPackage.command`. There's a recent comment on that commit that confirms this issue:

bb8ddd6c12 (commitcomment-77818917)

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

[iOS] [Fixed] - Use readlink instead of realpath in packager.sh

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

Reviewed By: cipolleschi

Differential Revision: D37669417

Pulled By: cortinico

fbshipit-source-id: bcc4cb6e886df059e6598ee811226e3cd1a6ae14
2022-07-20 07:06:18 -07:00
Samuel Susla e1d17c8138 delete mobile config react_native_new_architecture:suspend_before_app_termination
Summary:
changelog: [internal]

Remove shipped mobile config

Reviewed By: mdvacca

Differential Revision: D37913252

fbshipit-source-id: f1557e2b93b7f0410385e4dec41ec354e46d04f1
2022-07-20 05:47:26 -07:00
Samuel Susla d0b1d49e9a Delete mobile config react_native_new_architecture:enable_call_immediates_ios
Summary:
changelog: [internal]

Remove shipped mobile config

Reviewed By: cortinico

Differential Revision: D37913209

fbshipit-source-id: 1a5877360e12e329342d4c8efc0a10bff24abcaa
2022-07-20 04:01:36 -07:00
Samuel Susla 2b57b749fb Remove redundant Android runtime scheduler mobile config flags
Summary:
changelog: [internal]

Remove features flags for enabling RuntimeScheduler and RuntimeScheduler+TM to simplify setup.

Reviewed By: mdvacca

Differential Revision: D37912783

fbshipit-source-id: 1a24720dec3cf06067bf523d72f0919731a91b72
2022-07-20 04:01:36 -07:00
Xin Chen 8a33b75f55 getModule API may return null module
Summary:
The native module might be null, and that should not be an exception thrown by the subclassed method.

Changelog:
[Android][Internal] - Mark getModule API to be nullable

Reviewed By: mdvacca, makovkastar

Differential Revision: D37900294

fbshipit-source-id: a4ecc9804b95bf0512554e96985f272b435e33b2
2022-07-19 22:30:29 -07:00
Ruslan Latypov b66db7a840 fix more imports
Summary:
There are many files across fbobjc relying on -include_pch and therefore they miss Foundation.h and UIKit.h includes. This diff was generated by a codemod and fixes these missing includes.
More details on the missing imports https://fb.workplace.com/groups/929548250966094/permalink/981237982463787/

Changelog: [Internal]

Reviewed By: yannickl

Differential Revision: D37282740

fbshipit-source-id: 0f419025b3cf2f811e96ff464cb19e8e5a25aa09
2022-07-19 12:53:11 -07:00
Mike Hardy b9adf2db20 deps(android): bump soloader to 0.10.4 (#34213)
Summary:
soloader 0.10.3 will apparently cause crashes in instrumented tests, 0.10.4 appears to fix these crashes

Related: https://github.com/facebook/SoLoader/issues/94
Related: https://github.com/reactwg/react-native-releases/discussions/26#discussioncomment-3166381

## Changelog

[Android] [Changed] - Bump Soloader to 0.10.4

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

Test Plan: This is hard to test since it's in the AAR etc., I'm hoping CI is sufficient as the previous soloader bump PR went through similarly

Reviewed By: cipolleschi

Differential Revision: D37960320

Pulled By: cortinico

fbshipit-source-id: ce1611d7b30df737c8525a70839b5491a6585c75
2022-07-19 11:28:25 -07:00
Danilo Bürger af3dfbaa47 Move cocoapods cli native_modules require from template to rn scripts (#34215)
Summary:
This resolves issues where the node_modules structure is not hoisted (like with pnpm). Since the template does not directly depend on the cli, it doesn't exist in the pnpm node_modules root. Moving it to the rn scripts makes sure that the relative require starts in the correct directory for both hoisted and pnpm structures.

## Changelog

[iOS] [Fixed] - Fix cocoapods cli native_modules require for pnpm node_modules

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

Test Plan:
1. react-native init
2. rm -rf node_modules
3. pnpm i
4. bundle install
5. bundle exec pod install --project-directory=ios

This should succeed. Without the patch, it will fail with

```
[!] Invalid `Podfile` file: cannot load such file -- /.../node_modules/react-native-community/cli-platform-ios/native_modules.

 #  from /.../ios/Podfile:2
 #  -------------------------------------------
 #  require_relative '../node_modules/react-native/scripts/react_native_pods'
 >  require_relative '../node_modules/react-native-community/cli-platform-ios/native_modules'
 #
 #  -------------------------------------------
```

Reviewed By: cortinico

Differential Revision: D37959152

Pulled By: cipolleschi

fbshipit-source-id: 7fa9af4a8c153cfd38360f57eca415a8c252dbd5
2022-07-19 09:11:08 -07:00
Lorenzo Sciandra 46a9edc854 Hermes pod: change logic to use the hermes tag to set the pod source correctly (#34221)
Summary:
This fix is necessarly to ensure that when working on the codebase in the `0.XX-stable` branches (ex. when you are working on a release) the Hermes podfile is correctly set against the right commit for that branch, and not latest commit from main branch of Hermes repo.

I didn't add a check to verify that the file `.hermesversion` exists because I think it's safe to assume that the file and the tag correctly exists when this step (doing a pod install on the `0.XX-stable` branch).

Once this is merged, we need to cherry pick it on both the 0.69 and 0.70 branches

## Changelog

[iOS] [Fixed] - Hermes pod: change logic to use the hermes tag to set the pod source correctly

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

Test Plan:
* git clone the repo
* checkout 0.69-stable branch
* follow https://reactnative.dev/contributing/release-testing
* without this commit, when testing RNTester + iOS + Hermes the app will insta-crash on opening
* with it, the app gets build successfully

Reviewed By: cortinico

Differential Revision: D37957660

Pulled By: cipolleschi

fbshipit-source-id: 4e50099ed712b1ad8e6439822e3f530142982c1b
2022-07-19 07:34:18 -07:00
Antoine Doubovetzky 1d997ce6d6 (PULL_REQUEST_TEMPLATE) update link to changelog documentation (#34206)
Summary:
I just opened another PR and noticed the changelog page in the wiki redirected to the react native documentation.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Changed] - Update link to changelog documentation in PULL_REQUEST_TEMPLATE

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

Reviewed By: NickGerleman

Differential Revision: D37920424

Pulled By: cortinico

fbshipit-source-id: f4e47172a13fe5b42c29e320d34816b490a14b6c
2022-07-19 05:47:17 -07:00
Riccardo Cipolleschi 79a37e5a88 Destructure use_react_native! parameters and doc (#34177)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34177

This Diff destructures the parameters of the use_react_native! function. It does that in a backward compatible way, so we there should be no disruptions.

It also adds documentation to the various public method we want to export to our users.

## Changelog
[iOS][Changed] - Destruct use_reactnative parameters and ad ddocumentation

Reviewed By: cortinico

Differential Revision: D37787365

fbshipit-source-id: 27f9030db2e8c6c66b9548b4c1287eb8165ae5fc
2022-07-19 00:03:23 -07:00
Riccardo Cipolleschi 7d069b2583 Extract Codegen code from the react_native_pods to its own file (#34176)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34176

It extracts the code related to the codegen from the main `react_native_pods` script to a dedicated file, adding also tests.

## Changelog

[iOS][Changed] - Move codegen in separate files

Reviewed By: cortinico

Differential Revision: D37755818

fbshipit-source-id: 99760d1def26ddbf065fdd234e0d183c2795513c
2022-07-19 00:03:23 -07:00
Nick Gerleman 089c9a5c9c Fix `AttributedString` comparison logic for TextInput state updates
Summary:
D37801394 (51f49ca998) attempted to fix an issue of TextInput values being dropped when an uncontrolled component is restyled, and a defaultValue is present. I had missed quite a bit of functionality, where TextInput may have child Text elements, which the native side flattens into a single AttributedString. `lastNativeValue` includes a lossy version of the flattened string  produced from the child fragments, so sending it along with the children led to duplicating of the current input on each edit, and things blow up.

With some experimentation, I found that the text-loss behavior only happens on Fabric, and is triggered by a state update rather than my original assumption of the view manager command in the `useLayoutEffect` hook. `AndroidTextInputShadowNode` will compare the current and previous flattened strings, to intentionally allow the native value to drift from the React tree if the React tree hasn't changed. This `AttributedString` comparison includes layout metrics as of D20151505 (061f54e890) meaning a restyle may cause a state update, and clear the text.

I do not have full understanding of the flow of state updates to layout, or the underlying issue that led to the equality check including layout information (since TextMeasurementCache seems to explicitly compare LayoutMetrics). D18894538 (254ebab1d2) used a solution of sending a no-op state update to avoid updating text for placeholders, when the Attributed strings are equal (though as of now this code is never reached, since we return earlier on AttributedString equality). I co-opted this mechanism, to avoid sending text updates if the text content and attributes of the AttributedString has not changed, disregarding any layout information. This is how the comparison worked at the time of the diff.

I also updated the fragment hashing function to include layout metrics, since it was added to be part of the equality check, and is itself hashable.

Changelog:
[Android][Fixed] - Fix `AttributedString` comparison logic for TextInput state updates

Reviewed By: sammy-SC

Differential Revision: D37902643

fbshipit-source-id: c0f8e3112feb19bd0ee62b37bdadeb237a9f725e
2022-07-18 18:20:22 -07:00
Ramanpreet Nara b708ee9b4e Log if bridgeless mode is enabled, when JS Module call fails
Summary:
Log whether bridgeless mode is enabled or not when calling into a JavaScript module method fails.

We are seeing a surge of these crashes in MessageQueue.js bridgeless mode. This temporary log will help us drill down into the issue.

Changelog: [Internal]

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

This should not mess with the sitevar overrides.
These are the two diffs where we mapped the venice and bridge errors to the same mid: D36649249, D36649249.

Reviewed By: fkgozali

Differential Revision: D37898744

fbshipit-source-id: 0ab337c8c0d73bd70c4756a16b8ece8ba8730c47
2022-07-18 17:54:37 -07:00
Daniel Andersson 6179233965 Add API for setting/getting native state
Summary:
Add API for setting/getting native state.

When present, the internal NativeState property of an object always stores a NativeState with a pointer to a heap-allocated shared_ptr + a finalizer that simply `delete`s it.

Changelog:
[Internal][Added] - JSI API for setting/getting native state on a JS object

Reviewed By: jpporto

Differential Revision: D36499239

fbshipit-source-id: a1ff1905811db1aac99ece3f928b81d0abfb342b
2022-07-18 15:29:50 -07:00
Paige Sun 639daf8641 Minor: Rename AccessibilityInfo.sendAccessibilityEvent_unstable to sendAccessibilityEvent
Summary:
Changelog:
[Internal] Rename AccessibilityInfo.sendAccessibilityEvent_unstable to sendAccessibilityEvent

In Fabric, we want people to use `AccessibilityInfo.sendAccessibilityEvent` instead of `UIManager.sendAccessibilityEvent` for Android. The API is not unstable. There is a test in [AccessibilityExample.js](c940eb0c49/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js (L959)) in RNTester to confirm that it works.

A search for [`AccessibilityInfo.sendAccessibilityEvent_unstable` in Github](https://github.com/search?q=AccessibilityInfo.sendAccessibilityEvent_unstable&type=Code) shows that it's not being used yet, which makes sense because it's an Fabric API. Therefore it's safe to rename it.

Reviewed By: sammy-SC

Differential Revision: D37901006

fbshipit-source-id: 73f35b09ca8f9337f4d66a431f0a3f815da38249
2022-07-18 15:19:53 -07:00
Vincent Riemer 663dd9177e Add the ability for tests to be marked as 'skipped'
Summary:
Changelog: [RNTester][Internal] - Add the ability for platform tests to be marked as skipped

There are some properties/tests in the web platform tests that we don't want to especially priorities (especially if they aren't especially relevant to the specification and just legacy browser compat) so this adds the ability for us to mark these tests as skipped. This is so that we can ensure that our platform tests are "complete" while decreasing the noise and distraction from failing tests that don't really apply to RN.

Reviewed By: lunaleaps

Differential Revision: D37889470

fbshipit-source-id: 6516ac90c242d662518a95cb9ba8ce643f6bb09c
2022-07-18 14:12:25 -07:00
Vincent Riemer 966f800b7c Add key modifier properties to the PointerEvent interface
Summary:
Changelog: [iOS][Internal] - Add key modifier properties to the PointerEvent interface

This diff adds implementations of the `ctrlKey`, `shiftKey`, `altKey`, and `metaKey` properties on the PointerEvent interface for iOS.

Reviewed By: lunaleaps

Differential Revision: D37869377

fbshipit-source-id: b187bae93fbfc97b6ca1d8d9786ad85343484b3d
2022-07-18 14:12:25 -07:00
Brad Zacher f3db6cc527 update to ESLint v8
Summary:
Changelog: [internal]
- Upgrade ESLint version to the latest
- Upgrade ESLint plugin versions to the latest to ensure compatibility
- Switch from eslint-plugin-flowtype to eslint-plugin-ft-flow
- Updates lint suppressions - all `flowtype/` rules to `ft-flow/`

### `flowtype` vs `ft-flow`

`eslint-plugin-flowtype` is well out of date and no-longer maintained. It's been abandoned by its owner. This means it crashes on ESLint v8.
`eslint-plugin-ft-flow` is a fork of the above and is maintained by the same people that own the `flow-typed` project.

Reviewed By: jacdebug

Differential Revision: D37727177

fbshipit-source-id: 516be42f947fec9c886526c182a608b3311c0b50
2022-07-16 01:41:27 -07:00
Zihan Chen (MSFT) 9ecd203eec Accept TypeScript type T | null | undefined as a maybe type of T in turbo module (#34158)
Summary:
According Flow's document, a maybe type of T means `T | null | undefined`, instead of `T | null | void`.
I think keeping TypeScript and Flow being consistent to each other is better.

## 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] [Changed] - Accept TypeScript type `T | null | undefined` as a maybe type of T in turbo module.

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

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

Reviewed By: yungsters

Differential Revision: D37731169

Pulled By: philIip

fbshipit-source-id: b6d9b7e8991f60e12c1004bed5b937b34fb02c47
2022-07-15 20:38:16 -07:00