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

3722 Коммитов

Автор SHA1 Сообщение Дата
Vic 7f061f8651 Refactor: removed duplicated words in comments (#34807)
Summary:
Found and removed duplicates of the word "the" in comments.

## Changelog

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

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

Test Plan: Not applicable.

Reviewed By: yungsters, cipolleschi

Differential Revision: D39880587

fbshipit-source-id: b7277aa70604902929903c31ab69d4c532f2667a
2022-09-28 09:08:27 -07:00
evanbacon 5933b6a3ba Use monospace font for RCTRedBox.mm message (#34780)
Summary:
The format is crunching spaces:

![Simulator Screen Shot - iPhone 14 Pro Max - 2022-09-24 at 16 25 33](https://user-images.githubusercontent.com/9664363/192119593-30d5c82f-9f8c-465d-af29-6914d4111351.png)

Now it preserves the space and makes the error look a little less scary:

![Simulator Screen Shot - iPhone 14 Pro Max - 2022-09-24 at 16 25 02](https://user-images.githubusercontent.com/9664363/192119603-8214a38b-6511-413b-b999-5d2739cd0293.png)

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

[iOS] [Fixed] - RedBox title font by using a monospace font on iOS +13.

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

Test Plan: See pictures. You can repro by applying changes and starting a project with a misc `>` character. The first load triggers the error message.

Reviewed By: cipolleschi

Differential Revision: D39798262

Pulled By: robhogan

fbshipit-source-id: d836e50f3e95865a6482accf4aea5b0e6cf24995
2022-09-27 04:51:52 -07:00
Liam Potter 5e79fa8441 Remove usage of UIApplication.sharedApplication (#34787)
Summary:
Brings in line with rest of code base and avoids running into this error
```
‘sharedApplication’ is unavailable: not available on iOS (App Extension) — Use view controller based solutions where appropriate instead.
```
when `Requires Only App-Extension-Safe-API` is set to Yes.

## Changelog

[iOS] [Fixed] - Update usage of UIApplication.sharedApplication in RCTKeyCommands

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

Test Plan: Setting `Requires Only App-Extension-Safe-API` to Yes before this change means the app will not compile, after the change it does.

Reviewed By: dmytrorykun

Differential Revision: D39812410

Pulled By: cipolleschi

fbshipit-source-id: 78d185ba20301b10609e4a387f000f0cfda55663
2022-09-26 07:13:52 -07:00
Paige Sun 9a253d1864 Back out "Back out "[Venice][iOS] Fix: Install Fabric UIManager before main bundle execution""
Summary:
Changelog: [Internal][Bridgeless][iOS]

# Before diff
Be in Venice > run Metro > run FBiOS > navigate to any RN surface.

 `UIManagerBinding createAndInstallIfNeeded` happens After `ReactInstance loadScript -> evaluateJavaScript`: install Fabric UIManager before main bundle execution

Reviewed By: RSNara

Differential Revision: D39760231

fbshipit-source-id: f17bf02e9b1fb0f9b0ff24c86aa6dc9349c42192
2022-09-23 17:32:49 -07:00
Rubén Norte 30fe6b341b Restore flags to disable Fabric background executor
Summary:
We want to fix the order of execution of layout, layout effects and passive effects in React Native, but the use of the Fabric background executor for layout complicates this (and other things).

This brings back a flag to disable this background thread to do layout synchronously in JavaScript, before the execution of layout effects and passive effects.

This is expected to regress performance on some screens, so we need to address the antipatterns in those screens before shipping this.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D39727131

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

Reviewed By: jkeljo

Differential Revision: D39543862

fbshipit-source-id: 2abe5b3ee883e77336076d88436a1c84139b5a97
2022-09-22 22:52:22 -07:00
Samuel Susla 15dbd9121d Back out "Fix: Install Fabric UIManager before main bundle execution"
Summary:
Original commit changeset: 4491d6de1109

Original Phabricator Diff: D39493654 (447be62909)

changelog: [internal]

Reviewed By: javache

Differential Revision: D39727129

fbshipit-source-id: 412a7fc5e4bf8db26cde7d420e71cf1f314cdc93
2022-09-22 06:36:59 -07:00
Pieter De Baets d9f93d30e0 Disable default clipping in Fabric's SafeAreaView implementation
Summary:
This behaviour diverges from the original SafeAreaView implementation and causes issues when you try to use SafeAreaView in non-root placements (not recommended)

Changelog: [iOS][Internal]

Reviewed By: sammy-SC

Differential Revision: D39497303

fbshipit-source-id: 03bc288557f611bd4a8c16b3a6df8887e89ee9ec
2022-09-21 04:16:43 -07:00
Luna Wei ab5f26bf02 Back out "Fix `Alert` not showing in an app using `UIScene`"
Summary:
Changelog: [Internal] - Revert https://github.com/facebook/react-native/pull/34562

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

Reviewed By: alsun2001

Differential Revision: D39591113

fbshipit-source-id: ba707c11b3fb97eb3a6fee32e57b92403aa8b3d8
2022-09-17 07:05:37 -07:00
Christoph Purrer 9cb716ff76 Add additional Systrace support
Summary:
Adding support for application to hook into further tracing methods

## Changelog

[General][Added] - Add additional Systrace support

Reviewed By: NickGerleman

Differential Revision: D38673212

fbshipit-source-id: 55a90a0cd57809bca5f01da7acddcf253e5852ba
2022-09-14 16:29:20 -07:00
Paige Sun 447be62909 Fix: Install Fabric UIManager before main bundle execution
Summary:
Changelog: [Internal] Fix install Fabric UIManager before main bundle execution in Bridgeless

In iOS, fixed Bridgeless so that [UIManagerBinding::createAndInstallIfNeeded](ce50c43986/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp (L24-L41)) happens BEFORE the JS main bundle is evaluated.

Logic is unchanged in Android.

# Before
```
> UI [FBReactModule.mm:325] Initializing FBReactModule: start.
> UI [FBReactModule.mm:524] Initializing FBReactModule: end.
> UI [FBReactModule.mm:1839] Initializing RCTHost: start.
> UI [FBReactModule.mm:1891] Initializing RCTHost: end.
> UI[-[FBNavigationControllerObserver navigationController:willShowViewController:animated:]] <FBNewNavigationController: 0x7fd0e7859400> will show <FBReactRootViewController: 0x7fd0e7161a00; react_GemstoneHomeRoute> (animated: 1)
>   VJCPP ****** ReactInstance loadScript ->  evaluateJavaScript start      <--- loads Main Bundle
> UI[-[FBNavigationControllerObserver navigationController:didShowViewController:animated:]] <FBNewNavigationController: 0x7fd0e7859400> did show <FBReactRootViewController: 0x7fd0e7161a00; react_GemstoneHomeRoute> (animated: 1)
>   VJCPP ****** ReactInstance loadScript ->  evaluateJavaScript end
>   VJCPP ****** UIManagerBinding createAndInstallIfNeeded      <--- should happen BEFORE evaluateJavaScript

```

Reviewed By: RSNara

Differential Revision: D39493654

fbshipit-source-id: 4491d6de110966b2eb4f554ff4db8548899020e3
2022-09-14 14:51:27 -07:00
Samuel Susla 5c0536db12 Register "RawText" component in BUCK file
Summary: changelog: [internal]

Reviewed By: javache

Differential Revision: D39502987

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

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

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

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

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

Reviewed By: RSNara

Differential Revision: D38971168

fbshipit-source-id: 3b1b23d422f965a5a14bc4178d32b844906f2c8b
2022-09-09 15:10:14 -07:00
Samuel Susla 71dd83afca Delete preemtive view allocation on iOS
Summary:
changelog: [internal]

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

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

jest_e2e[run_all_tests]

Reviewed By: mdvacca

Differential Revision: D37922589

fbshipit-source-id: 1af8949cbbd9d48a2d80ca238b280178cbe2ead5
2022-09-09 06:25:58 -07:00
Paige Sun 5745c1df26 Modularlize RCTConstants.h - Move Bridge-only constants into a separate file
Summary:
Changelog: [Internal] Move Bridge-only constants into a separate file

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

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

Reviewed By: sammy-SC

Differential Revision: D39085713

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

## Changelog

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

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

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

Reviewed By: cipolleschi

Differential Revision: D39276976

Pulled By: lunaleaps

fbshipit-source-id: e48e985ed4abec77d6f01a6c17292d664ed88f13
2022-09-08 12:54:08 -07:00
Samuel Susla d986e4c889 Add iterative props setter mobile config to iOS
Summary:
changelog: [internal]

Setup MC for iterative props setter.

Reviewed By: javache

Differential Revision: D39305953

fbshipit-source-id: 0087a14ba4f0f252b2e4d01bc2f190acf6384334
2022-09-08 06:45:05 -07:00
Lulu Wu b6bf1fd373 Reland D38460203
Summary:
D38460203 (e6ef0836c1) was reverted because it broke OSS, the root cause is that OSS doesn't have MapBuffer module.

Fixed the issue in this diff by moving MapBuffer usage to fb internal class (FBReactModule) and will re-land.

Changelog:
[iOS][Changed] Replace Folly with MapBuffer for passing js error data

Reviewed By: sammy-SC

Differential Revision: D39210957

fbshipit-source-id: dda0e8c55dbd13bc96310e10a3b09ea53978e8bc
2022-09-07 14:41:45 -07:00
Vincent Riemer c89f5fdfd6 Rework button/buttons handling & add a new test checking for move events on chorded mouse button presses
Summary:
Changelog: [iOS][Internal] - Rework button/buttons handling on pointer events & add a new test checking for move events on chorded mouse button presses

This is a larger diff that largely stems from implementing a new pointer event platform test about chorded mouse button presses (adapted from https://github.com/web-platform-tests/wpt/blob/master/pointerevents/pointerevent_pointermove_on_chorded_mouse_button.html). In order to implement this test I added a new method, `step`, to an async test instance to allow you to run ad-hoc assertions labeled by the async test (like it's done in the original web platform test).

Once implementing the test I also discovered my current logic for handling the `button` and `buttons` properties was insufficient so I reworked it to handle more/most cases by making the `button` property instead determined by the change in the `buttons` property. This largely works but unfortunately due to what seems to be a bug in UIKit, chorded pointer "up" events receive the wrong button mask values so it's currently impossible to get this test fully passing on iOS. I've since submitted a bug report to Apple but my hopes aren't high that it will be focused on since it's such a niche issue.

Reviewed By: lunaleaps

Differential Revision: D38951159

fbshipit-source-id: 426b7cf7930ed8329151382fafee487493e568de
2022-09-01 15:01:33 -07:00
Kudo Chien 3afef3c167 Fix React module build error with swift integration on new architecture mode (#34527)
Summary:
when integrates with swift, the compiler will build clang module based on the *React-Core-umbrella.h*.  however, the include chain reaches some c++ headers that are not available from swift. it will cause build error.

![Screen Shot 2022-08-29 at 8 25 08 PM](https://user-images.githubusercontent.com/46429/187200668-2a1f12c9-61e5-4d8b-9531-69ff5c1a5741.png)

this pr adds `#ifdef __cplusplus` guard for it.

## Changelog

[iOS] [Fixed] - Fix React module build error with swift integration on new architecture mode

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

Test Plan:
one thing we didn't figure out is that we require reanimated to repro the build error.

1.  `npx react-native init RN070 --version 0.70.0-rc.4`. # can also repro this issue on 0.69
2.  `cd RN070`
3. `yarn add react-native-reanimated@next`
4. `cd ios && rm -rf Pods build && RCT_NEW_ARCH_ENABLED=1 pod install`
5. add `import React;` in `main.m` for clang module generation

```diff
 --- a/ios/RN070/main.m
+++ b/ios/RN070/main.m
@@ -1,5 +1,6 @@
 #import <UIKit/UIKit.h>

+@import React;
 #import "AppDelegate.h"

 int main(int argc, char *argv[])
```

6. `yarn ios`

Reviewed By: cipolleschi

Differential Revision: D39128716

Pulled By: jacdebug

fbshipit-source-id: d9e9130f99e3b9e5f7807c475a24cdd84880e720
2022-08-30 02:58:10 -07:00
Paige Sun 984ee76ea8 Modularlize RCTBridgeModule.h 2/n - Fix rn-tester CI breakage on RCTBundleManager.h (#34515)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34515

Changelog: [Internal]

Reviewed By: mdvacca, GijsWeterings

Differential Revision: D39079572

fbshipit-source-id: 374114a02d8bd07b0ac514db46ee0270c505e82d
2022-08-27 07:08:30 -07:00
Paige Sun 4230de0f58 Modularlize RCTBridgeModule.h 1/n - Move RCTBundleManager.h to its own file in ReactInternal target
Summary:
Changelog: [Internal][iOS] Modularlize RCTBridgeModule.h 1/n -  Move RCTBundleManager.h to its own file in ReactInternal target

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

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

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

The other benefit of splitting up the headers like this is that it'll be much easier for developers to navigate between the .h and .mm files.

Reviewed By: philIip

Differential Revision: D38943262

fbshipit-source-id: 90876324de9fae25bf33c7aef820a32d7c6ce2f8
2022-08-26 17:56:51 -07:00
Gabriel Donadel Dall'Agnol 9ac437f25b feat: Add support for Modal on iOS when Fabric is enabled (#34487)
Summary:
While working on a fix for https://github.com/facebook/react-native/issues/29974 (I have a draft for that already (https://github.com/gabrieldonadel/react-native/pull/16), just waiting for https://github.com/facebook/react-native/pull/34406 to get merged) I noticed that the `KeyboardAvoidingView` tests on RNTester on iOS were not working with Fabric enabled because the `ModalHostView` component was still not implemented. Upon some more investigation, I found this code suggestion from Milker90 (https://github.com/facebook/react-native/issues/33652#issuecomment-1214675790) that enables the Modal component on iOS when Fabric is enabled.

Closes https://github.com/facebook/react-native/issues/33652

## Changelog

[iOS] [Added] - Add support for Modal on iOS when Fabric is enabled

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

Test Plan:
1. With Fabric enabled open the RNTester app and navigate to the Modal page
2. Test the `Modal` component through the sections changing props

https://user-images.githubusercontent.com/11707729/186289099-5223907d-b300-46bf-bfde-73259c29d544.mov

Reviewed By: christophpurrer

Differential Revision: D38981895

Pulled By: cipolleschi

fbshipit-source-id: cd493a8d2035900da2576323bc112e2565df4834
2022-08-26 10:35:53 -07:00
Lulu Wu 31b4a92aa9 Revert D38460203: Migrate JS error handler to MapBuffer
Differential Revision:
D38460203 (e6ef0836c1)

Original commit changeset: 98f6243e31da

Original Phabricator Diff: D38460203 (e6ef0836c1)

fbshipit-source-id: 540a48c807cea7f2898f261b82010da729f3421e
2022-08-26 03:52:57 -07:00
Vojtech Novak 18542b6ef5 fix: RCTAlertController's UserInterfaceStyle to follow root window (#34218)
Summary:
The motivation of this PR is for the Alert to follow the same style override (`overrideUserInterfaceStyle` being light/dark) as the one used by the root window (`UIApplication.sharedApplication.delegate.window`).

This is something that has worked previously because `RCTPResentedViewController()` was used to present the Alert (the behavior has changed in f319ff321c). With the former approach, the alert would "inherit" the `userInterfaceStyle` of the view controller it was presented within (and that one, in turn, would "inherit" from `UIApplication.sharedApplication.delegate.window`).

With the current approach, the "style inheritance" does not work with the view controller being created [here](f3db6cc527/React/CoreModules/RCTAlertController.m (L24)).

Because this viewcontroller instance does not have where to "inherit" the styling from, the styling might be different from the rest of the app. This PR fixes that.

## Changelog

[iOS] [Fixed] - fix: RCTAlertController's UserInterfaceStyle to follow root window

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

Test Plan:
Instead of

```
self.overrideUserInterfaceStyle = UIApplication.sharedApplication.delegate.window.overrideUserInterfaceStyle;
```

you can do

```
self.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
```

and observe the result. So if the override is set, it'll manifest itself. If it's not set, the value of `UIApplication.sharedApplication.delegate.window.overrideUserInterfaceStyle` will be `UIUserInterfaceStyleUnspecified`, and it'll have no effect.

<details>
  <summary>screenshot</summary>

![Simulator Screen Shot - iPhone 11 - 2022-07-18 at 21 40 06](https://user-images.githubusercontent.com/1566403/179616673-d0e48e07-50b5-41a1-afb7-0aa8f7ec37b5.png)
</details>

Reviewed By: dmitryrykun

Differential Revision: D38660799

Pulled By: cipolleschi

fbshipit-source-id: c979266900e27be7a4732bdb6e9a496906534931
2022-08-25 11:09:10 -07:00
Gabriel Donadel Dall'Agnol be7c50fefd feat: Add support for "Prefer Cross-Fade Transitions" into AccessibilityInfo (#34406)
Summary:
This PR adds `prefersCrossFadeTransitions()` to AccessibilityInfo in order to add support for "Prefer Cross-Fade Transitions", exposing the iOS settings option as proposed here https://github.com/react-native-community/discussions-and-proposals/issues/452.
I believe this would be especially helpful for solving https://github.com/facebook/react-native/issues/31484

#### TODO
- [ ]  Submit react-native-web PR updating AccessibilityInfo documentation.

## Changelog

[iOS] [Added] - Add support for "Prefer Cross-Fade Transitions" into AccessibilityInfo

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

Test Plan:
**On iOS 14+**

1.  Access Settings > "General" > "Accessibility" > "Reduce Motion", enable "Reduce Motion" then enable "Prefer Cross-Fade Transitions".
2. Open the RNTester app and navigate to the Accessibility page

https://user-images.githubusercontent.com/11707729/154588402-7d050858-3c2d-4d86-9585-928b8c66941b.mov

Reviewed By: cipolleschi

Differential Revision: D38711316

Pulled By: makovkastar

fbshipit-source-id: b9965cd4285f1aa0f1fa927080370a22329c2f62
2022-08-25 10:45:15 -07:00
Lulu Wu e6ef0836c1 Migrate JS error handler to MapBuffer
Summary:
Changelog:
[iOS][Changed] Replace Folly with MapBuffer for passing js error data

Reviewed By: sammy-SC

Differential Revision: D38460203

fbshipit-source-id: 98f6243e31da42cc601727545b331392300cee20
2022-08-25 08:55:25 -07:00
Vincent Riemer 32af9e6e8d Fix buttons property value for non-hoverable pointers
Summary:
Changelog: [iOS][Internal] - Fix buttons property value for non-hoverable pointers

The previous diff ensured that on iOS you could run through the entirety of the non-hoverable pointer event attributes test but that also revealed some failing tests related to the `buttons` property when using a non-hoverable pointer. This diff fixes that by ensuring that we only forward the result of the `buttonMask` to `buttons` when the pointer is a mouse, and assume that it is an emulated left click otherwise.

Reviewed By: lunaleaps

Differential Revision: D38914239

fbshipit-source-id: c573e934d0e9c0ac2af4945dc5360840ddc87d4d
2022-08-23 12:54:48 -07:00
Vincent Riemer 7ccb292540 Apply pointer entering/leaving tracking to touch-initiated pointer events
Summary:
Changelog: [iOS][Internal] - Apply pointer entering/leaving tracking to touch-initiated pointer events

This diff takes the refactoring done in the previous diff in this stack and applies it to the pointer events which are converted from discrete touch events. In addition this adds a check when an ActiveTouch is created to see if the pointer in question was hovering before the touch started or not, which is stored and leveraged once the touch is lifted to determine if we should treat the pointer as leaving the screen entirely or not.

Reviewed By: lunaleaps

Differential Revision: D38762330

fbshipit-source-id: 08452783e01bf5944c57b94a292805b2d69d4384
2022-08-18 16:04:06 -07:00
Vincent Riemer 4c408de27c Refactor hover tracking to prepare for support of tracking the entering/leaving of poitners on non-hover pointer events
Summary:
Changelog: [iOS][Internal] - Refactor hover tracking to prepare for support of tracking the entering/leaving of poitners on non-hover pointer events

This diff begins the work in preparing the touch handler class to track pointer's entering & leaving of views on events other than a hover move by refactoring it to 1) support multiple/simultaneous pointers and 2) abstract the pointer tracking out of the hover recognizer callback so that it can be used for other events in the future (to be done in future diffs, this diff is simply a refactor and keeps the status quo).

Reviewed By: lunaleaps

Differential Revision: D38760358

fbshipit-source-id: f05629ddaa76daed9a3e59ce5d4af6f62ba83755
2022-08-18 16:04:06 -07:00
Thuong Tran 163636db75 feat(font-feature): adding stylistics from ss01 to ss20 as new fontVariant values (#34003)
Summary:
Add new fontVariant values: stylistic-one(ss01) -> stylistic-twenty(ss20)

stylistic-three(ss01)
stylistic-two(ss02)
stylistic-three(ss03)
stylistic-four(ss04)
stylistic-five(ss05)
stylistic-six(ss06)
stylistic-seven(ss07)
stylistic-eight(ss08)
stylistic-nine(ss09)
stylistic-ten(ss10)
stylistic-eleven(ss11)
stylistic-twelve(ss12)
stylistic-thirteen(ss13)
stylistic-fourteen(ss14)
stylistic-fifteen(ss15)
stylistic-sixteen(ss16)
stylistic-seventeen(ss17)
stylistic-eighteen(ss18)
stylistic-nineteen(ss19)
stylistic-twenty(ss20)

References:
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html#Type3
https://docs.microsoft.com/en-us/typography/opentype/spec/featurelist

Example:
`<Text
      style={{
          fontVariant: ['stylistic-three', 'stylistic-five']
        }}>
      Hello World!
    </Text>`

## Changelog

[iOS] [Added] - Add new fontVariant values: stylistic-one(ss01) -> stylistic-twenty(ss20)
[Android] [Added] - Add new fontVariant values: stylistic-one(ss01) -> stylistic-twenty(ss20)

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

Test Plan: ![Screen Shot 2022-06-13 at 16 02 46](https://user-images.githubusercontent.com/62107729/173318839-69da379c-df13-4351-9dfa-4b548664e43d.png)

Reviewed By: cipolleschi

Differential Revision: D37118078

Pulled By: cortinico

fbshipit-source-id: 6a8366638f8181b5db6b2c12c48a5ad65e1e598f
2022-08-17 03:07:09 -07:00
Vincent Riemer 92e4ed6a28 Add iOS implementation of the button property of the PointerEvent object
Summary:
Changelog: [iOS][Internal] - Add iOS implementation of the button property of the PointerEvent object

This implements the `button` property on the PointerEvent object by storing the button which caused the down event in the `ActiveTouch` and reporting that button through `pointerdown` and `pointerup` events and -1 on all others. This diff also includes a small fix to the `pressure` property which was introduced due to `button` being correctly implemented.

Reviewed By: yungsters

Differential Revision: D38632543

fbshipit-source-id: 9dbbb23a9251f2e661faf37fdf206b9f0b26bc5f
2022-08-15 12:00:15 -07:00
Riccardo Cipolleschi 7cc2d1a249 Create RCTAppDelegate to simplify New Architecture Setup (#34384)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34384

This Diff aims to create a RCTAppDelegate library to offer a subclass which automates some operations required to set up the new architecture.

## Changelog
[iOS][Added] - Added the RCTAppDelegate library

Reviewed By: cortinico

Differential Revision: D38580424

fbshipit-source-id: 38f6c4b8ff2790a2ce9e23d385b36307701cffb7
2022-08-15 01:30:55 -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
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
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
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
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
Vincent Riemer 546c4b4c6c Add isPrimary property implementation to the PointerEvent object
Summary:
Changelog: [iOS][Internal] - Add isPrimary property implementation to the PointerEvent object

This diff adds the `isPrimary` property to the PointerEvent object iOS implementation. In addition this adds a related change where we "reserve" the 0 touch identifier for mouse events and the 1 identifier for apple pencil events. This is an easy way to ensure that these pointers are always consistent no matter what happens. Since mouse & pencil pointers should always be considered the primary pointer, that allows us to focus the more advanced primary pointer differentiation purely on touch events.

The logic for this touch event primary pointer differentiation is essentially setting the first touch it recieves as a primary pointer, setting it on touch registration, and sets all subsequent touchs (while the first touch is down) as not the primary pointers. When that primary pointer is lifted, the class property keeping track of the primary pointer is reset and then the **next** pointer (secondary pointers which had already started before the previous primary pointer was lifted are not "upgraded" to primary) is marked as primary. A new platform test is also included in this diff in order to verify the aforementioned behavior.

Reviewed By: lunaleaps

Differential Revision: D37961707

fbshipit-source-id: ae8b78c5bfea6902fb73094fca1552e4e648ea44
2022-07-26 11:41:48 -07:00
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
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
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
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
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
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
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
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