Commit Graph

32853 Commits

Author SHA1 Message Date
shubhamguptadream11 6cab6c2a13 feat(iOS): line break mode cpp changes and new functions (#46130)
Summary:
Solves this issue: https://github.com/facebook/react-native/issues/44107

## 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] - Line break mode for TextInput components. **This includes cpp changes and new functions.**

This PR is a breakdown of [this](https://github.com/facebook/react-native/pull/45968) PR.

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

Test Plan: - Tested builds in new and old architecture mode.

Reviewed By: andrewdacenko

Differential Revision: D61656894

Pulled By: cipolleschi

fbshipit-source-id: 9a25387cb27cded072e76575e6d2fca01963c621
2024-08-23 11:13:33 -07:00
Blake Friedman b22970e3cf autolinked package scripts use absolute path (#46186)
Summary:
A previous attempt at fixing this issue used a relative path (https://github.com/facebook/react-native/issues/45208), this doesn't work if the user runs bundle install outside of the `ios/`
folder, using the `--project-directory=ios` argument.

## Changelog:
[iOS][Fixed] support bundle install from outside the ios folder using --project-directory

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

Test Plan:
Ran the command in a project with `react-native-firebase/app` using the
`--project-directory`, confirmed that it's fixed when using the absolute
path.

closes: reactwg/react-native-releases#341

Reviewed By: cipolleschi

Differential Revision: D61719821

Pulled By: blakef

fbshipit-source-id: d83429dd29c9e8cc066ab9843ad95fdfc0af8dea
2024-08-23 09:56:09 -07:00
Kacper Rozniata d7a3e48032 feat(iOS): add support for missing text content types (#42788)
Summary:
This PR adds few missing text content types on iOS (available from iOS 15)

- dateTime
- flightNumber
- shipmentTrackingNumber

## Changelog:

[IOS] [ADDED] - Add support for missing text content types

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

Test Plan: Make sure that `RNTester` builds and runs successfully

Reviewed By: robhogan

Differential Revision: D61656748

Pulled By: cipolleschi

fbshipit-source-id: e960eded5f049d3c4bf76a5a4e3159b240546288
2024-08-23 09:19:41 -07:00
Jan Kassens 17613fcac3 remove unused method nativeFabricUIManager.cloneNode
Summary:
I couldn't find a reference nor a reason for this method. It's a bit hard to grep, so let me know if I missed something.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D61558809

fbshipit-source-id: d977440ff98b2a5bf115d19bfa4acbcf6d216b2a
2024-08-23 09:15:53 -07:00
zhongwuzw 6b104bbe01 Fixes race condition when setup image loader (#46153)
Summary:
Fixes https://github.com/facebook/react-native/issues/46115 .

## Changelog:

[IOS] [FIXED] - Fixes race condition when setup image loader

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

Test Plan: crash in https://github.com/facebook/react-native/issues/46115

Reviewed By: cipolleschi

Differential Revision: D61662905

Pulled By: andrewdacenko

fbshipit-source-id: 22bc45b473c7c8e1c811e41f5030220ca7988e1f
2024-08-23 08:08:58 -07:00
Deepanshu.shukla a8be335a37 fix (iOS): refresh control not behaving correctly if it is offscreen (#45996)
Summary:
FIXES https://github.com/facebook/react-native/issues/45858

When working with UIRefreshControl in a custom React Native component, we encountered a problem where the refresh control did not behave correctly if it was offscreen. Specifically, attempts to programmatically begin or end refreshing were ignored if the control was not visible. This typically manifested as the refresh control not updating its state properly when it was re-rendered or moved in the view hierarchy.
Happening only on old-arch.

**Problem Details**
**Offscreen Refresh Control Ignored:** The UIRefreshControl would ignore calls to beginRefreshing and endRefreshing if it was not currently visible on the screen.
**Inconsistent State:** The internal state _currentRefreshingState might not match the actual state of the UIRefreshControl, leading to unexpected behavior.

**Steps to Fix**
**Track Visibility with didMoveToWindow:**

Implement the didMoveToWindow method to track when the refresh control is added to or removed from the window.
Use a flag _hasMovedToWindow to keep track of this state.
And check this flag should be true whenever we start or end refreshing

## Changelog:

[IOS] [FIXED] - Fixed an issue where the refresh control would not behave correctly if it was offscreen.

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

Test Plan:
Issue Screen recording

https://github.com/user-attachments/assets/73b45c27-19c2-4eeb-991e-33b45f0a6d97

Fix Screen Recording :

https://github.com/user-attachments/assets/ffc6b6e6-fc68-498c-abdf-3144c31caa86

Reviewed By: realsoelynn

Differential Revision: D61657472

Pulled By: cipolleschi

fbshipit-source-id: 7a369f8e3ca902536a7608fbe1b89cec7734c418
2024-08-23 04:50:46 -07:00
Jorge Cabiedes Acosta 4075418c14 Add support for assymetrical border radii when using % (#46009)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46009

as title

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D61148739

fbshipit-source-id: 7cc37f98ab441df2e0df7cfa0415791cb642caaf
2024-08-22 21:03:28 -07:00
Samuel Susla 858ad5e9c9 move enableLayoutAnimationsOnIOS feature flag to common infra (#46174)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46174

changelog: [internal]

LayoutAnimation on iOS should be shipped everywhere except FBiOS.

Reviewed By: javache

Differential Revision: D61656839

fbshipit-source-id: b3903491cbdea81dd4424a69e58976ab470b33e2
2024-08-22 17:57:10 -07:00
Pieter De Baets 75114e3672 Fix ModalHostView's inner view not having the correct reactTag (#46176)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46176

Noticed that ModalHostView's event dispatching would sometimes fallback to RCTEventEmitter, which is not supported in the new architecture. Instead, we should propagate the reactTag to the inner content view so we can correctly associate the right UIManager and host component with events emitted.

Changelog: [Android][Fixed] PointerEvents from Modal would not be dispatched correctly in new architecture.

Reviewed By: bvanderhoof

Differential Revision: D61671005

fbshipit-source-id: 6aad1ff609da81cf5e8f71c4e91be30713494679
2024-08-22 15:16:24 -07:00
Tzvetan Mikov bb3c51dc84 RN: don't check for or add zero terminator to bundle (#45966)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45966

JSI performs the check itself, no need to do it here. Plus, bytecode
bundles must not be zero terminated.

## Changelog:

[IOS] [FIXED] - Fixes NSDataBigString length calculation

Reviewed By: realsoelynn

Differential Revision: D61058869

fbshipit-source-id: 15b99ef13f9aebd11ff410d02c21db8e46cc6ac3
2024-08-22 12:49:50 -07:00
Rubén Norte 1f755defdc Improve handling of disconnected nodes in IntersectionObserver (#46156)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46156

Changelog: [internal]

This improves the handling of disconnected nodes in `IntersectionObserver`. Specifically:
* When observing a node, if the node is disconnected (unmounted) this is just a no-op (without logging errors). We can't observe an unmounted node.
* When disconnecting the observer, if the observed nodes are disconnected, we get the target shadow node from an internal map, which we always have access to if we successfully started observing the node. If this logs an error now, it's something to look into but it won't generally log it if the target is just disconnected. That will work correctly.

Reviewed By: bvanderhoof

Differential Revision: D61656597

fbshipit-source-id: 6a39c878acc976ddc0789260106da104a3f2a57f
2024-08-22 12:23:37 -07:00
Rubén Norte 5fc2bd4f60 Improve handling of disconnected nodes in MutationObserver (#46157)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46157

Changelog: [internal]

This improves the handling of disconnected nodes in `MutationObserver`. Specifically:
* When observing a node, if the node is disconnected (unmounted) this is just a no-op (without logging errors). We can't observe an unmounted node.
* When disconnecting the observer, if the observed nodes are disconnected, we get the target shadow node from an internal map, which we always have access to if we successfully started observing the node. If this logs an error now, it's something to look into but it won't generally log it if the target is just disconnected. That will work correctly.

Reviewed By: bvanderhoof

Differential Revision: D61655856

fbshipit-source-id: d18a885350ef000fc563c85f6775ba864d184ad1
2024-08-22 12:23:37 -07:00
Joe Vilches 5bb4ef5dec Fix issue where filter layer was not the same shape as the underlying layer (#46138)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46138

jorge-cab noticed that filters on iOS do not fit the shape of the layer if we have rounded corners. Fix is pretty straight forward.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D61612655

fbshipit-source-id: 91785ed10a039e031c5440bde131c1583ba3992a
2024-08-22 12:12:46 -07:00
Jakub Piasecki 9bfbf948df Add line offset for baseline alignment of text attachments (#46172)
Summary:
In https://github.com/facebook/react-native/pull/45102 I've implemented a baseline alignment function for the new architecture. I've noticed one thing I've missed previously - `locationForGlyphAtIndex` is [relative to the line fragment](https://developer.apple.com/documentation/appkit/nslayoutmanager/1403239-locationforglyphatindex), not the container. This means that the attachments would be put in the wrong place in multiline text.

This PR fixes that by adding the position of the entire line to the attachment position.

## Changelog:

[IOS] [FIXED] - Fixed baseline attachment position in multiline text

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

Test Plan:
Checked on relevant example of RNTester.

|Before|After|
|-|-|
|<img width="546" alt="Screenshot 2024-08-22 at 15 53 14" src="https://github.com/user-attachments/assets/c1861655-9253-44fd-9f2f-796aff83df1e">|<img width="546" alt="Screenshot 2024-08-22 at 15 52 37" src="https://github.com/user-attachments/assets/27f07bc7-a8f6-4696-a414-815e7ece642c">|

Reviewed By: andrewdacenko

Differential Revision: D61662006

Pulled By: cipolleschi

fbshipit-source-id: 5eafdae1800c06d9fc61bfac99584e6e25a05c24
2024-08-22 10:41:01 -07:00
Phillip Pan 42dcfdd2cd avoid default when switching on UnitType (#46146)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46146

Changelog: [Internal]

`unit` is of type `UnitType`, so there's no reason to have a default case here.

i found this because my build failed when pulling in this dependency, there was a compiler flag that enforced that all cases must be enumerated. this seems like the right practice anyways.

Reviewed By: NickGerleman

Differential Revision: D61635463

fbshipit-source-id: b84b5518f2a17e792309f85ae91514a17abad295
2024-08-22 00:14:38 -07:00
Nick Gerleman 524a3f0476 Try fixing bundling outside the repo (#46148)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46148

Try fixing the import path (not sure if access from external modules is allowed though).

Changelog: [Internal]

Reviewed By: realsoelynn

Differential Revision: D61643115

fbshipit-source-id: a840ee375430b0e20050a36b695a5a4c93c29258
2024-08-21 23:19:56 -07:00
Thomas Nardone 81a41ec976 Clean up ReactViewGroup child listeners (#46139)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46139

Potential fix for IndexOutOfBounds crashes in clipping rect logic.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D61615009

fbshipit-source-id: 1208e11286ad2a84c22262462832a66396a1b35b
2024-08-21 15:43:34 -07:00
David Vacca 5f7538cfdd Add default value for newArchitectureEnabled param (#46140)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46140

Add default value for newArchitectureEnabled param

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D61621224

fbshipit-source-id: 728c91f9ce10ad5872f86cd223ea30c8f9bde413
2024-08-21 15:38:23 -07:00
Andrei Marchenko 954e294183 perf(virtualized-lists) removing rerender cells for every change of Virtualized list (#46103)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46103

Reducing the boundary of rerender of virtual lists. Previously with prop: "strictMode={true}" the VirtualizedList still re rendered each CellRenderer component. Because method getDerivedStateFromProps generated every time a new uniq state and the cells didn’t have a PureComponent. It helps to improve react performance for lists which have 5+ elements.

I reused recomended approach from react doc https://legacy.reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html#what-about-memoization

changelog: [internal]
Optimizing CellRenderer of VirtualizedList

Reviewed By: NickGerleman, sammy-SC

Differential Revision: D61493434

fbshipit-source-id: 917a33e48bd2f18e8ac150e5701d2e7c45dbe879
2024-08-21 14:23:07 -07:00
zhongwuzw 9239ad1c6b Clean up RCTParagraphComponentView & RCTParagraphTextView (#46125)
Summary:
Clean up some dead code after some refactoring of RCTParagraphComponentView.  cc cipolleschi

## Changelog:

[IOS] [FIXED] - Clean up RCTParagraphComponentView & RCTParagraphTextView

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

Test Plan: CI green.

Reviewed By: christophpurrer

Differential Revision: D61603193

Pulled By: cipolleschi

fbshipit-source-id: a357e8c5355707b2296462de513010acda4ee6ea
2024-08-21 12:19:33 -07:00
Soe Lynn b93c2b2412 Bump React Native CI to min iOS 15.1 (#46135)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46135

Changelog:
[iOS] - Bump iOS min version for CI

Reviewed By: cipolleschi

Differential Revision: D61604034

fbshipit-source-id: 5d2b0001b6437e62c64d821e36a4183096e8ef74
2024-08-21 12:11:58 -07:00
Soe Lynn d11c99922c Bump React Native OSS build infra to min iOS 15.1 (#46137)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46137

Changelog:
[iOS] - Bump OSS Build infra to min iOS 15.1

Reference: https://github.com/react-native-community/discussions-and-proposals/discussions/812

Reviewed By: christophpurrer

Differential Revision: D61577939

fbshipit-source-id: 8f2929af266f61aedd55358b13d08544fd79e434
2024-08-21 12:11:58 -07:00
Soe Lynn e1a1cdacf2 Update RNTester and HelloWorld to min iOS 15.1 (#46136)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46136

Changelog:
[iOS] - Update RNTester and HelloWorld template app to `min iOS 15.1`

Reviewed By: philIip, blakef

Differential Revision: D61604036

fbshipit-source-id: 9260b9b51a9c976792fd9d705b9b6a35a88a7f86
2024-08-21 12:11:58 -07:00
Krystof Woldrich 774fe0cf6f fix(react-native-xcode): Use CONFIG_CMD if set (#46112)
Summary:
In the recent 0.75 release I've noticed new `CONFIG_CMD` option in `react-native-xcode.sh`. But this option was not used. Insted when set `CONFIG_APP` was used.

This seems like a bug. As the usage before this PR would be as follow:

```bash
export CONFIG_CMD=true
export CONFIG_APP="/path/to/node /path/to/node_modules/react-native/cli.js config"
```

After this PR

```
export CONFIG_CMD="/path/to/node /path/to/node_modules/react-native/cli.js config"
```

This PR also removed unused explicite `--config-cmd "$CONFIG"` flag, as this is always overwriten by the code above, by default to `--config-cmd" "$NODE_BINARY $NODE_ARGS $REACT_NATIVE_DIR/cli.js config`.

## 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] - Use CONFIG_CMD if set

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

Test Plan: I've set `CONFIG_CMD` and run Xcode Release build to check that the set command is executed.

Reviewed By: christophpurrer

Differential Revision: D61545010

Pulled By: blakef

fbshipit-source-id: ebbf8ebc08404bc6816277518a3b86c6f7e41e6e
2024-08-21 08:16:37 -07:00
Riccardo Cipolleschi 9c16fb3394 Fetch Github tags in the publish-release job (#46131)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46131

React native 0.75.0, 0.75.1 and 0.75.2 has been published to NPM without the latest tag, despite the tag being on the commit.

When debugging why that's happened, I realized that we were not downloading the tags when checking out the repo.

This change fixes that.

{F1816667285}

## Changelog:
[Internal] - Publish React native as latest when the latest tag is specified on git

Reviewed By: cortinico

Differential Revision: D61593398

fbshipit-source-id: 96bf8346207f0bd0b01f60ee09879210d12d30af
2024-08-21 07:46:13 -07:00
Alex Hunt 516428771d Disable native source code fetching in jsinspector-modern targets (#46132)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46132

Temporaily disable the `nativeSourceCodeFetching` capability — which reverts this to the legacy handling in the Inspector Proxy.

This is because we've noticed performance issues when loading large bundle source maps, particularly on Android, with a nontrivial path to optimising this ([raising the frontend `IO.read` size](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/pull/97) further is leading to WebSocket disconnections on Android 😐).

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D61543480

fbshipit-source-id: ee66b4cebd40f8cc6466270c5875df744d2b588a
2024-08-21 07:02:42 -07:00
Samuel Susla a462dfd6ce delete change_order_of_mounting_instructions optimisation (#46113)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46113

changelog: [internal]

This showed promised in local tracing but that failed to translate to real perf improvement. Unshipping.

Reviewed By: christophpurrer

Differential Revision: D61537744

fbshipit-source-id: 03a2a69a6fed32a6b493bc17372e3783b9db2d1e
2024-08-21 06:04:57 -07:00
Tim Yung 8f0f50f7a1 Appearance: Cache colorScheme in JavaScript (#46122)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46122

Implements a JavaScript cache for `colorScheme` in the `Appearance` module, so that we avoid potentially expensive and unnecessary native property accesses.

Changelog:
[General][Changed] - Improved `Appearance.getColorScheme` performance

Reviewed By: rickhanlonii

Differential Revision: D61567880

fbshipit-source-id: ca316946d68114b05239daa17105c85e637efe07
2024-08-21 01:48:58 -07:00
Tim Yung ed3ca0730c Appearance: Dedupe colorScheme Validation Logic (#46120)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46120

Currently, the implementation of `Appearance` duplicates the validation logic of string `colorScheme` values multiple times.

This leads to more complicated code and also unnecessary work in certain edge cases (e.g. when `NativeAppearance` is not registered).

This refactors `Appearance` to be simpler and to do less work. I've also configured `NativeAppearance.setColorScheme` to be non-nullable because it has existed since 2023.

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D61567881

fbshipit-source-id: 61cb51709dc716ad97ae1397105414e74fe57a28
2024-08-21 01:48:58 -07:00
Tim Yung 693a575143 Appearance: Manage Native Listener Count (Android) (#46121)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46121

Updates `Appearance` on Android to supply the native module to `NativeEventEmitter` so that the native listener count can be managed like it is on iOS.

This was previously required by macOS and iOS. Android and Windows also already implement:

```
interface NativeModule {
  addListener(eventType: string): void;
  removeListeners(count: number): void;
}
```

So we should start passing `NativeAppearance` into the `NativeEventEmitter` constructor across all platforms.

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D61567883

fbshipit-source-id: 1b3b76de9be3f35cacba1acbc43f6dcc0b41fde5
2024-08-21 01:48:58 -07:00
Tim Yung a7fbe8117f Appearance: Migrate to ESM Named Exports (#46119)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46119

Straightforward migration of the `Appearance` module to use ESM named exports.

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D61567882

fbshipit-source-id: a4a5a9771de001bd41cb0e23ba066f150267a55d
2024-08-21 01:48:58 -07:00
Nick Gerleman 387560a9af Make StaticViewConfigValidator permissive of extra attributes on SVC compared to native viewconfig (#45859)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45859

"Fabric without SVCs" configuration is nearly gone, and so it doesn't make sense to need to add no-op methods, on normally Paper only code, etc to satisfy native viewconfig. These particular warnings are then more often noise, than things we need to action on.

Checking for native code to be present can also break development where users are using distributed native app, slightly older than JS.

This keeps the warning, only if static viewconfigs are missing native view config attributes (i.e. new prop would only be exposed to Paper, instead of only exposed to Fabric)

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D60575253

fbshipit-source-id: 1c118274b92eb7922c0dd92df060b24e44fceb3d
2024-08-20 18:58:07 -07:00
Ramanpreet Nara a949e0d751 Report early js exceptions on the js thread (#46116)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46116

If your app raises an early js exception, and you cold start it, often you'll see this error:

```
SurfaceRegistryBinding::startSurface failed. Global was not installed.
```

{F1807125099}

The reason why is because two different threads race to redbox:
* The nativemodule thread: the early js error (reported [here](https://fburl.com/code/vcrqzsdp))
* The javascript thread: the SurfaceRegistryBinding error (a subsequent native -> js call)

After this diff, the early js error will **not jump onto the nativemodule thread** to report this error.

This ensures that we "always" (to the best of my knowledge) see the early js error first.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D61339213

fbshipit-source-id: f1b9ab30150b87377817c2fd93ca349c406db48b
2024-08-20 17:50:55 -07:00
Nick Gerleman ee597bfe2b Breaking: Always use AttributedStringBox instead of AttributedString in TextLayoutManager (#46104)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46104

We want to use `PrecomputedText` to store glyph-level measurements on underlying Android Spannable. This means we need to consistently reuse the same Spannable, instead of recreating them on measurement.

We have an opaque cache ID used by Android, for spannables originating from uncontrolled TextInput on UI-thread side. We also have `AttributedStringBox`, for a kind of similar purpose on iOS, which allows passing opaque pointer to the `TextLayoutManager`. This is only used for the `measure` function.

This change makes us consistently use `AttributedStringBox` at the TextLayoutManager boundary, to let us migrate calls across TextLayoutManager to all pass opaque handle to underlying Spannable we will store, instead of passing the AttributedString each time. For now, every place previously passing an AttributedString value still passes one.

There were also some egregious cases of accepting very large structures by value, causing unneeded copies. I changed the APIs to accept anything potentially larger than two pointers to pass by reference instead.

This change is technically breaking, to any 3p code calling into TextLayoutManager (IIRC live-markdown exposed prefabs for this, but should be able to adapt fairly easily).

Changelog:
[General][Breaking] - Always use AttributedStringBox instead of AttributedString in TextLayoutManager

Reviewed By: joevilches

Differential Revision: D61484999

fbshipit-source-id: 07c5600cd917f2dab3d24559a25f27e0872ebddc
2024-08-20 17:27:51 -07:00
Nick Gerleman 3cd6d18aa8 Increase Example List Density (#46080)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46080

1. Force the examples to be alphabetized, where the hand-maintained list has some examples that are not
2. Remove reundant/not useful UI

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D61430910

fbshipit-source-id: 1f3e116fe81502faa7a72f2720912e26c9f04bb2
2024-08-20 16:48:38 -07:00
Nick Gerleman d713349b0c Replace "elevation" in RNTester rows with box-shadow (#46076)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46076

This will add the shadows to iOS as well. let's see if anyone notices 🙂. I also removed dead styles, and removed some of the extra (excessive) padding specific to Android where the previous shadows would overlap.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D61421903

fbshipit-source-id: 887fa5aa96e3b0b4f81114ee814897c218db2b76
2024-08-20 16:48:38 -07:00
generatedunixname89002005232357 2bbe8f44c6 Revert D61298649 (#46118)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46118

Changelog: [Internal]

Reviewed By: cyan33

Differential Revision: D61550740

fbshipit-source-id: 8c201b8f79416dec13ece9c671405af7b2de9c8c
2024-08-20 15:10:29 -07:00
Benoit Girard 5561457c98 Limit HermesPerfetto tracing to the top 25 and bottom 25 frames, allowing you to see both sides (#46117)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46117

Currently in large cursive blocks like layout effect we can't tell what the slow leaf function is. With this fixed I'm able to root cause more complex issues in layout effects.

Reviewed By: NickGerleman

Differential Revision: D61486415

fbshipit-source-id: 5a4043b35eedcabcbea86953aac2173f66d7257b
2024-08-20 13:25:45 -07:00
Alan Lee 67b4a5a2d1 Introduce extension function for PixelUtil (#46072)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46072

Introducing extension fuctions in PixelUtils to replace Java static methods so Kotlin code can be more readable.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D61372704

fbshipit-source-id: 489a74d60cd1463f0b1fad6f7c33925cec4000d2
2024-08-20 12:18:38 -07:00
shubhamguptadream11 f6b6d001a0 fix(android): status bar black strip fixed (#46086)
Summary:
Fixes these issues:
- https://github.com/facebook/react-native/issues/46070
- https://github.com/facebook/react-native/issues/39362

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

[ANDROID] [FIXED] - Fixed black strip coming when hiding status bar

`setHidden` function is responsible for hiding status bar

https://github.com/facebook/react-native/blob/25d6a152cc720e0d5f860dab228ac2e43321d9e4/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt#L122

**What real issue is?** **_For android devices with camera area on top a black strip is coming after hidding status bar._**

Previous Implementation:
```
  override fun setHidden(hidden: Boolean) {
    val activity = currentActivity
    if (activity == null) {
      Log.w(
          ReactConstants.TAG,
          "StatusBarModule: Ignored status bar change, current activity is null.")
      return
    }
    UiThreadUtil.runOnUiThread(
        Runnable {
          val window = activity.window ?: return@Runnable
          if (hidden) {
            window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
            window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
          } else {
            window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
            window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
          }
        })
  }
```
It seems that FLAG_FULLSCREEN flag are not enough to draw content in camera area.

**Solution:**
In order to tackle this, android exposes 2 flags:
- [layoutInDisplayCutOutMode](https://developer.android.com/reference/android/view/WindowManager.LayoutParams#layoutInDisplayCutoutMode):  The window is always allowed to extend into the [DisplayCutout](https://developer.android.com/reference/android/view/DisplayCutout) areas on the short edges of the screen. [Android 9.0 and above]
- [setDecorFitsSystemWindows](https://developer.android.com/reference/android/view/Window#setDecorFitsSystemWindows(boolean)):  allows content to be able to extend into the cutout area. [Android 10.0 and above]

By adding this flag we are now able to hide status bar properly.
```
  override fun setHidden(hidden: Boolean) {
    val activity = currentActivity
    if (activity == null) {
      FLog.w(
          ReactConstants.TAG,
          "StatusBarModule: Ignored status bar change, current activity is null.")
      return
    }
    UiThreadUtil.runOnUiThread(
        Runnable {
          val window = activity.window ?: return@Runnable
          if (hidden) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
              // Ensure the content extends into the cutout area
              window.attributes.layoutInDisplayCutoutMode =
                WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
              window.setDecorFitsSystemWindows(false)
            }
            window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
            window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
          } else {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
              window.attributes.layoutInDisplayCutoutMode =
                WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
              window.setDecorFitsSystemWindows(true)
            }
            window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
            window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
          }
        })
  }
```

**_Note: This will work above Android 11 and above_**

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

Test Plan:
- Tested by author of this issue
- Sharing here the videos of before and after fix

Device Detail:
Oneplus9 5G OS 11
**Before fix:**
https://github.com/user-attachments/assets/589098ff-a3fa-4962-a15b-ceacbfd03d2d

**After fix:**
https://github.com/user-attachments/assets/a87dd8e4-3624-4e09-99da-a14f9e19fcc6

Reviewed By: cipolleschi

Differential Revision: D61509889

Pulled By: alanleedev

fbshipit-source-id: 733962a3bed2efba71588a4d2fdf7c9c386bc3b4
2024-08-20 11:38:23 -07:00
David Vacca ed1410136f Remove overriding thread priority for RN Main Thread (#46101)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46101

Remove overriding thread priority for RN Main Thread as it is not possible to update main thread.

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D61448536

fbshipit-source-id: 44ec28a875e3208df042ac11bdd17a7287836ebb
2024-08-20 11:22:45 -07:00
David Vacca dee503812a Fix MessageQueueThreadImpl warnings (#46108)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46108

Fix MessageQueueThreadImpl warnings

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D60855886

fbshipit-source-id: d26a994ea7c4a100ba001862a4947417c1e0479d
2024-08-20 11:22:45 -07:00
zhongwuzw efa9711e35 Fixes Appearance user interface style when app run from background (#46021)
Summary:
Fixes https://github.com/facebook/react-native/issues/46015.

## Changelog:

[IOS] [FIXED] - Fixes Appearance user interface style when app run from background

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

Test Plan: Demo in https://github.com/facebook/react-native/issues/46015.

Reviewed By: christophpurrer

Differential Revision: D61536857

Pulled By: cipolleschi

fbshipit-source-id: ee06cb25b5fc4fa72d646efe212738e54b9ef858
2024-08-20 10:44:41 -07:00
Zhi Zhou 52888c0c1e fix: iOS crash occurring when navigating to a new app screen with a displaying modal (#45313)
Summary:
Our app is using the react-native v0.74.2 with the `react-navigation` lib for screen navigation, we're facing an issue in the built iOS app that when we try to navigate to a new app screen with the `react-navigation`'s `reset` or `replace` method and meanwhile there's a react native modal displaying, then the iOS app always crashes.

I saw there is already a relevant [PR](https://github.com/facebook/react-native/pull/38491) and discussion targeting this issue, but I still think it would be better if this kind of crash can be suppressed in the framework level, currently I guess it's common in the iOS apps based on react native.

## Changelog:

[IOS] [FIXED] - app crash happening when navigate to a new app screen with a displaying modal

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

Test Plan: More issue details and the reproduction steps can be found in this [PR](https://github.com/facebook/react-native/pull/38491) :)

Reviewed By: christophpurrer

Differential Revision: D61537167

Pulled By: cipolleschi

fbshipit-source-id: 3c0474d794b4216ebc073dd6558d2b6ae27492d2
2024-08-20 10:04:47 -07:00
Ingrid Wang 4fb518bbe9 Migrate off of iOS 13 deprecated API statusBarFrame (#46105)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46105

Changelog:

[iOS][Internal] Migrate from UIApplication.statusBarFrame to UIStatusBarManager.statusBarFrame

Reviewed By: cipolleschi

Differential Revision: D61499532

fbshipit-source-id: 1fe10600fcbaf54280b6d630cb92383b9cf091a3
2024-08-20 09:59:51 -07:00
Nicola Corti f4a979580d Set REACTNATIVE_MERGED_SO for React Native 0.76 (#46114)
Summary:
Setting a variable called `REACTNATIVE_MERGED_SO` so libraries/apps can selectively decide to depend on either libreactnative.so or link against a old prefab target (this is needed for React Native 0.76 on).

## Changelog:

[INTERNAL] - Set REACTNATIVE_MERGED_SO for React Native 0.76

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

Test Plan: CI

Reviewed By: hezi

Differential Revision: D61541372

Pulled By: cortinico

fbshipit-source-id: b16fa29ce6dd1670b452848e37cfcd7be15861e6
2024-08-20 08:49:54 -07:00
Blake Friedman 0bb085c7b6 Summary: Add changelog for 0.75.2 (#46111)
Summary:
## Summary:
Add changelog for 0.75.2

## Changelog:
[Internal] - Add changelog

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

Reviewed By: cipolleschi

Differential Revision: D61538106

Pulled By: blakef

fbshipit-source-id: 45c4ee97d294a11f04852936e44f25d05030182e
2024-08-20 06:51:37 -07:00
Riccardo Cipolleschi 31cbc77f52 Add internal end to end tests for text and background color with border width (#46068)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46068

This change adds some internal E2E tests to verify that the text is rendered properly on top of a solid background color when borderWidth is set

## Changelog
[Internal] - Add E2E tests

Reviewed By: cortinico

Differential Revision: D61392253

fbshipit-source-id: 76e11821eba96ac75b055c5fe94365197c0f9be2
2024-08-20 04:38:45 -07:00
Riccardo Cipolleschi f4609dbb5f Move RCTParagraphTextView drawing to contentView (#46081)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46081

This change fixes an issue that has been reported by OSS where a Text with both background color and borderWidth is not rendered properly.

The reason is that `RCTParagraphComponentView` uses the `drawRect` method which draws the text in the main view layer, while the parent `RCTViewComponentView` can apply an extraLayer on top of the base layer, drawing on top of the text.

This change moves the drawing of the text to an auxiliary view, `RCTParagraphTextView`, that is set as contentView of the `RCTParagraphView`. In this way, the text is drawn in a different view and can't be covered by the `_borderLayer`

## Changelog:
[Internal] - Introduce a RCTParagraphTextView to draw the text

Reviewed By: joevilches

Differential Revision: D61431369

fbshipit-source-id: 05467167186411fe42312f2ed956f5b5336de019
2024-08-20 04:38:45 -07:00
Riccardo Cipolleschi 0f4a405f28 Add Text example with BG and borderWidth
Summary:
This diff adds an example in RNTester to verify that we can draw text on top of a colored background and non uniform border radius.

As you can see from the test plan, the current code works well when:
* There is only the background color
* There is a background color and uniform cornerRadius
* There are non uniform border radius but the background is transparent.

The current code **does not** work when:
* there is a background and non-uniform border radius
* there is a background, uniform border radius and borderwidth

The reason why this happens is because:
* `RCTParagraphComponentView` draws the text in the View's main layer in the `drawRect` method
* `RCTViewComponentView` has a method `invalidateLayer` that, when there are non-uniform border radii o there is a borderWidth, it creates an extra `CALayer` with an image as content and that layer is put on top of the base layer, covering the text.

## Changelog
[Internal] - Add example to RNTester

Reviewed By: cortinico

Differential Revision: D61389317

fbshipit-source-id: 3e0a9e6c611190f90198a1b0b5855431b9f6ed12
2024-08-20 04:38:45 -07:00