Commit Graph

2290 Commits

Author SHA1 Message Date
Samuel Susla 7b577065a6 make sure logs reflect new class name (#46785)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46785

changelog: [internal]

Make sure logs match the class name

Reviewed By: rubennorte

Differential Revision: D63757693

fbshipit-source-id: 815e70e8ae38d99b1908d3aa2a9cfffdd9dc9851
2024-10-02 12:00:07 -07:00
Alex Hunt c430083fa0 Update modern inspector targets to directly send CDP title and description (#46780)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46780

This is primarily a debugger server change to better-align the `title` and `description` fields (visible in via the CDP `/json/list` endpoint), reporting them directly from the device.

For React Native users, the net effect of this change is to improve/align the display name for each debugger target in the CLI multi-select menu (`j` to debug). This change may also be useful for discovery in non-Fusebox frontends such as VS Code (`vscode-expo` extension).

Changes:
- Rename `title` prop on `InspectorPageDescription`/`IInspector::addPage` to `description` (no call site changes).
- Add `deviceName` param to `InspectorPackagerConnection`.
- Move the page `description` to the `description` JSON field.
- Update `InspectorPackagerConnection::Impl::pages()` to return new `title` and `description` fields.
- Align `OpenDebuggerKeyboardHandler` to display `title` field.
- Deprecate the nonstandard `deviceName` field.

**Before**

```
[
    {
        "id": "3c9f24bedab0e73fca6a1b295030e7af9346a8c0-1",
        "title": "React Native Bridgeless [C++ connection]",
        "description": "com.facebook.RNTester",
         ...
    }
```

The `description` field was previously the closest thing we had to a target identifier. Today, this is not needed, since we have the stable `reactNative.logicalDeviceId` field.

**After**

```
[
    {
        "id": "3c9f24bedab0e73fca6a1b295030e7af9346a8c0-1",
        "title": "com.facebook.RNTester (iPhone 16 Pro)",
        "description": "React Native Bridgeless [C++ connection]",
         ...
    }
```

The `title` field is now more human readable and aligned with what we render in the window title of React Native DevTools. The `description` field describes the type of debugger target (the specific React Native implementation).

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D63329456

fbshipit-source-id: cfe98f77e31c729431005925cfc66e2780ef8c72
2024-10-02 07:30:31 -07:00
Pieter De Baets c06b1e9a0b Rollout destroyFabricSurfacesInReactInstanceManager (#46778)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46778

This has been rolled out internally already and is a good cleanup for OSS too. We no longer use this config externally (BRIDGE+FABRIC) so this shouldn't actually affect the new arch rollout.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D63752084

fbshipit-source-id: da3025f7b072dc7b82f8de22ff247b3979ae64d0
2024-10-02 05:10:49 -07:00
Pieter De Baets 17f4c45eed Add missing lock in ReactInstanceManager#attachRootView (#46776)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46776

All other paths that touch `mAttachedReactRoots` uses this lock. We expect this to address a crash we're seeing in production where `startSurface` is invoked multiple times.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D63752083

fbshipit-source-id: f06d07aa70719945f6956fbf6e0cde3e9c8e8ed0
2024-10-02 05:10:49 -07:00
Ariel Lin d4ea147b41 add support for Android's "High Text Contrast" setting into AccessibilityInfo (#46746)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46746

This change adds `isHighTextContrastEnabled()` to `AccessibilityInfo` to enable access to Android OS's "High contrast text" setting option. It also adds a new event, `highContrastTextChanged`, to enable listeners to subscribe to changes on this setting.

## Changelog

[Android][Added] - Added `isHighTextContrastEnabled()` to `AccessibilityInfo` to read `ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED` setting value

Reviewed By: NickGerleman

Differential Revision: D63155444

fbshipit-source-id: 9829b40e6c183f6beba732190dc318894e9d9a3f
2024-10-01 19:57:46 -07:00
Nick Gerleman 267b250690 Cleanup background drawing feature flags (#46761)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46761

The legacy paths for this is all gone and non functional. We can clean thes up fully now.

Changelog: [Internal]

Reviewed By: rshest, Abbondanzo

Differential Revision: D63652264

fbshipit-source-id: cabc1af0098553c64f834e6bc30000ef7a942a4c
2024-10-01 12:46:29 -07:00
Riccardo Cipolleschi eaa780de1c Fix crash for Modal not attached to window manager (#46758)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46758

There are some occurrencies where the Modal results not attached to the Window, perhaps when the app is backgrounded.

This trigger an exception `java.lang.IllegalArgumentException: View=DecorView@b9f88af[AdsManagerActivity] not attached to window manager`.\

This was fixed already but the conversion from Java to Kotlin missed a condition in the `||` clause. We are adding it back.

## Changelog
[Android][Fixed] - Fix crash for Modal not attached to window manager

## Facebook
The original fix is in this diff  D22264672 by mdvacca
Also see this post: https://fb.workplace.com/groups/rn.support/permalink/27047414764880449/

Reviewed By: cortinico

Differential Revision: D63700769

fbshipit-source-id: bc8a44868d5cacb8822e1646c2b7643682f45e1b
2024-10-01 10:59:40 -07:00
Nicola Corti c441de5a47 Fix build warning for prepareGlog (#46756)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46756

prepareGlog was firing a warning due to a duplicate config.h file. Here I'm setting so that the file is always overridden (which is the desired behavior) to suppress this warning.

Changelog:
[Internal] [Changed] - Fix build warning for prepareGlog

Reviewed By: cipolleschi

Differential Revision: D63696664

fbshipit-source-id: 83b78afea09c4a5d39f341dd5b604cec466470ae
2024-10-01 10:04:57 -07:00
Nicola Corti 3cd46b9534 Do not reference setTranslucentBackgroundDrawable (#46754)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46754

This method has been deprecated since 0.76, but we're still using it inside our codebase.
I'm cleaning up the only usage of it replacing it with the implementation.

Changelog:
[Internal] [Changed] - Do not reference `setTranslucentBackgroundDrawable`

Reviewed By: cipolleschi

Differential Revision: D63695933

fbshipit-source-id: d39b13b584d3ac1406c61c3bf86b86b05dc984d9
2024-10-01 10:04:57 -07:00
Nicola Corti 41c6ad5597 Fix NPE on ReactTextInputManager.setTextDecorationLine (#46750)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46750

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

Fix is pretty straightforward, parameter is annotated as Nullable, but is accessed with a `.split` call.
This causes a crash when the `textDecorationLine` property is removed (i.e. is null).

Changelog:
[Android] [Fixed] - Fix NPE on ReactTextInputManager.setTextDecorationLine

Reviewed By: cipolleschi

Differential Revision: D63689492

fbshipit-source-id: 3424897cc40beaeb579e3affd0a87656ff43afee
2024-10-01 09:20:53 -07:00
Pieter De Baets 4ede9205a0 Fix BoxShadow support for platform colors (#46753)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46753

Colors can be more than just ints, so we need to use `ColorPropConverter` to convert it correctly. For ViewManagers, this happens automatically through the ReactProp annotation, but since this is a nested field, we need to manually apply it.

Changelog: [Android][Fixed] BoxShadow now supports platformColor.

Reviewed By: fabriziocucci

Differential Revision: D63693048

fbshipit-source-id: 26b1da24db1b6f319af8cef6f62e4739c3f65ee3
2024-10-01 08:30:25 -07:00
Nicola Corti 290258f00f Further Reduce Build Warnings (#46733)
Summary:
This further reduces the build warning coming from the Hermes build, which we can't do much about as we don't own that code.

## Changelog:

[Internal] [Changed] - Further Reduce Build Warnings

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

Test Plan: CI

Reviewed By: NickGerleman

Differential Revision: D63644753

Pulled By: cortinico

fbshipit-source-id: d0e65559715ac1fa2b920f4c3d3cf63b6171765d
2024-10-01 02:47:59 -07:00
Pieter De Baets 544c4ff75b Use HybridClassBase for frequently constructed objects (#46706)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46706

Simplifies object construction and collection, and avoids additional JNI roundtrips to set HybridData.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D63537781

fbshipit-source-id: 55df2785840ec8fcd5a7a08d2c7dd73c5b5fca82
2024-09-30 09:59:52 -07:00
Pieter De Baets 18faf68b48 Rename Binding to FabricUIManagerBinding (#46705)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46705

We have multiple classes in React Native Android acting as a binding layer (between C++ and Java, between C++ and JS). Make it more obvious this Binding is for (Android) FabricUIManager and flatten the (now) unused Binding interface.

Changelog: [Android][Removed] BindingImpl is no longer part of the public interface

Reviewed By: cortinico

Differential Revision: D63536329

fbshipit-source-id: 329d184c1889fbe804995211cdd339b50a7c9234
2024-09-30 07:31:56 -07:00
Pieter De Baets 8dd616410d Make more SurfaceHandler configuration go through UIManager Binding (#46701)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46701

Reduce the interface we expose in SurfaceHandler(Binding), and concentrate the logic in the FabricUIManager Binding.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D63536328

fbshipit-source-id: 5882bdd24fd3ca8f3d36210dca80587fee091dcf
2024-09-30 07:31:56 -07:00
Samuel Susla 4e38493d71 delete state alignment mechanism (#46658)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46658

changelog: [internal]

We are shipping a better solution: Runtime Shadow Node Reference Syncing which is being rolled out.

Reviewed By: lenaic, rubennorte

Differential Revision: D63456344

fbshipit-source-id: e70b7dd4be7bf0670366e5200a910195b929a14d
2024-09-30 04:59:49 -07:00
Nicola Corti d1f47f7ad5 Silence unnecessary Gradle outputs - Part 1 (#46704)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46704

Our build log for Gradle is extremely noisy due to Hermes.
Here I'm suppressing all the build output from Hermes as we can't really do much from that side of the build.

This should make it easier for folks on GitHub Actions to immediately spot where are failures.

Changelog:
[Internal] [Changed] - Silence unnecessary Gradle outputs

Reviewed By: GijsWeterings

Differential Revision: D63541175

fbshipit-source-id: d1a60098c317ff9e8c9575b5b8b2aab639f28f2f
2024-09-30 03:55:54 -07:00
Jorge Cabiedes Acosta fae572d815 Fix mixBlendMode not updating on Image state updates (#46680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46680

Since the parent of a view with mixBlendMode prop set is the one responsible for setting the compositing of the child, when updating mixBlendMode on a child we need to also invalidate the parent.

Changelog: [Android] [Fixed] - mixBlendMode now properly does state updates

Reviewed By: joevilches

Differential Revision: D63424394

fbshipit-source-id: 0eb15520f1087e25683853632943e64a66344481
2024-09-29 22:59:28 -07:00
Jorge Cabiedes Acosta d2c48f3b1a Remove experimental_ and cleanup mixBlendMode experiment (#46650)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46650

tsia

Changelog: [General] [Added] - Removed `experimental` prefix and fully released `mixBlendMode` prop

Reviewed By: joevilches

Differential Revision: D63407473

fbshipit-source-id: 892ababcfe19b82d3f4c73d3cbc13fb46b7425b6
2024-09-29 22:59:28 -07:00
Nick Gerleman 513e9669e7 Fix interactions between removeClippedSubviews and RTL by applying HorizontalScrollContentView translation during layout metric assignment (#46685)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46685

This attempts a similar fix to D59566611, but keeps the removedClippedSubviews logic as is, instead moving the current translation done in ReactHorizontalScrollContainerView onLayout to ShadowNode layout metric assignment (so the world is consistent from very early on, and `removeClippedSubviews` never sees coordinates before translation),

I suspect doing this at the ShadowNode layer might also result in some fixes to DevTools in RTL.

This should let us roll out setAndroidLayoutDirection again.

Changelog:
[Android][Fixed] - Fix interactions between removeClippedSubviews and RTL

Reviewed By: mdvacca

Differential Revision: D63318754

fbshipit-source-id: 828e103e2ad21c7e886e39c163474b10ebd5099e
2024-09-27 19:19:53 -07:00
Pieter De Baets 43af902693 Unbreak Android LayoutAnimation by making all surfaces go through Binding (#46691)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46691

In Bridgeless, ReactSurface would only call `registerSurface` when it started, which did not match the behaviour seen in startSurface(WithConstraints). Instead, make all calls to start the surface go through the FabricUIManager Binding so we can correctly configure `setMountingOverrideDelegate` which is required for layout animations.

Changelog: [Android][FIxed] LayoutAnimations work on full new architecture

Reviewed By: cortinico

Differential Revision: D63533635

fbshipit-source-id: f6d3db020bb2d7245f7b14f2407271d76837d40c
2024-09-27 08:32:31 -07:00
Ruslan Lesiutin 37756d7de5 fix: ReactDevToolsSettingsManagerModule in ReactModuleList for android (#46665)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46665

# Changelog: [Internal]

Looks like this module was missing on android for a while.

Reviewed By: huntie

Differential Revision: D63460309

fbshipit-source-id: 7146e7f2104f868d0f2b7271bd2c452608611ea3
2024-09-27 08:12:45 -07:00
Ruslan Lesiutin cf491d769f Libraries/DevToolsSettings -> private/reactdevtools/ReactDevToolsSettings (#46662)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46662

# Changelog: [Internal]

This should not have been a public API in the first place.

1. Moving this to `src/private`.
2. Removed some unused APIs, such as profiling settings.

Reviewed By: huntie

Differential Revision: D62965492

fbshipit-source-id: fb97eccaf647ce418f500b02d153263aa8632eee
2024-09-27 08:12:45 -07:00
Nicola Corti 1bdae07d89 Add Android implementation for DevMenu Module (#46694)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46694

The DevMenu module was never implemented on Android. This adds its implementation by mirroring the iOS implementation.

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

Changelog:
[Android] [Fixed] - Add missing Android implementation for DevMenu Module

Reviewed By: cipolleschi

Differential Revision: D63535172

fbshipit-source-id: 791e72b46b7d3264b98e85a73f2d9025dc3a2c7d
2024-09-27 07:49:52 -07:00
Nicola Corti 12dda31bc1 fix: ReactDelegate crashing New Architecture apps by invoking setContentView (#46671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46671

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

Currently `ReactFragment` and `ReactDelegate` don't work in OSS + New Architecture because we call `Activity.setContentView`
on the host activity.

That result on us replacing the whole activity layout, even when the user wants to use a Fragment.
As we do have `ReactActivityDelegate` that already does this:
https://github.com/facebook/react-native/blob/94b77938435693792e57c96d76691d58d7361530/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java#L138

So this call is unncessary.

I've also updated the relative documentation here:
https://github.com/facebook/react-native-website/pull/4232

Changelog:
[Android] [Fixed] - fix: ReactDelegate/ReactFragment crashing on New Architecture apps

Reviewed By: rozele

Differential Revision: D63464367

fbshipit-source-id: acbfbf7d68eb79657b811a5a9a0d3f72660ec94a
2024-09-27 01:49:38 -07:00
Nicola Corti 7176d11ce4 ReactFragment should properly instantiate ReactDelegate on Bridgeless (#46623)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46623

I've just noticed that ReactFragment is not properly instantiating the `ReactDelegate` with a ReactHost
when on Bridgeless. This causes Fragments to crash when the app is on bridgeless mode.

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

Changelog:
[Android] [Fixed] - ReactFragment should properly instantiate ReactDelegate on Bridgeless

Reviewed By: mdvacca

Differential Revision: D63319977

fbshipit-source-id: 08256e35b2769e18df2d24f870ec5d98e5574f85
2024-09-27 01:49:38 -07:00
David Vacca d93e67d02c Enable Microtasks, ModernRuntimeScheduler and NativeViewConfigsInBridgelessMode by default only for New Architecture (#46683)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46683

Enabling these Microtask, ModernRuntimeScheduler and NativeViewConfigsInBridgelessMode in BridgeMode is risky and leads to bugs.  In this diff I'm ensuring we only enable these flags when newArchitecture is enabled

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D63503519

fbshipit-source-id: 4ef757834b8f7fba595b3394735f4b91335d7c98
2024-09-26 22:02:42 -07:00
Nick Gerleman 3f880991aa Back out "Redo "[RN][Android] Convert ReactViewManager, ReactClippingViewManager to Kotlin""
Summary: Backing out the stack since a same crash that previously effected many apps appeared again, and there are changes soon landing that will add more conflicts.

Reviewed By: Abbondanzo

Differential Revision: D63493332

fbshipit-source-id: 4423bf41c793e00a0aa22d12a77bca69d3b1ae77
2024-09-26 15:50:26 -07:00
Nick Gerleman 8d22e3b249 Back out "Redo "[RN][Android] Convert ReactViewGroup to Kotlin""
Summary: Backing out the stack since a same crash that previously effected many apps appeared again, and there are changes soon landing that will add more conflicts.

Reviewed By: Abbondanzo

Differential Revision: D63493331

fbshipit-source-id: 44658ffc99eb4ebc947f95bb6e6bde105ac88c93
2024-09-26 15:50:26 -07:00
Nick Gerleman a886a2fa05 Back out "ReactViewGroup post-conversion cleanup"
Summary: Backing out the stack since a same crash that previously effected many apps appeared again, and there are changes soon landing that will add more conflicts.

Reviewed By: Abbondanzo

Differential Revision: D63493334

fbshipit-source-id: 175fc7b5b69aa2874c867e460ab102bb077a7cd8
2024-09-26 15:50:26 -07:00
David Vacca fc9fcb5976 Fix initialization of FeatureFlags in DefaultNewArchitectureEntryPoint (#46681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46681

Fix initialization of FeatureFlags in DefaultNewArchitectureEntryPoint

D60364016 introduced a bug, disabling Fabric and TurboModules when DefaultNewArchitectureEntryPoint is initialized with bridgless disabled

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D63474698

fbshipit-source-id: 8b5aaeeda564d3463d13448b0adc7e964015000e
2024-09-26 14:23:04 -07:00
Thomas Nardone 9cd83fa9ab ReactViewGroup post-conversion cleanup (#46668)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46668

Small tweaks post-Kotlin-conversion:
- Make `overflow` a var
- Replace `+ -` with `-`
- Clean up properties and move up init block
- Iterate over entire allChildren array to clean up listeners

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D63343964

fbshipit-source-id: 2e9022e2d7e54ac338d1003419d8959771f7f270
2024-09-26 13:11:07 -07:00
Thomas Nardone be5e2b5827 Redo "[RN][Android] Convert ReactViewGroup to Kotlin" (#46672)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46672

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63129923

fbshipit-source-id: 0734f564b38e3adba704edffe45511e671ae74ac
2024-09-26 13:11:07 -07:00
Thomas Nardone f775f6919f Redo "[RN][Android] Convert ReactViewManager, ReactClippingViewManager to Kotlin" (#46667)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46667

Pre-req for converting ReactViewGroup without affecting API visibility.
Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63129925

fbshipit-source-id: 3b31df7b5450adcc961bb677114fb94d944f1ce4
2024-09-26 13:11:07 -07:00
Pieter De Baets 3fbf5c72f3 Fix ReactSurfaceView-backed roots not reporting the end of pending transactions correctly (#46676)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46676

Changelog: [internal]

## Context

We recently "fixed" a problem in `MountingCoordinator` on Android where it would report that it doesn't have any pending transactions when, in fact, it does. The fix introduces a new method in that class to delay marking transactions as done until a mount hook is invoked for that surface.

That fixed the issue... by always reporting that there were pending transactions accidentally.

The reason for this bug is that the mount hook doesn't have access to the mounting coordinator of the surface if the surface is registered through some of the methods in `Binding.cpp` that don't add the surface to a registry. In that case, we can never mark the transactions as done and the mounting coordinator for those surfaces always report pending transactions incorrectly.

NOTE: this bug only affects apps that have the `fixMountingCoordinatorReportedPendingTransactionsOnAndroid` feature flag enabled.

## Changes

This fixes the issue by making sure that surfaces are always registered in the registry and that we can access their mounting coordinators in the mount hook to report the transactions as done.

Reviewed By: rubennorte

Differential Revision: D63466672

fbshipit-source-id: a621a12cda89a3ab7331d3c6a16c6cdfa9341821
2024-09-26 11:32:00 -07:00
Pieter De Baets 04da3d784b Error in reportMount when surface is not found (#46678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46678

I'm investigating some issues with surface management and noticed `surfaceHandlerRegistry_` is not updated in the bridgeless path when using ReactSurfaceView.

Adding a warning to help us validate this is resolved when we do eventually fix it.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D63463521

fbshipit-source-id: 38995924588f1d71b9fc517c76a6e0c572fd0699
2024-09-26 11:32:00 -07:00
David Vacca 10a33e0479 Migrate ReactFeatureFlags.enableFabricRenderer -> ReactNativeFeatureFlags (#46493)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46493

Migrate:
- ReactFeatureFlags.enableFabricRenderer -> ReactNativeFeatureFlags.enableFabricRenderer()
- ReactFeatureFlags.useTurboModules -> ReactNativeFeatureFlags.useTurboModules()
- Rename ReactFeatureFlags.enableBridgelessArchitecture -> ReactNativeFeatureFlags.enableBridgelessArchitecture()

changelog: [Android][Breaking] Delete useTurboModules, enableFabricRenderer and enableBridgelessArchitecture fields from ReactFeatureFlags class

Reviewed By: rubennorte

Differential Revision: D60364016

fbshipit-source-id: e10a44fc08deb8969104b5cb0bd426dfb0a45d30
2024-09-26 04:29:27 -07:00
Michael Troger 7dcb10b6e7 Fix YogaConfig getting garbage collected #1678 (#46651)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46651

Fixes [https://github.com/facebook/yoga/issues/1678](https://github.com/facebook/yoga/issues/1678)

As described in the linked Issue, the problem is that the `YogaConfig` can get garbage collected by the JVM, while a `YogaNode` is still referring to it. This at some point leads to unexpected behaviour (0 values for `layoutWidth`/`layoutHeight`). The change coming with this PR makes sure the `YogaConfig` can not get garbage collected while it's used by a `YogaNode`.

Demo project to confirm the fix https://github.com/michaeltroger/yogabug

Kudos to rtPag, who helped identifying the issue.

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

Reviewed By: mdvacca

Differential Revision: D63416127

Pulled By: NickGerleman

fbshipit-source-id: efd87dac897e44d3664c228c40cda90f1e11c4f6
2024-09-25 23:53:17 -07:00
Joe Vilches 8eadb84d32 Expose box sizing getters and setters in Yoga (#46630)
Summary:
X-link: https://github.com/facebook/yoga/pull/1701

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

I would like to write some tests for box sizing that will drive a lot of my development as I implement content box. To do that, I need this publicly exposed. Obviously not that ideal since this currently does not do anything. Maybe we can name the value in such a way that its clear it is in development?

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63135970

fbshipit-source-id: 7520823bf925364eae45341531e012e80ec92284
2024-09-25 15:46:55 -07:00
Pieter De Baets 0cb32d5ac9 Cleanup Fresco SystraceRequestRequestListener (#46626)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46626

Remove `!!` by reusing lookup result.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D63316175

fbshipit-source-id: 1abfb20490831f26819aef4393c9629253d33ec6
2024-09-24 13:40:47 -07:00
Nick Gerleman fc8224036b Fix measuring text with incorrect hyphenationFrequency
Summary:
A typo means TextLayoutManager will incorrectly measure text as if `LineBreaker.HYPHENATION_FREQUENCY_NORMAL` is set, instead of the correct default of `LineBreaker.HYPHENATION_FREQUENCY_NONE` which we use to display the `TextView`. This causes truncation if hyphenation would have caused text to be shorter than if not hyphenated. Fix the typo.

Changelog: [Android][Fixed] - Fix measuring text with incorrect hyphenationFrequency

Reviewed By: mellyeliu

Differential Revision: D63293027

fbshipit-source-id: baaf2ae2676548cf0815ae96e324af273be6f99e
2024-09-23 17:52:30 -07:00
Jorge Cabiedes Acosta 7ab0002799 Disable outline props on old architecture (#46608)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46608

tsia

Changelog: [Android][Changed] - Disabling `outline` props on Android to stay consistent with iOS

Reviewed By: NickGerleman

Differential Revision: D63143626

fbshipit-source-id: 3eafe5beeb54b1619d94fe3d886ab19d445a0b09
2024-09-23 13:46:32 -07:00
Jorge Cabiedes Acosta 8ad4b7d0cf Fix outline drawing 1px width when outlineWidth = 0 (#46586)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46586

When Paint.strokeWidth is set to 0 its not actually 0 but "hairline mode" so  the fix is just to make outline not draw at all when outlineWidth = 0 {F1879399325}

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D63136220

fbshipit-source-id: 81ef7ce0b72158c6b7c332191d332008c5a919b4
2024-09-23 11:57:39 -07:00
Pieter De Baets b846f94b1c Refactor FabricMountingManager to enable reuse of IntBuffer methods (#46600)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46600

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D63150556

fbshipit-source-id: 039a88d6444df53767be52b9e70c20ef2ffd99be
2024-09-23 09:08:00 -07:00
Pieter De Baets 300db67b27 Remove unused FabricComponents mapping (#46591)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46591

This is a duplicate of FabricNameComponentMapping, which is not exposed. Checking GitHub codesearch, this API is not referenced elsewhere.

This component should be cleaned, with the mappings moved to a generic translation layer (eg in [ViewManagerRegistry](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java#L55)) or by fixing the JS callers.

Changelog: [Android][Removed] FabricComponents is removed from public API

Reviewed By: fabriziocucci

Differential Revision: D63099721

fbshipit-source-id: 7018deadc919e21cdf3482ae454baca72937611f
2024-09-23 07:12:09 -07:00
Pieter De Baets be7b78ec9d Use CopyOnWriteArrayList for ReactHostImpl lifecycle listeners (#46567)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46567

Switch to a simpler data structure which avoids locking and doesn't require copies when iterating. This is more consistent with other listener arrays in React Native.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62872893

fbshipit-source-id: b0ce6a904d25057f0217f7de7ec2928c8b2d1f34
2024-09-23 04:32:13 -07:00
Jakub Piasecki bd323929dc Add a workaround for text being measured incorrectly when ending with an empty line (#42331)
Summary:
It looks like `StaticLayout` used for measuring multiline text on the new architecture returns wrong metrics for the last line if it's empty, however, if it contains anything, then the returned values are correct.

Similar approach with measuring `I` was already used in `ReactEditText`: https://github.com/facebook/react-native/blob/258d8e51b451b221e557dad4647cbd210fe37392/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L1203-L1213

## 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] - Fixed text being measured incorrectly when ending with an empty line on the new architecture

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

Test Plan:
<details>
<summary>I tested the change on this simple code on React Native 0.73.2 (with the new arch enabled)</summary>

```jsx
import React from 'react';
import {useState} from 'react';
import {SafeAreaView, TextInput} from 'react-native';

export default function App() {
  const [text, setText] = useState('ABC\nDEF\nGHI\n');

  return (
    <SafeAreaView style={{flex: 1}}>
      <TextInput
        value={text}
        onChangeText={setText}
        style={{borderWidth: 1, margin: 20, padding: 30}}
        multiline
      />
    </SafeAreaView>
  );
}
```

</details>

Before:

https://github.com/facebook/react-native/assets/21055725/0787cc86-70c6-4238-b93a-87984e527a83

After:

https://github.com/facebook/react-native/assets/21055725/2acf619f-5cb4-4869-9576-cb8cc081c15b

Reviewed By: cipolleschi

Differential Revision: D62873674

Pulled By: cortinico

fbshipit-source-id: cc2481b1924a13af7326cfc16c59b9390f0d06d8
2024-09-21 06:34:21 -07:00
David Vacca 151008f8c2 Back out "Convert ReactViewManager, ReactClippingViewManager to Kotlin" (#46581)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46581

Original commit changeset: 09a81c91a1c9

Original Phabricator Diff: D62776270

changelog: [internal] internal

Reviewed By: bvanderhoof

Differential Revision: D63076764

fbshipit-source-id: 9cbd8ab86be356a7c35e44c86a95b80342c3da76
2024-09-19 22:56:17 -07:00
David Vacca d721d83149 Back out "Convert ReactViewGroup to Kotlin" (#46580)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46580

Original commit changeset: 780350e7e449

Original Phabricator Diff: D62642663

changelog: [internal] internal

Reviewed By: bvanderhoof

Differential Revision: D63076763

fbshipit-source-id: 01d3949c13129b71d5c96f19682bb24c51ff2552
2024-09-19 22:56:17 -07:00
Thomas Nardone 66c3074c65 Convert ReactViewGroup to Kotlin (#46577)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46577

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D62642663

fbshipit-source-id: 780350e7e449ffd2d6378cbed6f4381e34636a24
2024-09-19 13:20:15 -07:00