Commit Graph

33844 Commits

Author SHA1 Message Date
Riccardo Cipolleschi
4192678bd7 Pin Xcodeproj to < 1.26.0 (#47237)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47237

The Xcodeproj gem has been released yesterday to version 1.26.0 and it broke the CI pipeline of react native.

This should fix the issue

## Changelog
[Internal] - Pin Xcodeproj gem to 1.26.0

Reviewed By: blakef

Differential Revision: D65057797

fbshipit-source-id: f4035a1d3c75dd4140eb1646ab2aa0ccb08fb16b
2024-10-28 04:20:31 -07:00
Pieter De Baets
dc2000c875 Improve correctness of textTransform: capitalize (#47219)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47219

We received reports that textTransform does not correctly match the web behaviour for capitalize, eg. capitalized characters should not be lowercased when using `capitalize`.

Example input: 'hello WORLD', should become 'Hello WORLD'.

Changelog: [General][Fixed] TextTransform: capitalize better reflects the web behaviour

Reviewed By: NickGerleman

Differential Revision: D65023821

fbshipit-source-id: 8ba5fdbd7afb1460193bf82a2f4021c3aff2110a
2024-10-26 17:57:26 -07:00
Jakub Piasecki
33e1ae13f8 Add tests for LayoutableChildren iterator
Summary:
Adds unit tests that directly cover the order in which `LayoutableChildren` iterator goes over the descendant nodes. The covered cases are as follows (nodes with `display: contents` are marked green):

### Single `display: contents` node

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

B --> D((D))
B --> E((E))

style B fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `A, D, E, C`

### Multiple `display: contents` nodes

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

A --> D((D))
A --> E((E))

B --> F((F))
B --> G((G))

C --> H((H))
C --> I((I))

style A fill:https://github.com/facebook/yoga/issues/090
style B fill:https://github.com/facebook/yoga/issues/090
style C fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `D, E, F, G, H, I`

### Nested `display: contents` nodes

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

B --> D((D))
B --> E((E))

E --> F((F))
E --> G((G))

style B fill:https://github.com/facebook/yoga/issues/090
style E fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `A, D, F, G, C`

### Leaf `display: contents` node

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

style B fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `A, C`

### Root `display: contents` node

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

style R fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `A, B, C` - `LayoutableChildren` goes over the children with `display: contents` property, setting it on the root node should have no effect.

Changelog: [Internal]

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

Reviewed By: joevilches

Differential Revision: D64981779

Pulled By: NickGerleman

fbshipit-source-id: ee39759c663a40f96ad313f1b775d53ab68fb442
2024-10-25 18:01:20 -07:00
Samuel Susla
db09e7c2e5 delete shouldYield from commit options (#47191)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47191

changelog: [internal]

not used, let's delete it.

Reviewed By: javache, rubennorte

Differential Revision: D64916432

fbshipit-source-id: 182848c85ca58d4e8fae3c6ab67c781807803dff
2024-10-25 17:41:06 -07:00
Jakub Piasecki
a88ddcecc9 Fix for nodes with display: contents not being cleaned in some cases (#47194)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47194

Fixes a case where a node with `display: contents` would not be cleaned up in some cases. This was caused by it being called after some early returns handling different quick paths. This PR moves the call to `cleanupContentsNodesRecursively` earlier so that it's always called.

The problem here wasn't mutating before cloning, but leaving a node marked as dirty after the layout has finished.

The exact case in which I found this was a node with a single `display: contents` child which needs to be a leaf. Then in the parent node [this](b0b842d5e7/yoga/algorithm/CalculateLayout.cpp (L1339)) condition is true, so `cleanupContentsNodesRecursively` doesn't get called and the child node is never visited and cleaned. I assume the same will happen in the other paths with an early return here.

Changelog:
[General][Fixed] - Fix for nodes with `display: contents` not being cleaned in some cases

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

Reviewed By: rozele

Differential Revision: D64910099

Pulled By: NickGerleman

fbshipit-source-id: 6d56f8fbf687b7ee5af889c0b868406213c9cee8
2024-10-25 17:34:36 -07:00
Ramanpreet Nara
4f47439a02 cleanup: ExceptionsManager: Delete updateExceptionMessage (#47167)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47167

I couldn't find any usages of this method in javascript.

Removing, so that the native code is easier to read.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64606928

fbshipit-source-id: 1d52d58437370ae3d99e9c44500080687f137191
2024-10-25 15:12:40 -07:00
Ramanpreet Nara
f8788963b9 cleanup: ExceptionsManager: Delete reportUnhandledException (#47166)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47166

This method wasn't used from javascript.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64607415

fbshipit-source-id: 2fb7eeee9479de85284d05629ed8e1bfb9fa5917
2024-10-25 15:12:40 -07:00
Ramanpreet Nara
0941b51e9d earlyjs: Make ExceptionsManager the js interface for c++ pipeline (#47165)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47165

The c++ pipeline needs a javascript interface.

We could just re-use exceptions manager (for now).

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64779068

fbshipit-source-id: 4e300668a01fa22e194ea9f149ef1d936d5e0834
2024-10-25 15:12:40 -07:00
Ramanpreet Nara
2247e0b983 earlyjs: Make JsErrorHandler work for all js throwables
Summary:
Now, handleError can be called with a JSError that wraps a non-error object!

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64706198

fbshipit-source-id: 562ed7d4e2a13eaef48acfdf3499296462e54166
2024-10-25 15:12:40 -07:00
Samuel Susla
3fff4cf966 delete MountingCoordinator::Shared typealias (#47207)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47207

changelog: [internal]

delete typealias `MountingCoordinator::Shared` and use `std::shared_ptr<const MountingCoordinator>` directly.

Reviewed By: christophpurrer

Differential Revision: D64917023

fbshipit-source-id: 586ffcd5d22ea48b22d8a6cf86aa5fdf87fdefd0
2024-10-25 12:51:57 -07:00
David Vacca
eddc0a1d49 Delete CoreFeatures class (#45626)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45626

I'm deleting CoreFeatures class and all its imports because it was fully replaced by ReactNativeFeatureFlags

Changelog: [Internal][Removed] Delete CoreFeatures class in favor of ReactNativeFeatureFlags

Reviewed By: rubennorte

Differential Revision: D60137380

fbshipit-source-id: 8bf918cdd1ce66e315aa95e1c5a28879445ff9f9
2024-10-25 08:32:20 -07:00
David Vacca
a01e2e4165 Delete CoreFeatures::excludeYogaFromRawProps (#45627)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45627

I'm deleting CoreFeatures::excludeYogaFromRawProps in favor of ReactNativeFeatureFlags::excludeYogaFromRawProps();

changelog: [internal] internal

Reviewed By: rubennorte

Differential Revision: D60124448

fbshipit-source-id: 1dfec40d638c4051ebfebe712abe0bee6764e584
2024-10-25 08:32:20 -07:00
David Vacca
26278b10b1 Migrate enableCppPropsIteratorSetter to ReactNativeFeatureFlags (#45602)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45602

Migrate enableCppPropsIteratorSetter to ReactNativeFeatureFlags

Changelog: [Internal] internal

Reviewed By: rubennorte

Differential Revision: D60022936

fbshipit-source-id: 88fe6f41af3dea0ac5de4a097901a7e8df39efb2
2024-10-25 08:32:20 -07:00
David Vacca
143b9d172c Expose JSBundleLoader as parameter of DefaultReactHost (#47179)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47179

In this diff I'm exposing the new parameter (JSBundleLoader) as parameter of DefaultReactHost.

changelog: [Android][Breaking] Added JSBundleLoader as parameter of DefaultReactHost

Reviewed By: cortinico

Differential Revision: D64381501

fbshipit-source-id: dd0d56441802f7db53c67c659bbcae63c4b1b613
2024-10-25 02:08:32 -07:00
David Vacca
80f846948a Remove unused dependencies from facebook/react/interfaces (#47115)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47115

Remove unused dependencies from facebook/react/interfaces

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D64585748

fbshipit-source-id: fd42b63dd25cb4b6d4d7bb4f05912cff3f167db8
2024-10-25 02:08:32 -07:00
David Vacca
2cb5198f1b Delete CompositeReactPackage from RN (#47128)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47128

Delete CompositeReactPackage from RN, these classes were deprecated for a long time and they can be deleted now, there are no internal usages

changelog: [Android][Breaking] Deleting deprecated CompositeReactPackage

Reviewed By: cortinico

Differential Revision: D64382211

fbshipit-source-id: d4fdfd51177612a64dde918cd68d6e852ef1b0e2
2024-10-25 02:08:32 -07:00
Parsa Nasirimehr
795a21a471 fix(iOS): migrate from depracated websocket method in RCTCxxInspectorWebSocketAdapter (#47197)
Summary:
Saw this while going through the remaining warnings of the project. I double checked, and i can't find any other usages left behind, so this is probably the last one

## Changelog:

[INTERNAL] [FIXED] - Switch to using the new sendString method for Websocket

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

Test Plan:
yarn test:
<img width="933" alt="Screenshot 2024-10-25 at 00 55 58" src="https://github.com/user-attachments/assets/dbfebb90-4957-4fc9-8a90-153c03055ac9">
Running the tests in Xcode with `CMD+U` or the objc-test: I could not get it to pass in either the old code or the modified code. I know the test documentation said it needs a WebSocket, but it was a bit too vague , and even turning metro on did not help, so i have no idea how to test it. If anyone can guide me on that one, please let me know

Reviewed By: blakef

Differential Revision: D64934981

Pulled By: cipolleschi

fbshipit-source-id: c6f13d3da5aafe3eed8b99b98f04904fcdcc4115
2024-10-24 23:49:13 -07:00
Blake Friedman
94fdc38822 fix: mitigate DangerJS transpilation bug (#47192)
Summary:
Danger seems to have a bug where it's not transpiling the import of
rnx-kit/rn-changelog-generator. This mitigates the issue to get our
project back on track.

This can be replicated locally by:

```bash
DEBUG="*" DANGER_GITHUB_API_TOKEN=$GITHUB_TOKEN yarn danger pr https://github.com/facebook/react-native/pull/47182
```
You can see it running correctly here when switching to the branch with the fix.  **I'm a little concerned that this is still failing on the PR**.  Thoughts?

 {F1946190275}

Changelog: [internal]

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

Reviewed By: cortinico

Differential Revision: D64924466

Pulled By: blakef

fbshipit-source-id: 68df0521620809effe3a78ce842e043382ad64a6
2024-10-24 20:07:20 -07:00
Riccardo Cipolleschi
e851e73c18 Add yoga to app search paths (#47195)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47195

When a user wants to create a Fabric Component i their app (not in a separate library) the app fails to build because:
- The custom component has to inherit from `RCTViewComponentView`
- `RCTViewComponentView` imports `ViewProps.h`
- `ViewProps.h` imports `HostPlatformViewProps.h`
- `HostPlatformViewProps.h` imports `BaseViewProps.h`
- `BaseViewProps.h` imports `YogaStylableProps.h`

which is a Yoga private header and the App has not visibility over it.

It is also not possible to fix this issue with forward declaring the `YogaStylableProps`, because `BaseViewProps` inherit from the yoga's props, so the compiler needs the full declaration of `YogaStylableProps` to work

This needs to be picked in 0.76

## Changelog
[iOS][Fixed] - Give apps access to Yoga headers

Reviewed By: blakef

Differential Revision: D64925222

fbshipit-source-id: e724076bbfb0a678948340dfab2ce609e6509533
2024-10-24 17:16:50 -07:00
Sunny Luo
d293fdd27a Add jsBundleFile to DefaultReactNativeHost.kt (#47188)
Summary:
The JsBundleFilePath has been ignored when converting DefaultReactNativeHost to ReactHost

Changelog:
[Internal] [Changed] - Add jsBundleFile to DefaultReactNativeHost.kt

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

Reviewed By: javache

Differential Revision: D64914149

Pulled By: cortinico

fbshipit-source-id: d437ca81df5a170e0c5f01a22ccda83f43a09dd2
2024-10-24 14:59:21 -07:00
David Vacca
70c7616535 Make ReactHost.createSurface() method non nullable (#47189)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47189

ReactHost.createSurface() should not return a nullable surface, I'm changing that here.

changelog: [Android][Breaking] Make ReactHost.createSurface() method non nullable

Reviewed By: tdn120

Differential Revision: D64910107

fbshipit-source-id: ce8c5efd2c1e36eba0a85ae89cd1cd2a6305e885
2024-10-24 13:04:23 -07:00
Thomas Nardone
d825a4d712 Add OnLayoutChange API for scroll views (#47177)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47177

Changelog: [Android][Added] Add OnLayoutChange API for scroll views

Reviewed By: lyahdav, mdvacca

Differential Revision: D64843826

fbshipit-source-id: 3161730ccd0b3816d1704d07a02714a2ff04ae3a
2024-10-24 11:05:38 -07:00
Alan Lee
ba061a5d18 Bump NDK to 27.1 (#46357)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46357

Bumping NDK to 27.1.12297006 as we need it to build native libraries with 16KB page size support.

See:
- Changelog r27: https://github.com/android/ndk/wiki/Changelog-r27
- 16KB page sizes: https://developer.android.com/guide/practices/page-sizes

Changelog:
[Android] [Changed] - Android NDK to 27.1

Reviewed By: cortinico

Differential Revision: D62278654

fbshipit-source-id: 9968a45d9f41031571dfa1bb1671d6ad71d0644d
2024-10-24 10:58:09 -07:00
Alan Lee
37375d8aba bump Folly to 2024.10.14.00 (#47033)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47033

Lastest Folly has updates to fix build errors with LLVM 19 which is also llikely needed for NDK 27

- bf46c8a21f

- also add folly's new dependency fast_float
- update fmt version

Changelog:
[General][Changed] - Bump Folly to 2024.10.14.00

Reviewed By: NickGerleman

Differential Revision: D64372125

fbshipit-source-id: 1a88f1bc2af7bedce96437f2dba5b6e0fe9ea772
2024-10-24 10:10:19 -07:00
Riccardo Cipolleschi
dc7e9e2d83 Exclude generation of app-defined components from RCTThirdPartyFabricComponentsProvider (#47176)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47176

While writing the guide for the New Architecture, we realized that we need to exclude the generation of the Cls function in the RCTThirdPartyFabricComponentsProvider for components defined in the app.

This is needed because a component that is defined in the app will have those function defined in the app project. However, the RCTThirdPartyFabricComponentsProvider is generated in Fabric, inside the Pods project.

The pod project needs to build in isolation from the app and cocoapods then link the app to the pods project. But the compilation of the pods project fails if one of the symbol needed by the pods lives in the app.

By disabling the generation of that function in th RCTThirdPartyFabricComponentsProvider, we can successfully build the app.

The downside is that the user needs to register the component manually, but this is not an issue because if they are writing a component in the app space, they have all the information tomanually register it in the AppDelegate

## Changelog
[iOS][Fixed] - Do not generate the ComponentCls function in the RCTThirdPartyFabricComponentsProvider for components deined in the app.

Reviewed By: cortinico, blakef

Differential Revision: D64739896

fbshipit-source-id: 0eca818ea0198532a611377d14a3ff4c95cb5fe3
2024-10-24 09:36:07 -07:00
Sam Zhou
ad341e3969 Add as const cast and make types readonly to prepare for natural inference (#47184)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47184

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D64859497

fbshipit-source-id: 2cff5e2671e210a4e8cefb5a2d8c0fb56d5a0d1b
2024-10-23 23:32:37 -07:00
David Vacca
5e21232717 Assert enableBridgelessArchitecture is true when starting Bridgeless (#47145)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47145

Staring Bridgeless without previously setting ReactNativeFeatureFlags.enableBridgelessArchitecture() is UB, we should assert enableBridgelessArchitecture is true when starting Bridgeless

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D64641081

fbshipit-source-id: d7964f8a9d5a2e6dad9d44b8fd5cd5a52d1b2cf4
2024-10-23 22:53:44 -07:00
Cody Pizzaia
2d97a6ccb0 Revert D64631346: Use RuntimeScheduler in EventBeat
Differential Revision:
D64631346

Original commit changeset: b82dca150c13

Original Phabricator Diff: D64631346

fbshipit-source-id: 89ef52e5891d9fef33494fbfcc4252cade4aa803
2024-10-23 19:50:46 -07:00
Cody Pizzaia
020e1b6e86 Revert D64287526: batch sync events based on event beats
Differential Revision:
D64287526

Original commit changeset: a5dc3b643ef1

Original Phabricator Diff: D64287526

fbshipit-source-id: 9c967bd2573dc69bfbde69a7a79046e9d58fcb21
2024-10-23 19:44:14 -07:00
Phillip Pan
538bff710f clean up RCTTurboModuleInteropForAllTurboModulesEnabled (#47148)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47148

Changelog: [iOS][Breaking]

This param was used to validate that the TurboModule interop layer could handle scale. Let's clean it up.

the only callsites are in forks: https://github.com/search?q=RCTEnableTurboModuleInteropForAllTurboModules&type=code&p=3, so this should be safe to delete.

Reviewed By: realsoelynn

Differential Revision: D64718453

fbshipit-source-id: 8bc6c1943a231389c74fd0114dfb7c54dd6c8614
2024-10-23 13:33:47 -07:00
Liron Yahdav
15eadbee14 batch sync events based on event beats (#47147)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47147

By batching sync events if multiple events are dispatched during sync rendering this will reduce the number of re-renders.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D64287526

fbshipit-source-id: a5dc3b643ef1853bef9e38ce8c2f5db75e02214b
2024-10-23 13:15:45 -07:00
Liron Yahdav
22b60c576b Use RuntimeScheduler in EventBeat (#47146)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47146

This will allows us to batch sync events which leads to better performance.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D64631346

fbshipit-source-id: b82dca150c13bdb7acae6bedb392a93993273988
2024-10-23 13:15:45 -07:00
Ruslan Lesiutin
6098f24dfc Update debugger-frontend from 117c96a...ff343d8 (#47178)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47178

Changelog: [Internal] - Update `react-native/debugger-frontend` from 117c96a...ff343d8

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](117c96a1dd...ff343d8055).

Reviewed By: huntie

Differential Revision: D64840904

fbshipit-source-id: 00e6e92e24eee545139845a4a9e4847d0185aab6
2024-10-23 11:31:12 -07:00
Riccardo Cipolleschi
2861ad0c72 Changelog for 0.76.0 (#47118)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47118

This change refactors the changelog for version 0.76.0

## Changelog
[Internal] - changelog for 0.76 stable

Reviewed By: cortinico

Differential Revision: D64596098

fbshipit-source-id: a4b3c2dc1438607d10781245a3bd53483f01a9f6
2024-10-23 10:37:58 -07:00
Sam Zhou
aadb1d9eb1 Eliminate final few React$AbstractComponent (#47163)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47163

In order to adopt react 19's ref-as-prop model, we need to eliminate all the places where they are treated differently. `React.AbstractComponent` is the worst example of this, and we need to eliminate it.

This diff replaces final few in libdefs.

Changelog: [internal]

Reviewed By: alexmckenley

Differential Revision: D64776942

fbshipit-source-id: 5e96c6d4fecb1b6cf539a00aecb10b9b35fc140b
2024-10-22 16:10:54 -07:00
Nick Gerleman
7715a95895 Add more lineHeight examples (#47162)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47162

Add some more interesting cases in prepration for screenshot testing

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D64775710

fbshipit-source-id: 70b390ad944841044e0d5004bddd1a8d3cfc6cbf
2024-10-22 15:49:49 -07:00
Ruslan Lesiutin
3dfe22bd27 fix[Runtime.evaluate]: registered RuntimeExecutor should go through RuntimeScheduler (#47119)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47119

# Changelog:
[General] [Fixed] - Microtasks are now correctly executed after the code evaluation in Console panel of DevTools.

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

`runtimeExecutor` which is propagated here, is actually being used by Hermes:
https://www.internalfb.com/code/fbsource/[cba75f2b515a]/xplat/js/react-native-github/packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp?lines=112-113

The issue was that any expression that should be evaluated as part of `Runtime.evaluate` was not going through `RuntimeScheduler`, because specified `runtimeExecutor` was not going through it as well, and it was defined prior to `RuntimeScheduler`. Because of this, `RuntimeScheduler` was not draining out the microtasks queue and basically any scheduled Microtasks were not executed, see T200616136.

With this fix, we create an executor that goes through `RuntimeScheduler`, which is using another executor that makes sure that all scheduled callbacks are only executed after `Inspector` was setup.

It is extremely messy and in the future we should untangle these circular dependencies and try to simplify the approach.

Reviewed By: rubennorte

Differential Revision: D64552372

fbshipit-source-id: 467d37c71a2eb7c940297ce90ca8d68268b1ff33
2024-10-21 22:10:28 -07:00
Jorge Cabiedes Acosta
cc23aea2fc Enable new **Border** and **Background** drawables on BackgroundStyleApplicator (#47124)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47124

With this we start the experiment to analyze the effect of the new `BackgroundDrawable.kt` and `BorderDrawable.kt` classes. This is also essentially a kotlinification of `CSSBackgroundDrawable`

We also start using CompositeBackgroundDrawable as the source of truth for **borderRadius** and **borderInsets**

We are hoping to get neutral results and a general win for code readability.

In general when the FeatureFlag passes we should not generate a CSSBackgroundDrawable at all and just use BackgroundDrawable and BorderDrawable

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63287222

fbshipit-source-id: 7ca98290c2e152b22d09b838e5f0e1cac97b1268
2024-10-21 21:24:19 -07:00
Jorge Cabiedes Acosta
b3d5b793a4 Add BorderDrawable to replace border logic on CSSBackgroundDrawable (#46745)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46745

**Note:** This diff still does nothing yet, it will be enabled on a diff further up the stack. This split is just to simplify reviewing

`CSSBackgroundDrawable` holds the drawing logic for both **Borders** and **Background**. This is not ideal since it results in a huge file which does 2 things.

We now have `CompositeBackgroundDrawable` which allows us to set a different drawable per "layer" on our view.

By splitting up **Border** and **Background** logic we get better modularity and it'll make it easier to implement more `backgroundImage` features without further bloating the `CSSBackgroundDrawable` file

Also, this helps with the kotlinification efforts

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62898246

fbshipit-source-id: 15d1a4ef61f0c757e648c002fc7ef26626d8e3f6
2024-10-21 21:24:19 -07:00
Jorge Cabiedes Acosta
f41c59da96 Add BackgroundDrawable to replace background logic on CSSBackgroundDrawable (#46709)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46709

**Note:** This diff still does nothing yet, it will be enabled on a diff further up the stack. This split is just to simplify reviewing

`CSSBackgroundDrawable` holds the drawing logic for both **Borders** and **Background**. This is not ideal since it results in a huge file which does 2 things.

We now have `CompositeBackgroundDrawable` which allows us to set a different drawable per "layer" on our view.

By splitting up **Border** and **Background** logic we get better modularity and it'll make it easier to implement more `backgroundImage` features without further bloating the `CSSBackgroundDrawable` file

Also, this helps  with the kotlinification efforts

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63137921

fbshipit-source-id: fc459beadfda1832e146e36d74c3d424a28ca905
2024-10-21 21:24:19 -07:00
SamChou19815 (Meta Employee)
6205aad81e Eliminate usage of more than 1-arg React.AbstractComponent in React codebase (#31314)
Summary:
<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

In order to adopt react 19's ref-as-prop model, Flow needs to eliminate
all the places where they are treated differently.
`React.AbstractComponent` is the worst example of this, and we need to
eliminate it.

This PR eliminates them from the react repo, and only keeps the one that
has 1 argument of props.

## How did you test this change?

yarn flow

DiffTrain build for [45804af18d589fd2c181f3b020f07661c46b73ea](45804af18d)

Reviewed By: jbrown215

Differential Revision: D64725736

Pulled By: SamChou19815

fbshipit-source-id: c9f6f316c95d12a9ae98926faba111395b550ccf
2024-10-21 19:52:01 -07:00
Panos Vekris
363818ea20 pre-suppress errors before enabling experimental.object_freeze_fix (#47141)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47141

D64152004 fixed a soundness hole in Flow's checking of frozen object types (e.g. try-Flow https://fburl.com/rmct2mf6). This diff suppresses Flow errors that appear when this fix is enabled (`experimental.object_freeze_fix` flag is set).

For most of these cases the result of `Object.freeze()` is assigned to some variable typed as a mutable type. The variable is then passed to a context where its fields can be written to. Thus changing the annotation type to a readonly version would only cause more errors downstream. So, instead, these assignments are suppressed so that the choice of using Object.freeze can be revisited.

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D64699992

fbshipit-source-id: 48e4376d4ed3dbda21d32cabe512e6457384994f
2024-10-21 19:26:02 -07:00
Panos Vekris
d25f0c5edd prepare for fix in Object.freeze typing [2/n] (#47131)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47131

D64152004 fixed a soundness hole in Flow's checking of frozen object types (e.g. try-Flow https://fburl.com/rmct2mf6)

This diff prevents Flow errors from appearing when `experimental.object_freeze_fix` flag is set.

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D64641920

fbshipit-source-id: b6de954d3474f5c4c2e2a58f69cf8cff61be53e5
2024-10-21 19:26:02 -07:00
Sam Zhou
036e4f64c4 Eliminate 2 more remaining React.AbstractComponent<...> in react native
Summary:
In order to adopt react 19's ref-as-prop model, we need to eliminate all the places where they are treated differently. `React.AbstractComponent` is the worst example of this, and we need to eliminate it.

This diff replaces 2 more remaining ones in react-native. Now the only remaining one is the one synced from react repo.

Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D64722899

fbshipit-source-id: 2b2484c385fc5d6c173253f9bee66dfc736368a5
2024-10-21 19:10:42 -07:00
Sam Zhou
71e9039e9f Prepare typing changes for HostComponent (#47150)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47150

In https://github.com/facebook/react/pull/31314, I will change the host component type that will be synced to react-native. Notably, it will expose the issue where all the `HostComponent<mixed>` types are wrong, since it doesn't make sense to write `React.AbstractComponent<mixed>`. This diff fixes the existing usages first in prep for that typing change.

Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D64722939

fbshipit-source-id: 14e1477090128205d8be8fc7b135a8478f94b790
2024-10-21 18:15:34 -07:00
Eli White
4c37431c7f Support new codegen schema for native modules (#47114)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47114

Export the EventEmitter annotation from the codegen

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D63995813

fbshipit-source-id: 0211c21d7813da03bf8b6680095e016a621c188b
2024-10-21 16:43:49 -07:00
David Vacca
e10c07d5ae Rollout enableDeletionOfUnmountedViews in OSS and NewArchitecture apps (#47144)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47144

I'm fully rolling out enableDeletionOfUnmountedViews in OSS

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D64613764

fbshipit-source-id: 6dfecb9fe143ec59ddb71b614f12563a564578fc
2024-10-21 16:39:40 -07:00
Sam Zhou
723a37cb26 Replace most of the remaining React.AbstractComponent in react-native (#47143)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47143

In order to adopt react 19's ref-as-prop model, we need to eliminate all the places where they are treated differently. `React.AbstractComponent` is the worst example of this, and we need to eliminate it.

This diff replaces most of the remaining `React.AbstractComponent` in react-native.

Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D64701145

fbshipit-source-id: c765674fdf59812895c4fae43df97cf8b9d24f05
2024-10-21 15:48:25 -07:00
Nicola Corti
dbf09fbe58 Stable API - Make AppStateModule internal (#47121)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47121

This class should be internal. I've verified this API is not used in OSS so this is technically breaking but not really affecting anyone in OSS.

Changelog:
[Android] [Breaking] - Stable API - Make AppStateModule internal

Reviewed By: Abbondanzo

Differential Revision: D64598660

fbshipit-source-id: aebc385c741e2e1f352d473db2be87d918f0ef65
2024-10-21 15:34:50 -07:00
David Vacca
1aaedc7fca Turnon enableEventEmitterRetentionDuringGesturesOnAndroid for all apps depending on ReactNativeNewArchitectureFeatureFlagsDefaults (#47142)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47142

I'm turning on enableEventEmitterRetentionDuringGesturesOnAndroid for all apps depending on ReactNativeNewArchitectureFeatureFlagsDefaults

Reviewed By: cortinico

Differential Revision: D64610897

fbshipit-source-id: c301f616918484ed41790247d1e0cd7284602b09
2024-10-21 13:57:09 -07:00