Commit Graph
2610 Commits
Author SHA1 Message Date
ahmadao2214 52154e54a2 Create emitInt32Prop function (#37663)
Summary:
Create a function emitInt32Prop(name: string, optional: boolean) in parser-primitives.js. Factor out the code from [Flow](https://github.com/facebook/react-native/blob/d8ced6f8953cd896471983714e722caf50783960/packages/react-native-codegen/src/parsers/flow/components/events.js#L53-L59) and [TypeScript](https://github.com/facebook/react-native/blob/d8ced6f8953cd896471983714e722caf50783960/packages/react-native-codegen/src/parsers/typescript/components/events.js#L63-L69) into that function. Use that function in the original call site.

## Changelog:
[INTERNAL][ADDED] - emitInt32Prop in parser-primitves

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

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

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

Reviewed By: cipolleschi

Differential Revision: D46437495

Pulled By: rshest

fbshipit-source-id: cebe3958c2ad9c4ab9a6c087fee4317b5e57bc58
2023-06-05 07:48:22 -07:00
shubham0142 34c19232d3 refactor(codegen): extract getCommandProperties to parsers-common (#37666)
Summary:
part of codegen issue https://github.com/facebook/react-native/issues/34872

> Extract the buildCommandProperties function ([Flow](https://github.com/facebook/react-native/blob/d8ced6f8953cd896471983714e722caf50783960/packages/react-native-codegen/src/parsers/flow/components/index.js#L76-L80), [TypeScript](https://github.com/facebook/react-native/blob/d8ced6f8953cd896471983714e722caf50783960/packages/react-native-codegen/src/parsers/typescript/components/index.js#L64-L113)) from the index.js's files to the parsers-commons.js file.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal][Added]: Extract getCommandProperties to parsers-common

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

Test Plan: yarn test react-native-codegen

Reviewed By: cipolleschi

Differential Revision: D46437431

Pulled By: rshest

fbshipit-source-id: 578b94b9d9fec90ac91fa2a56c707abc46b05b99
2023-06-05 05:11:19 -07:00
Blake Friedman 41d5f4bce2 Prevent DEBUG React Native builds idling out (#37681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37681

User who run their applications using `npx react-native ios` have the application going into the
background if there is inactivity on the device. This is common for users developing on device (why touch
the device if you're tweaking background colours, etc...).

If the application is build with Xcode directly, this is already managed.  This change prevents the idle
timer from running in DEBUG builds.

## Changelog:
[iOS][Fixed] - Debug builds from cli disable idle to stop application going into background

Reviewed By: cipolleschi

Differential Revision: D46427401

fbshipit-source-id: 45969cd506a1b76bde3be81d27808bf0e792a817
2023-06-05 03:00:32 -07:00
Nicola Corti 7a1229ea0f Backport Hermes release fix on main (#37685)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37685

I'm backporting this comming `60a452b4853dc5651c465867344904dd6fc86703`
from the release branch of 0.72-stable to main which fixes this issue
in the Android NDK:
https://github.com/android/ndk/issues/1740#issuecomment-1198438260

Changelog:
[Internal] [Changed] - Backport Hermes release fix on `main`

Reviewed By: mdvacca

Differential Revision: D46398346

fbshipit-source-id: 593ca9523cb223e7c2d9fe6cccc1abb3ed331203
2023-06-05 02:18:38 -07:00
Nick Gerleman 2d07d5f160 Native ARIA Roles: iOS Paper + Fabric (#37309)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37309

### Stack

ARIA roles in React Native are implemented on top of accessibilityRole. This is lossy because there are many more ARIA roles than accessibilityRole. This is especially true for RN on desktop where accessibilityRole was designed around accessibility APIs only available on mobile.

This series of changes aims to change this implementation to instead pass the ARIA role to native, alongside any existing accessibilityRole. This gives the platform more control in exactly how to map an ARIA role to native behavior.

As an example, this would allow mapping any ARIA role to AutomationControlType on Windows without needing to fork to add new options to accessibilityRole.

It also allows greater implementation flexibility for other platforms down the line, but for now, iOS and Android behave the same as before (though with their implementation living in native).

### Diff

This enables the `role` prop in iOS. ARIA role strings become convertible to `UIAccessibilityTrait`, which is the sink of most of the roles. We keep a list of traits derived from `role` vs `accessibilityRole` on the view, then inval and apply the result any time the prop for either is set.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D45432530

fbshipit-source-id: ced5be06e319c0b967d7511293e14e05147e5759
2023-06-04 03:48:45 -07:00
Daniel Leong d54f486fe6 Fix: a11y crash when an accessible link is ellipsized away (#37050)
Summary:
If an accessible link is ellipsized out of being rendered, the AccessibilityDelegate will still attempt to populate an accessibility node for it; doing so results in an invalid request to a TextLayout API, however, causing a crash. This crash occurs as soon as the element is rendered, so long as a Screen Reader (or app using similar a11y APIs) is enabled. This change uses a technique similar to those existing to make the node "blank" in such cases, so Talkback can filter it out—and, more importantly, not crash.

## Changelog:

[Android] [Fixed] - Fix links hidden via ellipsis crashing screen readers

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

Test Plan:
- Added a block to the "Accessibility Android APIs" page in the rn-tester app. Without the changes to `ReactAccessibilityDelegate`, this component crashes the app; with the changes, the component renders without problem.
- You can also see the crash "in the wild" using [this Expo Snack](https://snack.expo.dev/dhleong/2d1407) that I put together when trying to isolate this issue.

Reviewed By: rshest

Differential Revision: D46206673

Pulled By: NickGerleman

fbshipit-source-id: 0eb3e735202ee6be5f931bbb4bb92c24e7458ea6
2023-06-04 00:03:01 -07:00
Sam Zhou e25c6632a2 Fix bad type definitions related to utility types (wave 2)
Summary:
This diff fixes more bad type definitions that are previously hidden but will be exposed in the upcoming Flow 0.208.0

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D46382788

fbshipit-source-id: 50337ce5bc0f07ac5916a2d4b75eabf5e8e2e427
2023-06-01 23:17:12 -07:00
Sam Zhou 0191d16712 Fix bad utility type definitions (#37662)
Reviewed By: panagosg7

Differential Revision: D46364595

fbshipit-source-id: 5dcd484cd292d5b83b0b114675ec3c8059aefe6b
2023-06-01 14:41:00 -07:00
Samuel Susla dc54334c59 Create separate pod for React-debug (#37657)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37657

changelog: [internal]

Make React-debug into its own pod to align BUCK and cocoapods.

This is needed to reland RuntimeScheduler in the old architecture on iOS.

Reviewed By: rickhanlonii

Differential Revision: D46357876

fbshipit-source-id: 035aaaee8b4b106f873b4b30c8cb424867be066a
2023-06-01 11:45:57 -07:00
Riccardo Cipolleschi b50874cad4 Remove missing dependencies from React-Fabric (#37652)
Summary:
When reverting the runtimescheduler fix, we forgot to remove some lines from the React-Fabric dependencies. This broke pod install and we have a red ci since then.

bypass-github-export-checks

## Changelog:

[iOS][Fixed] - fix React-Fabric dependencies

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

Test Plan: CircleCI is green

Reviewed By: cipolleschi

Differential Revision: D46349504

Pulled By: sammy-SC

fbshipit-source-id: 8fc1bca7838a913adba702033d06dd02b93c31f9
2023-06-01 04:53:03 -07:00
Nicola Corti b66ab2c154 Configure JDK Toolchain to 11 for all the 3rd party libraries. (#37575)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37575

This fixes the behavior reported in https://github.com/reactwg/react-native-releases/discussions/54#discussioncomment-5984629
by forcing all the libraries to compile with JDK 11.

This prevents build issues when on Gradle 8 and Kotlin 1.8

Changelog:
[Internal] [Changed] - Configure JDK Toolchain to 11 for all the 3rd party libraries

Reviewed By: cipolleschi

Differential Revision: D46190989

fbshipit-source-id: c88974d24efc2c35b01f28d41af0d0515d63d765
2023-06-01 03:24:45 -07:00
Nicola Corti ddb8aeadbb Enable mock-maker-inline for Android JVM tests (#37646)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37646

I'm re-enabling a test that got disabled due to us not using mock-maker-inline in OSS. I'm also adding `mock-maker-inline` for OSS so it will be easier to convert tests to Kotlin as classes in Kotlin are final by default.

Changelog:
[Internal] [Changed] - Enable mock-maker-inline for Android JVM tests

Reviewed By: NickGerleman

Differential Revision: D46222913

fbshipit-source-id: b7da0616994888c2800c193a1bb8e233d2c18288
2023-05-31 23:23:17 -07:00
Ramanpreet Nara 462c648b58 Interop: Create gating for the Bridge proxy
Summary:
The TurboModule interop layer on iOS will ship with a Bridge proxy.

The Bridge proxy is an object (see D46084318) that will try to simulate the Bridge's APIs, whenever possible, by delegating to Bridgeless abstractions.

## Changes
**Fact:** All FBiOS modules work with/without the bridge.

So, let's break down the Interop layer test group (i.e: interop on) into two groups:
- interop on, bridge proxy off
- interop on, bridge proxy on

## Benefits
This will speed up the production test, by allowing us to:
1. Isolate Interop issues to the bridge proxy faster.
2. Stabilize the TurboModule interop layer faster.

NOTE: This flag is temporary, and should be removed long-term: The TurboModule interop layer should ship with the bridge proxy enabled by default.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D46088752

fbshipit-source-id: 1e161d49382635a44194166645c1a5d56d37b4de
2023-05-31 16:13:05 -07:00
Ramanpreet Nara 197ed43697 Export moduleIsInitialized from RCTModuleRegistry
Summary:
## Context
Product code can query the Bridge, or the TurboModuleManager, to see whether a native module has been initialized or not. But, this API doesn't exist in RCTModuleRegistry.

## Changes
This diff exports moduleIsInitialized: from RCTModuleRegistry. That way, RCTBridgeProxy (introduce in D46088752) can more easily implement the moduleIsInitialized: API.

Changelog:
[iOS][Added] - Introduce RCTModuleRegistry moduleIsInitialized:

Reviewed By: cortinico

Differential Revision: D46166548

fbshipit-source-id: c9954273e511083276aeb911dd58719cf4a11f10
2023-05-31 16:13:05 -07:00
Ramanpreet Nara e2d512a1ee Delete bridge.loadAndExecuteSplitBundleURL
Summary:
Changelog:
[iOS][Removed] - Delete bridge.loadAndExecuteSplitBundleURL

Reviewed By: cortinico

Differential Revision: D46166549

fbshipit-source-id: a0854e4abcdd11542629f5f6bbce89c45e30e9cd
2023-05-31 16:13:05 -07:00
Nicola Corti 70f3a264e2 Remove unnecessary dependency on aapt2-linux (#37643)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37643

We needed this change for offline mirrors which we don't use anymore, so we can remove
this extra dependency (it will make the build a little faster also which is never bad).

Changelog:
[Internal] [Changed] - Remove unnecessary dependency on aapt2-linux

Reviewed By: mdvacca

Differential Revision: D46318725

fbshipit-source-id: a86b43fff6a11844acff88791af0578d79d7fdbf
2023-05-31 15:20:57 -07:00
Ramanpreet Nara d0fed3adb6 Remove noexcept from UIManager methods that invoke JavaScript callbacks
Summary:
As far as I'm aware, there's no way to know/guarantee whether a JavaScript callback can throw an exception or not.

So, all UIManager methods that synchronously invoke JavaScript callbacks cannot use noexcept.

If they do use noexcept, and the JavaScript callback (i.e: product code) throws an exception, the app will crash.

Changelog: [Internal]

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

Reviewed By: javache

Differential Revision: D46122985

fbshipit-source-id: 2f4356c7dbab1b3a5e0549f58e73f6de1b626ce9
2023-05-31 13:02:12 -07:00
Samuel Susla b55f55198c Fix header imports (#37625)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37625

changelog: [internal]

- Add explicit <memory> import
- change include to import.

Reviewed By: FieryRobot

Differential Revision: D46284890

fbshipit-source-id: 8eb656c28f58295468b964e86f59b91ca562b570
2023-05-31 06:58:15 -07:00
Chetan Ambekar 0e83c53122 Revert D46194126: Prepare bolts.Task to be safe to be usde from Kotlin
Differential Revision:
D46194126

Original commit changeset: 765af7683fa6

Original Phabricator Diff: D46194126

fbshipit-source-id: e35e25dada9006c654cf02f269f3c1c6fc5c6b13
2023-05-30 17:35:54 -07:00
David Vacca 730ca35405 Prepare bolts.Task to be safe to be usde from Kotlin
Summary:
In this diff I analyzed bolts.Task class to ensure it's ready to be used from kotlin.
I won't convert bolts.Task to kotlin, but this is necessary to be able to convert its callsites (ReactHost) to kotlin

This is a 'continuation' of the previous diff, I splitted in 2 because Task is a very large class and it's worth analyzing separately.

bypass-github-export-checks

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D46194126

fbshipit-source-id: 765af7683fa62814747c7d8516d311cffabac3c1
2023-05-30 13:13:36 -07:00
David Vacca dfb42a3946 Prepare bolts to be safe to use it from Kotlin
Summary:
In this diff I analyzed bolts library to ensure it's ready to be used from kotlin.
I won't convert bolts to kotlin, but this is necessary to be able to convert its callsites (ReactHost) to kotlin

bypass-github-export-checks

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D46194127

fbshipit-source-id: 609e356230b1c87fe26571b811d23430d0168276
2023-05-30 13:13:36 -07:00
Samuel Susla 88eef42cab Back out "Enable RuntimeScheduler in old architecture" (#37623)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37623

Original commit changeset: 5f18cbe60e6c

Original Phabricator Diff: D46078324

changelog: [internal]

Resolves S344737

Reviewed By: FieryRobot

Differential Revision: D46281951

fbshipit-source-id: dae1f7afe549686e3d5bbacf786c088bbfa49cca
2023-05-30 13:00:07 -07:00
Kevin VanGelder 02a73ca856 Fix missing atomic import (#37621)
Summary:
Native error: `Declaration of 'atomic_bool' must be imported from module 'std.atomic' before it is required.`

## Changelog:

[IOS] [FIXED] - Add missing `atomic` import

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

Test Plan: This build error appears to only occur when other build errors occur, but it supersedes the other build errors, increasing the difficulty of debugging the root build error(s).

Reviewed By: NickGerleman

Differential Revision: D46284208

Pulled By: sammy-SC

fbshipit-source-id: b36cb3a9166b1e7cef0121a2e635a191bd7c3a5e
2023-05-30 12:13:12 -07:00
Dmitry Rykun 7f22db8ea0 Introduce __nativeComponentRegistry__getNativeViewConfig (#37522)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37522

This diff adds cross-platform Cxx binding helper and iOS specific implementation of `__nativeComponentRegistry__getNativeViewConfig` to JS runtime. This function provides native view config for a native component in bridgeless mode.

Changelog:
[Internal] - Introduce `__nativeComponentRegistry__getNativeViewConfig` in iOS.

Reviewed By: javache

Differential Revision: D43538804

fbshipit-source-id: 0aeca40c1c2a625eca5d60e466eb24df30453ba7
2023-05-30 08:04:23 -07:00
Pieter De Baets da3dcd7326 Use SurfaceRegistry globals whenever available (#37410)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37410

Incremental adoption of new bridgeless API's, where they are semantically equivalent to the old one.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D45736529

fbshipit-source-id: e41f6840e7c329f6051530e53773fae760584842
2023-05-30 07:20:25 -07:00
Douglas Lowder d3e35992e9 Fix Fabric issue with React-Core pod when Xcode project has multiple targets (#37581)
Summary:
In Xcode projects with multiple targets, and in particular when targets are for different platforms (e.g. iOS and macOS), Cocoapods may add a suffix to a Pod name like `React-Core`.

When this happens, the code in `new_architecture.rb` (which was looking for a pod with exact name `React-Core`) would not add the preprocessor definitions for Fabric as expected.

This change fixes this issue. Fixes https://github.com/facebook/react-native/issues/37102 .

## Changelog:

[iOS] [Fixed] - Fix Fabric issue with React-Core pod when Xcode project has multiple targets

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

Test Plan: Tested that this change fixes this issue which occurs 100% of the time in React Native TV projects.

Reviewed By: dmytrorykun

Differential Revision: D46264704

Pulled By: cipolleschi

fbshipit-source-id: 8dfc8e342b5a110ef1f028636e01e5c5f2b6e2f0
2023-05-30 06:44:49 -07:00
Samuel Susla 5eadd935e8 Attempt at fixing crash when blurring image on iOS (#37614)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37614

changelog: [internal]

We do not control what `vImageBoxConvolve_ARGB8888` returns, it may return 0. If it does return 0, we will allocate memory chunk of size 0. Yes, malloc will let you do that. Well, it depends on the implementation, but according to the spec it is legal. The only requirement is to by able to call free on that without crash.

If `vImageBoxConvolve_ARGB8888` does return 0 and we allocate memory of size 0. Call to `vImageBoxConvolve_ARGB8888` with tempBuffer of size 0 will lead to a crash.

[The documentation](https://developer.apple.com/documentation/accelerate/1515945-vimageboxconvolve_argb8888#discussion) for `vImageBoxConvolve_ARGB8888` and tempBuffer states:
> To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which **should be a positive value**. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

I think the keyword word there is "should be a positive value". 0 is not a positive value.

Reviewed By: javache, yungsters

Differential Revision: D46263204

fbshipit-source-id: baa8fac5b3be6fb5bed02800cd725cc4cf43485a
2023-05-30 04:12:38 -07:00
Riccardo Cipolleschi 680cbe757b Make RNTester use RCTAppDelegate (#37572)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37572

Currently, RNTester was using a completely custom AppDelegate and not leveraging the RCTAppDelegate we use in the OSS. This resulted in a misalignment between the two setups and duplicated work to test stuff internally furst and then in the OSS, with some more time needed to understand why one setup was working and the other wasn't.

With this change, we are aligning the two, bringing RNTester closer to the OSS setup. There are still small differences, but we can iterate over those.

## Changelog:
[iOS][Changed] - Make RNTester use RCTAppDelegate

Reviewed By: cortinico

Differential Revision: D46182888

fbshipit-source-id: 7c55b06de1a317b1f2d4ad0d18a390dc4d3356a4
2023-05-30 04:10:17 -07:00
Intl Scheduler 551bbbc234 translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907889493757
Sandcastle Job Instance ID: 36028797978627335
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D46270525

fbshipit-source-id: 26beec108aa03c970338fdc4561af24798813acf
2023-05-29 21:34:22 -07:00
Riccardo Cipolleschi 9084ee133a Revert D45904748: Move LayoutMetrics and LayoutPrimitives from core to graphics folder
Differential Revision:
D45904748

Original commit changeset: a4e666d7c739

Original Phabricator Diff: D45904748

fbshipit-source-id: c2da28836cb51966854c81d4e380a2abeb742cda
2023-05-29 07:27:36 -07:00
Samuel Susla ce3ade82bf Move LayoutMetrics and LayoutPrimitives from core to graphics folder (#37609)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37609

changelog: [internal]

Moving LayoutMetrics and LayoutPrimitives from core to graphics module.
This is to enable different implementation for different platforms.

Reviewed By: rubennorte

Differential Revision: D45904748

fbshipit-source-id: a4e666d7c7390e87abdb09235f96655b63f451f9
2023-05-29 06:52:31 -07:00
Samuel Susla db121c845d Make dependency on mapbuffer:jni and mapbuffer:mapbuffer explicit (#37598)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37598

changelog: [internal]

This diff does three things:
- Makes dependency on `mapbuffer:jni` explicit for modules that were accessing it through `react:utils` module.
- `renderer:core` now depends on `mapbuffer:mapbuffer`.
- Moved `PropsMapBuffer` inside of `Props`.

Reviewed By: rubennorte

Differential Revision: D46223390

fbshipit-source-id: 2dca1a034f991afd3e9531c4c7fcc7b99239dabe
2023-05-28 14:42:42 -07:00
Rubén Norte 3afb5b8241 Remove incorrect const constraint from UIManager commit hooks (#37588)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37588

The `const` modified in UIManagerCommitHook prevents us from mutating the commit hook itself (which doesn't make any sense as commit hooks might want to update their internal state as response to new commits).

This removes the constraint so we can remove the `const` modifier from `MutationObserverManager` in a future diff.

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D46149085

fbshipit-source-id: d3bf24f1125ad3878ca36a6ceb9dd509c3cf7b1e
2023-05-26 09:06:00 -07:00
Rubén Norte 32bd60f863 Implement mount hooks in UIManager (#37460)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37460

## Context

This implements the concept of mount hooks in UIManager which, similarly to commit hooks, receive a notification when a root shadow tree has been mounted in the host platform.

This is meant to be used internally in React Native, not by user-land libraries or products.

This will be used to implement `IntersectionObserver` in a following diff.

Changelog: [Internal]

Reviewed By: javache, sammy-SC

Differential Revision: D45866244

fbshipit-source-id: 4df48bf237a5cc89e37709faaeaa0ce582c0d0cc
2023-05-26 09:06:00 -07:00
Rubén Norte f30716323a Add flag to do granular state updates in scroll views in iOS (#37461)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37461

This adds a feature flag to dispatch state updates for scroll position in every scroll position update in iOS, as opposed to only at the beginning, end and other specific moments.

This is necessary to implement features like `IntersectionObserver`, but we want to test the performance impact of this change before rolling it out completely.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D45916675

fbshipit-source-id: 00a2b1c5ea03e45141bb2d81e4e5fb8c198de1ff
2023-05-26 09:06:00 -07:00
Rubén Norte 0abd065b15 Create new option in LayoutInspectingPolicy to apply parent clipping to layout metrics (#37435)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37435

We're implementing the `IntersectionObserver` API in React Native. That API reports the bounding rectangle of the root node and the target node (which we already implement in React Native via `LayoutableShadowNode::computeRelativeLayoutMetrics`), plus the intersection rectangle.

This adds a new option in `LayoutInspectingPolicy` so we can get the layout metrics when clipping is applied (e.g.: if a parent node has `overflow: hidden` and we get the layout metrics of one of its children that extends beyond the limits of the parent, it would report only the rectangle that's visible for that node).

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D45866245

fbshipit-source-id: ed3bfc2021e6b7819b8efea6fa3a81ed9d0bb181
2023-05-26 09:06:00 -07:00
Rubén Norte 64416d9503 Fix LayoutableShadowNode::computeRelativeLayoutMetrics when using scale on a parent node (#37436)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37436

When testing the reported intersections from `IntersectionObserver` I realized that the reported rectangles were incorrect when using `scale` in a parent. This is because `scale` transforms use the center of the node as the origin, and when applying the transform on its children we were using the center of the children instead of the center of the same node.

This fixes that issue by using the center of the parent when applying the transform on the children.

Changelog: [General][Fixed] - Fixed computation of layout via `ref.measureRelative` and `ref.measureInWindow` for nodes with scale/rotate transforms in their parents.

Reviewed By: sammy-SC

Differential Revision: D45866231

fbshipit-source-id: 68928cbaca28c21155657d276cf8ddd2129d9668
2023-05-26 09:06:00 -07:00
Rubén Norte 912bca05b1 Create version of LayoutableShadowNode::computeRelativeLayoutMetrics that works with an ancestor list (#37434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37434

We'll be using this method in IntersectionObserver to avoid having to get the list of ancestor multiple times when calling computeRelativeLayoutMetrics for the target bounding rect and for the intersection rect.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D45866232

fbshipit-source-id: 0efa165b780e819bf19028fecd22b303ca6f52ad
2023-05-26 09:06:00 -07:00
Riccardo Cipolleschi 18a13381d2 Fix Hermes-Xcode integration (#37595)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37595

Following D46097200, the integration between Hermes and Xcode got broken as Hermes is creating the framework in a different folder.

This is a patch to unblock people internally to build RNTester with Hermes and to run it on a simulator.
We should find a way to parametrize this, passing the target from Xcode to this script, after checking where Hermes is built

## Changelog:
[internal] - Fix RNTester-Hermes-Xcode integration for testing locally on simulators

Reviewed By: dmytrorykun

Differential Revision: D46224915

fbshipit-source-id: 9d682983c7990f8efa7c07f62191782dce317cbb
2023-05-26 08:29:43 -07:00
Pieter De Baets ff849fd175 Revert changes to getters in Binding (#37589)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37589

In D44221018, I changed this to return a ref to the smart pointer, and even made it a raw pointer in D45948987, but this is not thread-safe: the uninstallFabricUIManager happens on a different thread from the accesses to these pointers on the JS thread, so we actually need to use the shared pointer here to be safe.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D46221511

fbshipit-source-id: d8080042d6f1dbf5550a09b77f1090f78ec82455
2023-05-26 06:54:24 -07:00
Facebook Community BotandFacebook Community Bot 5441a6b565 Re-sync with internal repository (#37593)
Co-authored-by: Facebook Community Bot <6422482+facebook-github-bot@users.noreply.github.com>
2023-05-26 13:31:15 +01:00
Samuel Susla a244209230 Do not use setNativeState in RuntimeScheduler::Task
Summary:
changelog: [internal]

`setNativeState` is not implemented in JSC. Let's stick to host objects for now.

Reviewed By: cipolleschi

Differential Revision: D46193786

fbshipit-source-id: 9d36801bb9faa5c144a461bcbe623762bf6947b1
2023-05-26 00:08:59 -07:00
Jakub Trzebiatowski dcb4eb050a Fixed random styling for text nodes with many children (#36656)
Summary:
Attempting to fix the issue https://github.com/facebook/react-native/issues/33418

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[ANDROID] Fixed inconsistent styling for text nodes with many children

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

Test Plan:
No test plan yet. I'd like to ask for help with creating one.

##

Putting template aside, I'd like to ask for a review of the approach I'm suggesting.

React Native as-is (at least in some cases) [messes up the styles](https://github.com/facebook/react-native/issues/33418#issuecomment-1485305556) for text nodes with more than 85 children, just like that.

![image](https://user-images.githubusercontent.com/2590174/227981778-7ef6e7e1-00ee-4f67-bcf1-d452183ea33d.png)

All of this text should be blue.

The root cause is that code (on Android) assumes it can assign as many `Spannable` span priority values as we'd like, while in reality, it has to be packed in an 8-bit-long section of the flags mask. So 255 possible values. In the scenario I produced, React generates three spans per text node, and for 85 text nodes, it sums up to 255. For each span, a new priority value is assigned.

As I understand it, we don't need that many priority values. If I'm not mistaken, these priorities are crucial only for ensuring that nested styles have precedence over the outer ones. I'm proposing to calculate the priority value "vertically" (based on the node's depth in the tree) not "horizontally" (based on its position).

It would be awesome if some core engineer familiar with `ReactAndroid` shared their experience with this module, especially if there are any known cases when we _know_ that we'd like to create overlapping spans fighting over the same aspects of the style.

Reviewed By: cortinico

Differential Revision: D46094200

Pulled By: NickGerleman

fbshipit-source-id: aae195c71684fe50469a1ee1bd30625cbfc3622f
2023-05-25 17:09:21 -07:00
Alex Danoff 76d41864a2 W3CPointerEvents: emit click events based on pointerDown/pointerUp (#37541)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37541

This diff makes changes to emit bubbling click events (i.e. [these](https://www.w3.org/TR/uievents/#click)) based on the existing pointer-down/pointer-up events. As per the [pointer events spec](https://www.w3.org/TR/pointerevents3/#the-click-auxclick-and-contextmenu-events), click events are still dispatched as PointerEvents (i.e. conform to the PointerEvent interface).

Changelog: [Internal] [Added] - W3CPointerEvents: emit click events based on pointerDown/pointerUp

Reviewed By: NickGerleman

Differential Revision: D45666344

fbshipit-source-id: 08829d3a24fef6851c1c3c29d4fa51b31ec68931
2023-05-25 16:38:53 -07:00
David Vacca 2f1c94efb1 Disable ReactHostDelegateTest.testDefaultReactHostDelegateCreation test
Summary:
Disable ReactHostDelegateTest.testDefaultReactHostDelegateCreation test

bypass-github-export-checks

changelog: [internal] internal

Reviewed By: NickGerleman, GijsWeterings

Differential Revision: D46204169

fbshipit-source-id: 152ceab773568453c0ab07f2d8c0cb9353b4e8d5
2023-05-25 16:23:30 -07:00
Nick Gerleman 2558c3d4f5 Allow string transform style in TypeScript (#37569)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37569

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

Missed as part of D39423409 (or maybe we didn't have TS types inline yet?)

Changelog:
[General][Fixed] - Allow string `transform` style in TypeScript

Reviewed By: cortinico

Differential Revision: D46161450

fbshipit-source-id: 24ee9e19365b7209ec0a2c8fb5a5d7ac78203f4d
2023-05-25 16:09:56 -07:00
Nick Gerleman dfd445cbc6 Terminate instead of throwing if TurboModule callback double-called (#37570)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37570

If a TM calls a completion callback, or resolves or rejects a promise multiple times, a C++ exception is thrown.

For an in the wild crash, we are getting this signal as:
1. `libdispatch` calls std::terminate while pumping a thread's message queue
2. The hooked FB app termination handler is called, which introspects for the currently handled exception
4. We are handling this TurboModule C++ exception being thrown, suggesting `libdispatch` termination may be due to catching this C++ exception which was not otherwise handled
4. We have by this point lost the stack trace of the code invoking the callback

I think if we change the timing of `abort()` to when the callback is called, we might be able to preserve the stack trace of module code calling the callback.

Reviewed By: javache

Differential Revision: D46175685

fbshipit-source-id: 680aa9aa5e4ca6d8dd04dfe34ec870b86c7640ef
2023-05-25 15:26:12 -07:00
Ramanpreet Nara 169180100c Temp: Always report debug info on module not found error
Summary:
The TurboModule interop layer causes a surge in "module not found" exceptions: T154044825.

After D45102812, this exception **should** have included debug info. But, it didn't.

## Problems
So, there are two problems:
1. No debug logs are getting printed.
2. In the TurboModule interop test group, global.RN$TurboInterop is false **for some reason.** This is **very** strange.

## Changes
1. **Always** print the debug logs.
2. Add more flag-related debug information to the "module not found" debug logs. This will help us validate whether global.RN$TurboInterop is truely false.

## Concerns
> **Always** print the debug logs on Android.

**Question:** Won't this be really expensive?

This shouldn't be too expensive: There are about ~50 native module requires in Fb4a. So: (1) the exception message shouldn't grow to an unreasonable size, (2) we'll only use enough memory to store ~50 strings in the JS VM.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D46195117

fbshipit-source-id: 8215c7339d16a1adc063b674805063865d1f7ab6
2023-05-25 14:58:11 -07:00
Alex Danoff 58ef9e92de W3CPointerEvents: add missing attributes to pointer events (#37537)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37537

Changelog: [Internal] [Changed] - W3CPointerEvents: add missing attributes to pointer events

The [PointerEvent interface](https://www.w3.org/TR/pointerevents/#pointerevent-interface) includes some additional properties which we weren't including in the events we dispatched.

This diff adds them (set to default values):
- twist
- tangentialPressure

In the future, we can try to set reasonable values for these properties based on the underlying native events.

Reviewed By: NickGerleman

Differential Revision: D45747033

fbshipit-source-id: 529f9d90299f33bc04eae3fb85ddd7eac3d61c5b
2023-05-25 13:22:56 -07:00
David Vacca 20808b5eb5 Document ReactHostDelegate (#37562)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37562

Add documentation for ReactHostDelegate

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D45717674

fbshipit-source-id: e0d6d70edf4f4cf70b53807732b35f5fda917fc3
2023-05-25 10:29:01 -07:00