Commit Graph

12270 Commits

Author SHA1 Message Date
Nick Gerleman 644facd19d Make dimension units case insensitive (#44639)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44639

https://www.w3.org/TR/css-values-4/#dimensions

> Like keywords, unit identifiers are ASCII case-insensitive.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D57620806

fbshipit-source-id: 26946ed4031f379888651c08b1b0895ac701a320
2024-05-21 11:25:57 -07:00
Ramanpreet Nara fb23470483 Push ReactContext logic in derived classes (#44226)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44226

Changelog: [Android][Removed] Delete ReactContext.initializeWithInstance(). ReactContext now no longer contains legacy react instance methods. Please use BridgeReactInstance instead.

Yet another attempt to land this (last one was D55964787).

Copy-pasting below the amazing summary from RSNara.

## Context
Prior, ReactContext used to implement bridge logic.

For bridgeless mode, we created BridgelessReactContext < ReactContext

## Problem

This could lead to failures: we could call bridge methods in bridgeless mode.

## Changes
Primary change:
- Make all the react instance methods inside ReactContext abstract.

Secondary changes: Implement react instance methods in concrete subclasses:
- **New:** BridgeReactContext: By delegating to CatalystInstance
- **New:** ThemedReactContext: By delegating to inner ReactContext
- **Unchanged:** BridgelessReactContext: By delegating to ReactHost

## Auxiliary changes
This fixes ThemedReactContext in bridgeless mode.

**Problem:** Prior, ThemedReactContext's react instance methods did not work in bridgeless mode: ThemedReactContext wasn't initialized in bridgeless mode, so all those methods had undefined behaviour.

**Solution:** ThemedReactContext now implements all react instance methods, by just forwarding to the initialized ReactContext it decorates (which has an instance).

NOTE: Intentionally not converting `BridgeReactContext` to Kotlin to minimize the risk of these changes.

Reviewed By: cortinico

Differential Revision: D56064036

fbshipit-source-id: 2e380bf7ee46892c5fc0044b03a929f12d122157
2024-05-21 09:58:17 -07:00
Karol Latusek cfa784c5ce Avoid redundant state updates in Pressable if children and style are not functions (#44615)
Summary:
Goal of this PR is to optimise `Pressable` component, similarly to https://github.com/react-native-tvos/react-native-tvos/pull/724 . `Pressable` `style` and `children` properties can, but doesn't have to be functions. Usually we passing objects or arrays. `pressed` state is used only when `style` or `children` are `functions`, so let's update that state only in such case, otherwise let's skip state updates to improve the performance.

 That way we won't have to rerender the component when it is being pressed (assuming that `style` and `children` are not going to be functions)

## Changelog:

[GENERAL] [CHANGED] - Improve performance of `Pressable` component.

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

Test Plan: Verify that `Pressable` updates its `pressed` state when `style` or `children` are functions.

Reviewed By: javache

Differential Revision: D57614309

Pulled By: fabriziocucci

fbshipit-source-id: 473e0ab3c4bf7b3ef04ba19f76105ac65371a3fb
2024-05-21 09:51:35 -07:00
Ruslan Lesiutin cd1ddbbef3 Update debugger-frontend from 141c8c9...b453d8b (#44635)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44635

Changelog: [Internal] - Update `react-native/debugger-frontend` from 141c8c9...b453d8b

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/141c8c936712ace2a7fef80503acec4127c32f2d...b453d8bdf336e7730efc4565a27bebafac36afbb).

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

Reviewed By: huntie

Differential Revision: D57616476

fbshipit-source-id: aa06c3d7d1fe7db3c2f34cbc025d8840475ae091
2024-05-21 08:48:39 -07:00
Fabrizio Cucci cf94797f93 Resolve $FlowFixMe in Pressable (#44634)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44634

Changelog: [Internal]

As per title.

Reviewed By: NickGerleman

Differential Revision: D57612982

fbshipit-source-id: 5aafd38889b3db49a5f4360563e1803169d9b943
2024-05-21 07:40:51 -07:00
Pieter De Baets e67d5560cf Fix HeadlessJsTaskContext creating Handler on background thread (#44582)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44582

D54496604 fixed lifecycle methods for JavaTimerManager, which now reveals another bug. Because this codepath ends up creating a `HeadlessJsTaskContext` which in turn creates a `Handler`, ReactInstance destruction doesn't complete cleanly.

```
2024-05-15 17:42:52.935 12681 27113 W fb4a.BridgelessReact: ReactHost{1}.getOrCreateDestroyTask(): React destruction failed. ReactInstance task faulted. Fault reason: Can't create handler inside thread Thread[pool-51-thread-1,5,main] that has not called Looper.prepare(). Destroy reason: FbReactInstanceHolder.destroyReactManager(): FbReactInstanceLogoutCleaner.clearReactInstanceData()
```

The fix is to not create our own Handler, but instead use the shared methods in UiThreadUtil.

Changelog: [Android][Fixed] Fixed error thrown during ReactInstance teardown

Reviewed By: cortinico

Differential Revision: D57378247

fbshipit-source-id: a31dc8e35b5418a71b83c301973f12350f2ee01b
2024-05-21 06:37:28 -07:00
Pieter De Baets fd8eb4878b Fix crash in ParagraphState when running with USE_FABRIC_DEBUG (#44633)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44633

`toDynamic` no longer exists for ParagraphState, so try the MapBuffer value first, before triggering the error introduced in D56963463.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D57439386

fbshipit-source-id: 31e6466d9dec5b835551cca6c946b28cfbd4578b
2024-05-21 05:58:38 -07:00
Richard Howell 2a96dba075 remove shadowed static (#44626)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44626

This variable is unused and is shadowed by a function local.
Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D57568098

fbshipit-source-id: e5f56b7ef88497d4b9935275eb7e805660741146
2024-05-20 13:11:48 -07:00
Christoph Purrer 1be073e832 Fix assert Turbo Module example crash the app when tap Run all tests (#44607)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44607

Same as https://github.com/facebook/react-native/pull/41521?fbclid=IwAR1X3qRAyVCZIy2w2T7tmqd1FYVCqrT2TyO-gszIgJ0XKN6F60ODkq_K3nI for the Java / ObjC Turbo Module example.

Changelog: [INTERNAL] [FIXED] - [RN-Tester] Fix assert Turbo Module example crash the app when tap `Run all tests`

Reviewed By: cortinico

Differential Revision: D57531736

fbshipit-source-id: 7cad5dfd31c306dff4763b67466664f2dde6b239
2024-05-20 10:31:17 -07:00
Samuel Susla 30d7a0f1d7 handle re-entry in RuntimeScheduler::executeNowOnTheSameThread (#44606)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44606

changelog: [internal]

Protect RuntimeScheduler::executeNowOnTheSameThread against re-entry to prevent deadlocks.

Reviewed By: NickGerleman

Differential Revision: D57514317

fbshipit-source-id: 88309aa27fedefcce7bf8ce5be9a382fdf72cfae
2024-05-20 09:36:26 -07:00
Ryan Linton 4fb5573796 Update ColorPropConverterto support color function values (#44237)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44237

This adds support for color function values to ColorPropConverter per the wide gamut color [RFC](https://github.com/react-native-community/discussions-and-proposals/pull/738). It updates the color conversion code so that it returns a Color instance before ultimately being converted to an Integer in preparation for returning long values as needed.

## Changelog:

[ANDROID] [ADDED] - Update ColorPropConverter to support color function values

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

Test Plan:
Colors should work exactly the same as before.

Follow test steps from https://github.com/facebook/react-native/pull/42831 to test support for color() function syntax.

While colors specified with color() function syntax will not yet render in DisplayP3 color space they will not be misrecognized as resource path colors but will instead fallback to their sRGB color space values.

 ---

After the failure with the tests, I reapplied the changes and test some Jest e2e tests that were failing yesterday:

{F1495277376}

Reviewed By: cortinico

Differential Revision: D56517579

Pulled By: cipolleschi

fbshipit-source-id: ae9b5bc2afe9eb9760dd91afb090385daf7102b8
2024-05-20 09:27:06 -07:00
Gijs Weterings 252519666f Deduplicate test case for TextExample in preparation of rntester android onboarding
Summary:
D57197676 reordered the TextExample test cases, but accidentally reused the same string as the case in packages/rn-tester/js/examples/Text/TextInlineViewsExample.js

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D57279961

fbshipit-source-id: 60a41eaf13d82538ee149fe4ef5531e42c00b012
2024-05-20 07:57:10 -07:00
Gijs Weterings b6269ebc4f default the RNTTestDetails to collapsed by default
Summary:
tsia. Done to allow for easier interaction of the examples, especially those with long descriptions

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D57278607

fbshipit-source-id: f0a1d06c97c019fe177c8b9e51c3ca0ae12caef5
2024-05-20 07:57:10 -07:00
Gijs Weterings 3c5a6b3d43 Allow Deeplinking via Linking.getInitialURL() (#44552)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44552

Changelog: [Android][Fixed] If the RNTester app is started with a deeplink intent, we now correctly navigate there for Android to facilitate e2e testing. This already worked on ios.

Reviewed By: javache

Differential Revision: D54662737

fbshipit-source-id: 5bbf824c80e226f441bdcbc4fa67e41ab4c3eb33
2024-05-20 07:57:10 -07:00
Gijs Weterings 99238d2bb9 Configure ViewHierarchy dump for RNTester
Summary: Changelog: [Android][Added] add FBEndToEndDumpsysHelper stub to RNTester Android to be able to dump ViewHierarcies internally.

Reviewed By: makovkastar

Differential Revision: D54662739

fbshipit-source-id: 5236ae84ed648d431a8f01558f8f84049480ba39
2024-05-20 07:57:10 -07:00
Jorge Cabiedes Acosta 417ff5fec9 Add <hex-color> to CSSParser (#44624)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44624

The syntax for <color> is defined as (https://www.w3.org/TR/css-color-4/#color-syntax):

```
<color> = <color-base> | currentColor | <system-color>

<color-base> = <hex-color> | <color-function> | <named-color> | transparent
<color-function> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hwb()> | <lab()> | <lch()> | <oklab()> | <oklch()> | <color()>
```

This diff implements in particular:
```
<color-base> = <hex-color>
```

We parse over a `<hash-token>` to extract a 3, 4, 6 or 8 digit long hexadecimal and parse it into a CSSColor struct representation:

```
struct Color {
    uint8_t r // 0-255
    uint8_t g // 0-255
    uint8_t b // 0-255
    uint8_t a // 0.0 - 1.0
}
```
Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D57287309

fbshipit-source-id: 35ce82e52fdc8fc86425e03d7883ae09b429b9e4
2024-05-20 07:29:51 -07:00
Peter Abbondanzo 7349dabae2 Make StatusBarModule nullsafe (#44618)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44618

This change is a prerequisite to converting this file to Kotlin. It adds null checks to potentially nullable window and inset getters that were previously not there.

## Changelog:
[Android] [Changed] - Added null checks, marked null safety in StatusBarModule

Reviewed By: NickGerleman

Differential Revision: D57553395

fbshipit-source-id: 5293bb74a95d22bb82971c0a9d691c9e5e36d81f
2024-05-20 07:20:05 -07:00
legobt 99704800a1 chore: Increase iOS script portability (#44417)
Summary:
`pod install` and CocoaPods are actually not macOS specific.
Still, the pod lifecycle scripts of `react-native` depend on macOS-only utilities and will fail on Linux.

This is an attempt to make the scripts portable and make the pod install cleanly on Linux as well as macOS.

## Changelog:

    [INTERNAL] [FIXED] - Skip XCode patching when not run on macOS
    [INTERNAL] [FIXED] - Fall back to `which gcc`/`which g++` to identify C/C++ compiler when `xcrun` not available
    [INTERNAL] [FEAT] - Recognize CC and CXX env vars supplied to the script and prefer them over autodetection

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

Reviewed By: NickGerleman

Differential Revision: D57055928

Pulled By: cipolleschi

fbshipit-source-id: 1c49f70c52b4667abf0a215cbee52ee6aa6dd052
2024-05-20 06:39:26 -07:00
Samuel Susla 1945939808 avoid calling setState when onScrollEmitter exists (#44609)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44609

changelog: [internal]

Do not call setState when onScrollEmitter exists to prevent unnecessary re-render.

Reviewed By: yungsters

Differential Revision: D57537436

fbshipit-source-id: 3a0883171e8fa7995b715aff84702daca075f843
2024-05-20 05:58:04 -07:00
Jorge Cabiedes Acosta 8d5bbca1eb Fix borderRadius incorrect overrides (#44602)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44602

Fix regression caused by D56943825 where radii set to 0 was not being considered. Also preemptively fix a possible bug with RTL due to incorrect overrides.

Changelog:
[Android][Fixed] - Fix borderRadius incorrect overrides

Reviewed By: NickGerleman

Differential Revision: D57473482

fbshipit-source-id: d22a46bdd271d5f254e7d7e54abc55c00a8da8f2
2024-05-20 05:18:50 -07:00
zhongwuzw fbf9c4343a Remove _logWarnIfCreateRootViewWithBridgeIsOverridden (#44271)
Summary:
Fixes customizeRootView migration comment. cc cipolleschi

## Changelog:

[IOS] [FIXED] - Fixes customizeRootView migration comment

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

Test Plan: ![image](https://github.com/facebook/react-native/assets/5061845/bf8b7628-9c23-4920-80bb-72b3ab08fbe3)

Reviewed By: christophpurrer

Differential Revision: D56821755

Pulled By: cipolleschi

fbshipit-source-id: 5f85929d35ffc8768e5a7f1e76d738613bc70b14
2024-05-20 03:29:02 -07:00
Jorge Cabiedes Acosta 1ad69d94bc Add <hash-token> consumption for CSSTokenizer (#44613)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44613

We are building a native CSS parser for Fabric, to allow broader support for CSS. One area not yet implemented are features required for color.

<hash-token> is a pre-requisite.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D57180293

fbshipit-source-id: 0932c44d881f205aed55bcdf4fa23ad04b336c11
2024-05-20 03:09:02 -07:00
Nick Gerleman 93c079b92a Mark CSSBackgroundDrawable as Nullsafe (#44541)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44541

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D57250750

fbshipit-source-id: 433213b83ebd8fba8d326434787a2d7e6cf1c626
2024-05-17 20:38:26 -07:00
Nick Gerleman e16faca18c Propagate layout direction to Android Views and Drawables
Summary:
Right now we use layout direction determined by I18NManager to influence the root Yoga layout direction.

Individual views may have a different resolved layout direction (e.g. due to `direction` style prop), and even though we don't rely on Android layout props, Android components still need to inherit or know the right layout direction to still do correct drawing. Example of this was scrollbar showing up on the left, instead of right in RTL, as soon as ScrollView knew it was in RTL.

This has potential to change a good amount of behavior, so this is under QE.

Changelog:
[Android][Fixed] - Propagate layout direction to Android Views and Drawables

Reviewed By: joevilches

Differential Revision: D57248417

fbshipit-source-id: 4bcdf2b23277ff926a796b8377df08d49c7b914c
2024-05-17 20:38:26 -07:00
Nick Gerleman 355ca28b5d Reland: Sanitize measure function results
Summary:
D57285584 was reverted because we have service code with a faulty measure function, and adding logging to Yoga when invalid measurements were received was enough to spike error rate to elevated levels and block release.

This is a reland of the below change, with a couple modifications:
1. We log warnings instead of errors, which from what I heard, shouldn't block release, but should still make signal
2. We only zero the dimension which was NaN, to preserve exact behavior

## Original

We've started seeing assertion failures in Yoga where a `NaN` value makes its way to an `availableHeight` constraint when measuring Litho tree.

Because it's only happening on Litho, I have some suspicion this might be originating from a Litho-specific measure function. This adds sanitization in Yoga to measure function results, where we will log an error, and set size to zero, if either dimension ends up being negative of `NaN`.

This doesn't really help track down where the error was happening, but Yoga doesn't have great context to show this to begin with. If we see this is issue, next steps would be Litho internal intrumentation to find culprit.

Changelog: [Internal]

Reviewed By: sbuggay

Differential Revision: D57473295

fbshipit-source-id: 979f1b9a51f5550a8d3ca534276ec191a3cb7b9e
2024-05-17 19:12:13 -07:00
Oleh Malanchuk af721084af Fix SurfaceMountingManager leaking activity from stopped surfaces (#44584)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44584

Changelog: [Android][Fixed] Surfaces no longer leak activity once stopped

Reviewed By: javache

Differential Revision: D57367419

fbshipit-source-id: 7aa69256284f97679ebcc3309f2b74650ec3fb51
2024-05-17 16:36:27 -07:00
Nick Gerleman 044aadbaf6 Fix bad merge of I18nUtil (#44600)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44600

I didn't pay close enough attention during merge between V1 and V2 of D57248205, and what I ultimately checked in is not correct. Fix the logic here.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D57488372

fbshipit-source-id: c9db597a6ae4ca5ae81e6ccd9913a14be268dd57
2024-05-17 06:20:29 -07:00
Blake Friedman 355fe7717c mark hasRtlSupport as public API (#44599)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44599

Contributed in D57248205 / facebook/react-native#44538

From:
```
buck2 run //xplat/js/scripts/rn-api:generate-rn-api-metadata
```

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D57487065

fbshipit-source-id: 35308c7a1ef7368b4b1792fe26cf057e45de1360
2024-05-17 03:40:28 -07:00
Nishan f997b81288 feat(iOS/fabric): percentage support in translate (#43192)
Summary:
This PR adds percentage support in translate properties for new arch iOS. Isolating this PR for easier reviews.

The approach taken here introduces usage of `ValueUnit` struct for transform operations so it can support `%` in translates and delay the generation of actual transform matrix until view dimensions are known. I have tried to keep the changes minimal and reuse existing APIs, open to changes if there's an alternative approach.

## Changelog:
[IOS] [ADDED] - Percentage support in translate in new arch.
<!-- 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/43192

Test Plan:
- Checkout TransformExample.js -> Translate percentage example.
- Added a simple test in `processTransform-test.js`. The regex is not perfect (values like 20px%, 20%px will pass, can be improved, let me know!)

Related PRs - https://github.com/facebook/react-native/pull/43193, https://github.com/facebook/react-native/pull/43191

Reviewed By: javache

Differential Revision: D56802425

Pulled By: NickGerleman

fbshipit-source-id: 978cbbdde004afe1e68ffee9a3c7eb7d16336b46
2024-05-16 19:35:15 -07:00
Nick Gerleman 82c6f8a580 Set and require android:supportsRtl="true" for RTL layout (#44538)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44538

Android originated without RTL support. When RTL support was added, Applications needed to set `android:supportsRtl="true"` in their manifest, to allow Android to do RTL specific layout and drawing. This became the default for new projects created by Android Studio at some point.

React Native was not setting this in template, which means apps created from it do not do any of Android's RTL layout, text alignment, or drawing (e.g. in D3652980 8 years ago, a native drawer component came from the wrong side of the screen). RN would still layout the app using Yoga in RTL if in RTL locale though.

This change sets `android:supportsRtl` in template matching default new Android projects, and to avoid mismatched states in the future, will only tell I18NManager that RTL is allowed if `android:supportsRtl` is also set. This is breaking, since existing apps may not get Yoga RTL support unless telling Android that the application should support RTL layout.

Changelog:
[Android][Breaking] - Set and require `android:supportsRtl="true"` for RTL layout

Reviewed By: joevilches

Differential Revision: D57248205

fbshipit-source-id: 3f60c9f855db26f8d34a2e05d460f95961f5ffeb
2024-05-16 19:06:18 -07:00
Nick Gerleman 258b481ae5 Revise ComponentValue parsing model (#44561)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44561

D57089275 introduced a layer to parse component values out of the token stream. I modeled this similar to the tokenizer, as a flat iterator of component values. Because function components can nest a variable number of child component values, this now looks like storing a fully resolved tree of tokens on the heap during parsing.

This diff changes the model, so that `CSSSyntaxParser::consumeComponentValue()` no longer returns a resolved CSS function value. Instead, users of the parser are expected to provide "visitors" which continue parsing, matched based on component value type pattern matched. Visitors can perform parsing specific to their context, and propagate values up the stack, based on their evaluation of the component value.

Removing the heap allocated list of tokens here also lets this core CSS parsing stack keep constexpr, so I added that back, though we need to keep expression trees for math expressions in uncommon cases, so the layer up probaly won't keep constexpr.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D57206706

fbshipit-source-id: 25db84d376ef18f6291e60ed953e29c4000a7a26
2024-05-16 15:19:25 -07:00
Blake Friedman 0c7095faa3 Fix ReadableNativeMap linting warning (#44596)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44596

Minor fix to get CI running again.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D57454420

fbshipit-source-id: be80fbc8e899ad9aaeafa2cf63fbb6cd4ce32269
2024-05-16 14:17:46 -07:00
Blake Friedman 1aabefc5b3 build and install an iOS app (#44465)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44465

Allows us to `yarn build ios` the helloworld app.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D57067038

fbshipit-source-id: 3e2f3184a698fc5f39da9949c1ee17bd2b2ca7f5
2024-05-16 12:57:09 -07:00
Ruslan Shestopalyuk 6b2e5df382 Migrate *NativeMap classes to Kotlin (#44581)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44581

# Changelog:
[Internal] -

This converts the vertical of NativeArray/ReadableNativeArray/WritableNativeArray classes to Kotlin.

Reviewed By: javache

Differential Revision: D57329244

fbshipit-source-id: 8c6b8138801c6e07c21da65a2dbf1dcb7e0f2183
2024-05-16 09:50:08 -07:00
Ruslan Shestopalyuk 44bac48ed6 Kotlinify functional interfaces in react.bridge (#44546)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44546

# Changelog:
[Internal] -

This is the first chunk of moving all of the interfaces to Kotlin inside `react.bridge`, covering the small-ish (functional/SAM and such) interfaces.

Reviewed By: javache

Differential Revision: D57253634

fbshipit-source-id: aa26d26b9681ac7c6059c249b985ff5121ad1e9d
2024-05-16 07:13:50 -07:00
Blake Friedman c481bce649 Add getEntries API to breaking-change-detector (#44592)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44592

The breaking change detector snapshot update to include getEntries:

  buck2 run //xplat/js/scripts/rn-api:generate-rn-api-metadata

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D57436792

fbshipit-source-id: c910dc145ef49ac4836918f4ec4d6d7020e7ec0f
2024-05-16 06:22:01 -07:00
Pieter De Baets 0bf8c6e422 Stub more methods of performance API (#44583)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44583

This native module is only available in the new architecture, stub the methods elsewhere.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D57382785

fbshipit-source-id: f6c988bcfd12633697b45a1f862b2cd4fb5d00d4
2024-05-16 02:57:45 -07:00
abing 16775215d5 Fix RCTPerfMonitor not showing up in scene based app (#43476)
Summary:
Currently RCTPerfMonitor won't show up in scene based app, we should first try to extract the window from the connected scenes, and fallback to the window in `UIApplicationDelegate`.

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

[iOS] [Fixed] - Fix RCTPerfMonitor not showing up in scene based app

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

Test Plan:
- Tested RCTPerfMonitor in app not using scenes;
- Tested RCTPerfMonitor in app using scenes in iOS 13 & 14;
- Tested RCTPerfMonitor in app using scenes in iOS 15+.

Reviewed By: rshest

Differential Revision: D57381551

Pulled By: javache

fbshipit-source-id: fd6cce20c9a4ed41d7aae84751fc0c83391d0865
2024-05-16 02:52:21 -07:00
Sven 46d4b837a5 fix hint when using createRootViewWithBridge to show correct method name (#44585)
Summary:
I used the `createRootViewWithBridge` in a Project and got the hint to migrate to the `customiseView` Method. I searched for the Method, but found it under a different name: `customizeRootView`.
So i thought it would be helpful to use the correct Method name inside the hint message.

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

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [FIXED] - fixed Method name in hint from customiseView to customizeRootView

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

Test Plan:
* Use `createRootViewWithBridge`
* Should get a hint to migrate to `customizeRootView` method

Reviewed By: fabriziocucci

Differential Revision: D57431185

Pulled By: javache

fbshipit-source-id: 14f8c33771551ea3fb66d2c8f3fce4b4e3ef962a
2024-05-16 02:29:43 -07:00
Ramanpreet Nara d94c4c46f2 Keep ReactImageView logging disabled in bridgeless (#44578)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44578

In bridgeless mode, when we fix themed react context, this code-path slows rendering (in dev), starting a feedback loop.

Best understanding of feedback loop:
1. Some code tries to render an <Image/> component.
2. Fabric preallocates the <Image/> component, assigns a null src to the image.
3. The image component warns that there's no src: [RNLog.w](https://www.internalfb.com/code/fbsource/[8cf3936aee379b1f5fa31cc8f02745ceafa72ff3]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java?lines=603-609).
4. **Prior to the themed react context fix,** RNLog.w() would just noop: this [ThemedReactContext.hasActiveReactInstance()](https://www.internalfb.com/code/fbsource/[19ba3ff63f5342a4ba86e18f2e790c69c6cfc7e1]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/util/RNLog.kt?lines=93-95) returned false.
5. **After the themed react context fix,** RNLog.w() dispatches a [native -> javascript call](https://github.com/facebook/react-native/blob/44f9371f246932215627a7ea01fbedf5c13e3019/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/util/RNLog.kt#L94). This renders a LogBox.
6. LogBox renders a <Image/>, which re-starts this loop.

We're not sure what the right long-term solution here is. But, I will follow up! But, until then, it's important that we unblock the ThemedReactContext fix.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D56970919

fbshipit-source-id: 26f0cf0acaf6647ded26e6c816483b9ea3e4f4c2
2024-05-15 17:25:39 -07:00
Pieter De Baets ad4c39ec94 Revert D57329165: Shortcut emitDeviceEvent in bridgeless
Differential Revision:
D57329165

Original commit changeset: 6506a7afb522

Original Phabricator Diff: D57329165

fbshipit-source-id: 98fb81b7c16a2330f1bd58ad6bbfee6f04934b57
2024-05-15 08:43:59 -07:00
Donald Roshi 86dffb3f15 fix(ios) use condensed system font (#43188)
Summary:
The current implementation does not support System font variants. Currently the isCondensed variable is always returning false. This pr adds an extra check to support the 'SystemCondensed' font variant on iOS.

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

[IOS][ADDED] - Update font to handle system condensed variant

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

Test Plan:
```
<Text style={{ fontSize: 28, fontFamily: 'System' }}>System</Text>
<Text style={{ fontSize: 28, fontFamily: 'SystemCondensed' }}>SystemCondensed</Text>
<Text style={{ fontSize: 28, fontFamily: 'AmericanTypewriter-Condensed' }}>AmericanTypewriter-Condensed</Text>
<Text style={{ fontSize: 28, fontFamily: 'HelveticaNeue' }}>HelveticaNeue</Text>
<Text style={{ fontSize: 28, fontFamily: 'HelveticaNeue-CondensedBold' }}>HelveticaNeue-CondensedBold</Text>
```
![Simulator Screenshot - iPhone 15 Pro - 2024-02-26 at 17 56 40](https://github.com/facebook/react-native/assets/63480001/36daea22-2e75-4526-8b2d-f0555fbf2441)

Reviewed By: fabriziocucci

Differential Revision: D57329036

Pulled By: javache

fbshipit-source-id: b0fffde1a568cb498f907e0a007df4da3e11d586
2024-05-15 05:15:25 -07:00
Pieter De Baets 524e3eec3e Fix bridgeless triggering reloads twice from BridgelessDevSupportManager (#44554)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44554

Noticed than when reload is triggered by Metro (`handleReloadJS`), the application would often get stuck and not respond to further reload commands. Often an IOException would get printed as well, due to concurrent bundle loads happening.

Changelog: [Android][Fixed] Improved resiliency of reloads when bundle loading fails

Reviewed By: RSNara

Differential Revision: D57112152

fbshipit-source-id: b0bf8c8311264504684a137c0910e2eeb008b0c7
2024-05-15 03:47:13 -07:00
Pieter De Baets d0bb396ddb Shortcut emitDeviceEvent in bridgeless (#44574)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44574

`emitDeviceEvent` is frequently used for perf-critical operations such as sending network responses from native to JS. We don't need to go through JavaScriptModule Proxy (which is missing caching in bridgeless) and instead can immediately invoke the callable JS module.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D57329165

fbshipit-source-id: 6506a7afb522b672a1f3dc7d348c9b80e6734225
2024-05-15 02:03:46 -07:00
Tim Yung 95f7a5c597 RN: Delete AnimationsDebugModule (#44577)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44577

There are no references to `AnimationsDebugModule` and it is also no longer public, so it is dead code. This cleans it up.

Changelog:
[Android][Removed] - Removed `NativeAnimationsDebugModule` (already not Public API)

Differential Revision: D57351893

fbshipit-source-id: 5a78a3b8e93a87ccb0cd5cdf8d2308d6c53d0ffa
2024-05-14 18:05:49 -07:00
Ruslan Shestopalyuk 734ac42d61 Kotlinify react.bridge.CatalystInstance interface (#44545)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44545

# Changelog:
[Internal] -

As in the title.

Reviewed By: javache

Differential Revision: D57253633

fbshipit-source-id: d8631f5d25c00bdf4c94fcd0d56746c35e5b2fc3
2024-05-14 11:51:39 -07:00
Thomas Nardone 13dff7cdf2 Nullsafe views/scroll module (#44532)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44532

Changelog: [Internal]

Fix nullsafe errors in the module and add the annotation

Reviewed By: rshest

Differential Revision: D57218666

fbshipit-source-id: 9fc8c6d002bb2c4b53c0874a6d8c38fcf52b9e19
2024-05-14 09:21:15 -07:00
Thomas Nardone 6876775dc7 Fix ViewManager.receiveCommand nullability (#44531)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44531

Changelog: [Internal]

Properly propagate the `Nullable` to the delegates.

Reviewed By: rshest

Differential Revision: D57218665

fbshipit-source-id: 2783ad9b37688e0928ad2e3cf6a2ab1f41190fe7
2024-05-14 09:21:15 -07:00
Gilad Bar 1a56b9a808 Revert D57285584: Sanitize measure function results
Differential Revision:
D57285584

Original commit changeset: 935fcdd28c05

Original Phabricator Diff: D57285584

fbshipit-source-id: 3c5d7ccefd608885af4d6f08c0d1cd00553f1f34
2024-05-14 07:13:21 -07:00
Marlene Cota b53aa08678 EventPerformanceLogger + BoundedConsumableBuffer - switch members to size_t (#44564)
Summary:
The RNW integration to RN 04/13 (https://github.com/microsoft/react-native-windows/pull/13226) adds EventPerformanceLogger.cpp and PerformanceEntryReporter.cpp.

We're getting the following errors:
![image](https://github.com/facebook/react-native/assets/1422161/33a4dc42-1d14-4ac4-befd-87ec5cd02640)

![image](https://github.com/facebook/react-native/assets/1422161/6269968d-c0e8-489b-992e-0bb41b6ef7c6)

Switching to size_t fixes it.

## Changelog:
[Internal] [FIXED] - EventPerformanceLogger + BoundedConsumableBuffer - switch members to size_t

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

Test Plan: Builds on Windows

Reviewed By: fabriziocucci

Differential Revision: D57327696

Pulled By: javache

fbshipit-source-id: 21ec3a9597958aa70fbca64710bd615a1022292d
2024-05-14 05:34:37 -07:00