Commit Graph

12270 Commits

Author SHA1 Message Date
Christoph Purrer 26f4c78aa2 Use ShadowNode::Traits instead of directly enable Yoga measurement (#48223)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48223

[Changelog] [Internal] - Use ShadowNode::Traits instead of directly enable Yoga measurement

The goal of this change is to simple use ShadowNodeTraits to enable measurement of ShadowNode props

Reviewed By: NickGerleman

Differential Revision: D67114097

fbshipit-source-id: dccb0f9b83f339c07ca41678533d97191277b520
2024-12-12 10:15:39 -08:00
Riccardo Cipolleschi 9f4b4aba93 Test Old Arch with Maestro (#48244)
Summary:
This pr tests the Old Arch on the Template app using Maestro

## Changelog:
[Internal] - Test old arch in CI with Maestro for template app

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

Test Plan: GHA

Reviewed By: cortinico

Differential Revision: D67141524

Pulled By: cipolleschi

fbshipit-source-id: bef3a9b6fec9d7c91d858d534a2d00e91f1842b5
2024-12-12 09:01:31 -08:00
Pieter De Baets 8fc4e8b35b Use registerCallableModule consistently (#48238)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48238

Use the helper module we have, which has better type-safety and less code duplication.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D67139572

fbshipit-source-id: 39ae9119d97f937b30ad6e7451468cbb3cc37a84
2024-12-12 08:30:58 -08:00
Pieter De Baets c06f13e7fb Error when using runTask in a re-entrant way (#48235)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48235

Recursively calling runTask is not supported, as the inner call will no-op since we're already executing the eventloop.

Currently errors are not correctly propagated, but this at least makes it so that we don't attempt to schedule the task either, which could lead to incorrect assumptions being made.

Changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D67107664

fbshipit-source-id: e665a96671f4812308d87aec3b880ce2009328e2
2024-12-12 08:09:02 -08:00
Hanno J. Gödecke 9dce26215b feat: add RawPropsParser as optional parameter to Concrete-/ComponentDescriptor (#48232)
Summary:
In this PR we introduced a new mechanism for `RawPropsParser` to construct its RawValues directly from `jsi::Value` instead of converting it to `folly::dynamic` first:

- https://github.com/facebook/react-native/pull/48047/

In this PR we added a parameter to `RawPropsParser` to opt-into using the above described mechanism:

- https://github.com/facebook/react-native/pull/48231

Whats missing is that `RawPropsParser` was default constructed in `ComponentProvider` and there is no way to pass a custom instance (where you'd for example set the above described parameter). This PR adds support for that.

## Changelog:

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

Pick one each for the category and type tags:

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

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

[INTERNAL] [ADDED] - Add `RawPropsParser` as optional parameter to Concrete-/ComponentDescriptor

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

Test Plan: Internal change, just make sure all CI tests are passing.

Reviewed By: cipolleschi

Differential Revision: D67135357

Pulled By: javache

fbshipit-source-id: 45f384d42314976c16cae10d5ea0419d13fd0889
2024-12-12 07:26:21 -08:00
Nick Gerleman f4a17fbb93 Add missing glog dep to React-idlecallbacksnativemodule.podspec (#48241)
Summary:
`react_native_assert` on iOS uses glog under the hood, and https://github.com/facebook/react-native/pull/47911 added usage to a new podspec, which means new entire binary under some build modes. Need to add missing dependency I think?

Changelog: [Internal]

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

Test Plan: tes_ios_helloworld passes with DynamicLibraries

Reviewed By: cipolleschi

Differential Revision: D67141052

Pulled By: NickGerleman

fbshipit-source-id: 299a499f40e9b54c4aca5d6e1c95c43ce933fb2b
2024-12-12 06:57:43 -08:00
Rubén Norte 6059660c60 Ship feature flag shouldSkipStateUpdatesForLoopingAnimations by default (#48224)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48224

Changelog: [General][Fixed] Removed unnecessary state updates in React to reflect the current state of looping animations.

This enables that feature flag by default and prepares for an incoming cleanup.

Reviewed By: yungsters, dmytrorykun

Differential Revision: D67109980

fbshipit-source-id: 3c98731221b0fb01a8d49d537df859fe23c0ae45
2024-12-12 05:41:01 -08:00
Rubén Norte 11c49d60cc Make feature flags module and overrides read-only (#48229)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48229

Changelog: [internal]

The type definitions for these objects (the exported value by the `ReactNativeFeatureFlags` module, and the input value for `ReactNativeFeatureFlags.override()` method) were writable objects, which is incorrect and causes other problems down the line.

This just makes them read-only.

Reviewed By: yungsters

Differential Revision: D67109719

fbshipit-source-id: 8d56e05042587a53cdd05e51b4207ef27ace2d91
2024-12-12 05:41:01 -08:00
Eric Rozell e04738b7ec Disable weak event emitter in AttributedString for Mac Catalyst (#48225)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48225

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

The weak event emitter in AttributedString attributes is causing a serialization error when typing into a TextInput in a Mac Catalyst build. We can resolve this by not putting the event emitters in the attributed string, but this is likely to cause other issues with event handling for nested <Text> components.

## Changelog

[iOS][Fixed] - Workaround for Mac Catalyst TextInput crash due to serialization attempt of WeakEventEmitter

Reviewed By: NickGerleman

Differential Revision: D66664583

fbshipit-source-id: efdfbcb0db4d5e6b9bf7c14f9bbb221faae2d724
2024-12-12 05:39:51 -08:00
Alex Hunt 9888b499f5 Add support for Performance.mark events in PerformanceTracer (#48200)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48200

Wires up `Performance.mark()` events, completing support for User Timings in Fusebox.

Other changes:

- Refactors `reportMeasure` to receive a `duration`.
- Fixes conversion for time values (ms -> µs) in emitted trace events.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D66704283

fbshipit-source-id: 352abbade26eb976e793481dde04463431bf2eb7
2024-12-12 04:40:43 -08:00
Alex Hunt fd9cdf3214 Add new Fusebox Tracing API, integrate into PerformanceEntryReporter (2/2) (#48043)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48043

Adds a new `PerformanceTracing` API to replace `ReactPerfLogger` and `FuseboxTracer`.

- Mostly a clone of `FuseboxTracer`, with small refactorings.
- Exposes a new `CdpTracing.h` header, intended for shared CDP/Chrome types (that will later propagate through to the runtime impl of `performance.mark,measure()`).
- These live in a new `jsinspector_tracing` library, to avoid a dependency cycle.

**Key change**: With both diffs, `PerformanceTracer` is added to `PerformanceEntryReporter` to initially wire up the `performance.measure` event — replacing the previous routing.

- `FuseboxTracer` remains load-bearing for the out-of-tree call to `stopTracingAndWriteToFile()`.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D66650181

fbshipit-source-id: 9092257f23cdb8746e69f5ff3eb7dbf4c8142938
2024-12-12 04:40:43 -08:00
Alex Hunt 59969b6135 Remove Fusebox calls from ReactPerfLogger, rename (1/2) (#48044)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48044

Updates `ReactPerfLogger` (now renamed `ReactPerfettoLogger`) to log to Perfetto only.

This precedes integrating `FuseboxTracer` calls into `PerformanceEntryReporter` for User Timing events and Interaction events.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D66600278

fbshipit-source-id: f250f6b018d091d740bb13d5fcce9b716c4a6f72
2024-12-12 04:40:43 -08:00
Mateo Guzmán 79ed11f8f4 fix(rn-tester): text input and xml http request dark mode adjustments (#48207)
Summary:
Was troubleshooting in these modules recently and noticed a few texts off in dark mode. Replacing a few instances of the Text component in all I could see in the two screens.

## Changelog:

[INTERNAL] - RN Tester `TextInput` & `XMLHttpRequest` dark mode adjustments

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

Test Plan:
<details>
<summary>View Screenshots (before fixes)</summary>

| Screenshot 1 | Screenshot 2 | Screenshot 3 | Screenshot 4 | Screenshot 5 | Screenshot 6 |
|--------------|--------------|--------------|--------------|--------------|--------------|
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 11 36](https://github.com/user-attachments/assets/c396bc5d-4b3c-4f63-8ac0-68bc808aa9d4) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 11 21](https://github.com/user-attachments/assets/cd8e5a2f-9066-4bc7-b56b-65dbd6df7dc4) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 30](https://github.com/user-attachments/assets/da451c18-40cd-4421-b8f5-a2462f82fee9) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 23](https://github.com/user-attachments/assets/32925fdb-f983-439f-b898-6986b739895a) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 19](https://github.com/user-attachments/assets/f0db7b49-dfef-4abc-aef0-2d55b016c0f8) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 16](https://github.com/user-attachments/assets/bad6dc45-3679-4bb6-aadd-6743053cd90f) |
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 10](https://github.com/user-attachments/assets/43028f51-c6e2-4b26-b20d-a3639606d6d5) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 07](https://github.com/user-attachments/assets/f8e2196e-bc64-4507-b330-d1d85730ddff) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 09 59](https://github.com/user-attachments/assets/a7100770-4b38-421f-9b73-09e4fff9e012) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 09 53](https://github.com/user-attachments/assets/27759c8c-0e56-4b92-8173-ba031b994e5c) | | | |

</details>

<details>
<summary>View Screenshots (after fixes)</summary>

| Screenshot 1 | Screenshot 2 | Screenshot 3 | Screenshot 4 | Screenshot 5 | Screenshot 6 |
|--------------|--------------|--------------|--------------|--------------|--------------|
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 30](https://github.com/user-attachments/assets/71c0287d-d98a-4bfe-85dc-1e08da12ce43) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 26](https://github.com/user-attachments/assets/45eac165-f42a-4193-98cc-3ee85d963382) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 23](https://github.com/user-attachments/assets/c0e4432d-2d1d-487f-8965-3829c3257364) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 19](https://github.com/user-attachments/assets/ab81500c-66c1-4b90-b2b1-f7c490e0029b) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 16](https://github.com/user-attachments/assets/aafcad74-e851-49a8-9db0-df06f81f0b30) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 11](https://github.com/user-attachments/assets/29a2a6c8-e448-4c90-844d-29a248f9ab69) |
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 07](https://github.com/user-attachments/assets/54e505c4-c554-4000-aac1-61b97e034f55) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 04 39](https://github.com/user-attachments/assets/0e91dc29-199d-424e-b36a-6b0f7a317cd2) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 04 22](https://github.com/user-attachments/assets/e965b01d-0b03-4d01-a971-57c3bd550146) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 04 15](https://github.com/user-attachments/assets/50ef03a6-bf1a-4db3-845b-e98373369574) |  |  |

</details>

Reviewed By: cipolleschi

Differential Revision: D67087492

Pulled By: javache

fbshipit-source-id: c9c64377d8c10d965bc5db7783aa80f099ce858a
2024-12-12 04:07:10 -08:00
Andrew Coates 849407ae6f Fix no return static analysis error in SchedulerPriorityUtils.h (#47911)
Summary:
In react-native-windows our static analysis tools report an error for `timeoutForSchedulerPriority` due to cases where it may not always return a value.  This is an upstreaming of the patch we have to fix that error.

## Changelog:

[INTERNAL] [FIXED] - Fix no return static analysis error in SchedulerPriorityUtils.h

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

Test Plan: Building should be sufficient.

Reviewed By: christophpurrer

Differential Revision: D66992063

Pulled By: NickGerleman

fbshipit-source-id: 999fea328d0c66ad92314f537e41beff5856c285
2024-12-12 01:31:18 -08:00
Chi Tsai e34c1e9bd2 Add default implementation for Object.create(prototype) (#47946)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47946

Object creation with custom prototype can currently be done, but it is
unnecessarily convoluted. Users have to call into the global object to
get the `Object.create` function, then call it with the custom
prototype.

This diff adds a JSI API for Object.create(prototype) to make it easy
for users.

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D66485209

fbshipit-source-id: 32018f847190ac16f695f011a78be0c45c4c4659
2024-12-12 01:14:00 -08:00
Chi Tsai 04f33ecd58 Add default implementation for Object.getPrototypeOf and Object.setPrototypeOf (#47996)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47996

Getting and setting an Object's prototype is convoluted. Users have to
call into the global object to get the method, then call it.

This diff adds a JSI API for Object.getPrototype and Object.setPrototype
to make it easy for users.

Changelog: [Internal]

Reviewed By: fbmal7

Differential Revision: D66562549

fbshipit-source-id: 85a2e49deb9d00500544de4cc5ab123c4717398e
2024-12-12 01:14:00 -08:00
Christoph Purrer 07d723cb72 Remove unused (Android) TextLayoutManager getter (#48208)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48208

[Changelog] [Internal] - Remove unused (Android) TextLayoutManager getter

This getter
```
void* getNativeTextLayoutManager() const;
```
is not used on Android and different in signature to the iOS one:
```
std::shared_ptr<void> getNativeTextLayoutManager() const;
```
Deleting it for now to make future code sharing between various platforms easier.

This change removes further the by now discouraged pattern of:
```
using SharedTextLayoutManager = std::shared_ptr<const TextLayoutManager>;
```
and changes callers to use
```
std::shared_ptr<const TextLayoutManager>;
```
directly.

Reviewed By: javache

Differential Revision: D67059514

fbshipit-source-id: b94dc7f664083c5c62c4ba7defca480549ca9dc1
2024-12-11 23:45:21 -08:00
hoxyq (Meta Employee) a80baac58e Remove comment syntax from ReactNativeTypes (#31457)
Summary:
# Summary

I'm working to get the main `react-native` package parsable by modern
Flow tooling (both `flow-bundler`, `flow-api-translator`).

This diff trivially removes some redundant Flow comment syntax in
`ReactNativeTypes.js`, which fixes parsing under these newer tools.

## How did you test this change?

Files were pasted into `react-native-github` under fbsource, where Flow
validates .

DiffTrain build for [92b62f500c3fca44a9dc9ead936ef3bf19481f02](https://github.com/facebook/react/commit/92b62f500c3fca44a9dc9ead936ef3bf19481f02)

Reviewed By: huntie

Differential Revision: D67100354

Pulled By: hoxyq

fbshipit-source-id: 575e4bd8ceefad15576273920a263ae89d027cad
2024-12-11 22:47:38 -08:00
Sam Zhou 7000b9b76c Add annotations and casts to fix future flow error (#48219)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48219

Changelog: [internal]

Reviewed By: panagosg7

Differential Revision: D67099060

fbshipit-source-id: fbb975d6194b071aa8f30dcd2b8f7f40130d31fb
2024-12-11 14:16:58 -08:00
Riccardo Cipolleschi 3ff9212ce4 Fix React-graphics podspec source_files (#48216)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48216

The `React-graphics` podspec is manually excluding some paths from the source_files but this approach is error prone. For esample changes that added new paths that must be excluded can create failures.

This change the podspec file to explicitly add only the files that iOS requires.

## Changelog:
[iOS][Changed] - Explicitly define the source files for React-graphics

## Facebook:
This change is necessary because we added the macos platform that was not included before and now we can't build RNTester from fbsource using the internal pipeline.

Reviewed By: hoxyq

Differential Revision: D67095677

fbshipit-source-id: 701d5938f6e141a313be62c8f930a089e1d6ee96
2024-12-11 08:48:31 -08:00
Hanno J. Gödecke 03d2186ace Construct RawValue directly from jsi::Value (#48047)
Summary:
### Motivation:

We are looking for a way to access the "raw" jsi value in our fabric view components, so that we can pass complex types like `HostObjects` or `jsi::Object` with `NativeState` attached to our components directly.
Currently the props are converted from `jsi::Object` to `folly::dynamic`, which prevents us from accessing these values directly.

### Changes

This PR is a implementation of the proposal discussed here:

- https://github.com/facebook/react-native/pull/44966#issuecomment-2503915245

These changes extend `RawValue` so that it can be directly constructed from `RawValue(Runtime*, jsi::Value&)` (not just from `folly::dynamic`).

`RawValue`s are created by the `RawPropParser.cpp`. By default it will use the `RawValue(folly::dynamic)` constructor, but we added a feature flag called `useRawPropsJsiValue`, which will sue the JSI constructor.
This enables to test this feature at runtime incrementally.

This change might also be tested on a component basis, by setting a flag in the component descriptor to enable JSI prop parsing for the RawPropParser, as outlined in this PR:

- https://github.com/hannojg/react-native/pull/2

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

[General] [Added] - Add `useRawPropsJsiValue` feature flag to represent props internally as `jsi::Value`s instead of converting them to `folly::dynamic`

[General] [Added] - Added `RawValue(Runtime*, jsi::Value&)` constructor to make a `RawValue` from a `jsi::Value`.

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

Test Plan: Enable the `useRawPropsJsiValue` feature flag and test the rn-tester app on android and iOS. Make sure you get no new errors / warnings in the native console.

Reviewed By: NickGerleman

Differential Revision: D66877093

Pulled By: javache

fbshipit-source-id: 7342e5f86d2492ad63a9ccf5508f04e7eb252def
2024-12-11 08:38:12 -08:00
Juliusz Wajgelt 7d0338cb0b fix incorrect mmap file offset in JSBigFileString (#48198)
Summary:
`JSBigFileString` incorrectly passes the file offset to `mmap`, causing errors when `offset` is non-zero.

## Changelog:
[GENERAL] [FIXED] - `JSBigFileString` fails for non-zero offset arguments

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

Test Plan: - verify the new unit test passes

Reviewed By: cipolleschi

Differential Revision: D67086826

Pulled By: javache

fbshipit-source-id: 0991bb34a710b85ff0263dc553efb85ba62b4cd8
2024-12-11 08:24:50 -08:00
Mitya Kononchuk 477489ce84 Fix running fantom tests via buck-test (#48215)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48215

Changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D66976980

fbshipit-source-id: d553c2f702d6928fb0ad88fcc2c6f04160a65d02
2024-12-11 07:07:10 -08:00
Ben Handanyan 462fae4a29 Use configuration type when adding ndebug flag to pods in release (#48193)
Summary:
While I was [working on fixing the iOS debugger logic](https://github.com/facebook/react-native/pull/48174) based on configuration name regex match, I wanted to know if other logic was also based on configuration names. I think I found and fixed the only other configuration name-based logic in the repo in this PR.

## Changelog:

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

Pick one each for the category and type tags:

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

[IOS] [CHANGED] - Use configuration type when adding ndebug flag to pods in release

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

Test Plan:
In a fresh react-native project, I added to the Podfile:
```ruby
    installer.aggregate_targets.each do |aggregate_target|
      aggregate_target.xcconfigs.each do |config_name, config_file|
          is_release = aggregate_target.user_build_configurations[config_name] == :release
          puts "aggregate_targets #{config_name} is_release: #{is_release}"
        end
    end

    installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
      target_installation_result.native_target.build_configurations.each do |config|
          is_release = config.type == :release
          puts "target_installation_results #{config.name} is_release: #{is_release}"
      end
    end
```

to confirm my logic. It output the following:
```
aggregate_targets Release is_release: true
aggregate_targets Local is_release: false
...
target_installation_results Local is_release: false
target_installation_results Release is_release: true
...
```

I also updated the applicable tests I could find for this logic.

Reviewed By: cortinico

Differential Revision: D67025325

Pulled By: cipolleschi

fbshipit-source-id: 45d68ee86e3255d843275a72916883c8c4bbc13d
2024-12-11 04:37:48 -08:00
Christoph Purrer 7d771de8a7 Share common ShadowNode functionality in BaseTextInputShadowNode for iOS (#48164)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48164

[Changelog] [Internal] - Share common ShadowNode functionality in BaseTextInputShadowNode for iOS

The current Android and iOS implementations have quite some overlapping functionality. Not sharing common logic makes it also harder to reuse this [functionality] for out of tree platforms.

This change moves the current iOS implementation into a shared location.
The next change allows to reuse it for Android.

Reviewed By: NickGerleman

Differential Revision: D66901676

fbshipit-source-id: a870155633875377d881fbd9f41fafb305672949
2024-12-10 18:05:42 -08:00
Pieter De Baets 93c6be496e Configure __RCTProfileIsProfiling for perfetto builds (#48201)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48201

For any build for which we enable the perfetto build flag, we should probably enable the `__RCTProfileIsProfiling` so we get systrace markers.

Changelog: [Internal]

Reviewed By: bgirard

Differential Revision: D67031171

fbshipit-source-id: 5e7f56f911acacd3156778bd9151202fc809e291
2024-12-10 16:53:05 -08:00
Mateo Guzmán 9ecf290d27 Paper: TextInput maxLength is not working in old arch (#48126)
Summary:
Fixes https://github.com/facebook/react-native/issues/47563

It seems like a regression from https://github.com/facebook/react-native/issues/45401, where it was aimed to fix `onChangeText` being called multiple times when changing the text programmatically in an input with the `multiline` prop set as true.

This PR reverts that partially, as the `maxLength` check is not being evaluated correctly before setting the text. Not reverting it completely as when removing the second part of the fix, the `onChangeText` gets called multiple times again.

## Changelog:

[IOS] [FIXED] - Fixing TextInput `maxLength` not working in old arch

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

Test Plan:
The issue could be reproduced in the rn-tester. See my videos with the before and after the fix.

<details>
<summary>Before:</summary>

https://github.com/user-attachments/assets/86fd67eb-fc14-469a-a5f8-8e83b49f857c

</details>

<details>
<summary>After:</summary>

https://github.com/user-attachments/assets/368383b1-c1bd-4e0b-ac44-c78022462fa0

</details>

Reviewed By: cortinico

Differential Revision: D67025182

Pulled By: cipolleschi

fbshipit-source-id: 720c400eef362618106ae434aef421c7529214fe
2024-12-10 11:57:48 -08:00
zhongwuzw d20897f6d4 Fabric: Fixes transform when there are multiple values that contain a matrix (#47477)
Summary:
Fixes https://github.com/facebook/react-native/issues/47467 .

## Changelog:

[IOS] [FIXED] - Fabric: Fixes transform when there are multiple values that contain a matrix

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

Test Plan: Repro in Fixes https://github.com/facebook/react-native/issues/47467

Reviewed By: javache

Differential Revision: D65594337

Pulled By: cipolleschi

fbshipit-source-id: 50f255e753e2f233415099c3fbdd0e43b0afefc0
2024-12-10 10:29:29 -08:00
Mateo Guzmán 9a21b99918 Making RCTNetworking js exports consistent (#48166)
Summary:
Fixes https://github.com/facebook/react-native/issues/39260

Right now, there is a small issue when you try debugging the Networking library methods as it seems like they are empty in Android. This is not an actual functional issue as everything in code works fine, but rather an inconsistency in how the iOS and Android methods are being exported. In iOS it was exported as an object, in Android it was a class.

## Changelog:

[INTERNAL] - Making `RCTNetworking` js exports consistent

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

Test Plan:
I've checked that `XMLHttpRequest` is still working as expected, as this is used mostly there.

And below there are screenshots of how the module methods are logged after the refactor. Which addresses what was reported in the linked issue.

```js
import {Networking} from 'react-native';
import AndroidNetworking from 'react-native/Libraries/Network/RCTNetworking.android.js';
import IOSNetworking from 'react-native/Libraries/Network/RCTNetworking.ios.js';

console.log({Networking, AndroidNetworking, IOSNetworking});
```

Before | After
-- | --
<img width="1196" alt="image" src="https://github.com/user-attachments/assets/b7ab1dcd-9dd1-4ed9-ade5-d90251a77d5e"> | <img width="1196" alt="image" src="https://github.com/user-attachments/assets/5ae17c6a-b068-462a-b228-576dcf08ef12">

Reviewed By: fabriziocucci

Differential Revision: D67022711

Pulled By: javache

fbshipit-source-id: 81f9988295fb3f559a795077f09ee0f14827dc86
2024-12-10 10:17:42 -08:00
Rubén Norte 6ba8b65e9f Remove legacy ReactNativeConfig abstraction (#47247)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47247

Changelog: [internal]

Bye bye `ReactNativeConfig` 👋.

All existing usages of the API have been cleaned up or migrated to `ReactNativeFeatureFlags`, so this is no longer needed.

Reviewed By: GijsWeterings

Differential Revision: D65062306

fbshipit-source-id: 76afcd48ad72023b6dc2a90955ae2f03a1164cca
2024-12-10 09:34:27 -08:00
Rubén Norte c24f963330 Make ReactNativeConfig an empty interface (#47246)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47246

Changelog: [internal]

Just to use CI to verify there are no more existing usages of the API before cleaning it up.

Reviewed By: GijsWeterings

Differential Revision: D65062302

fbshipit-source-id: e1b71d39ef1fba23cc68e36fe0a0b57cfc2a614e
2024-12-10 09:34:27 -08:00
Pieter De Baets 746d584a23 Fix animation.stop not being flushed (#48199)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48199

`animatedShouldUseSingleOp` relies on a queue always being active, or for a call to `flushQueue` later down the line. If these are missing, a call will be queued up but only executed whenever the next animation flush happens.

Changelog: [General][Fixed] Animation.stop() executes when `animatedShouldUseSingleOp` is enabled.

Reviewed By: yungsters

Differential Revision: D67025831

fbshipit-source-id: 66a7f50d833b7bbaf9f16dd04d24b90c7a699fa0
2024-12-10 09:24:05 -08:00
Riccardo Cipolleschi 8ab524312a Skip hidden folders when looking for third party components (#48182)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48182

Maintainers from SVG reached out because of an edge case they inencountered when generating the ComponentProvider. In their setup, they had a `.git` folder in the repo and the algorithm was spending a lot of time crawling the git folder.

In general, we should avoid crawling hidden folders.

This change fix that.

## Changelog:
[General][Fixed] - Skip hidden folders when looking for third party components.

Reviewed By: javache

Differential Revision: D66959345

fbshipit-source-id: 992a79f3cff22cd6a459e0272c8140bc329888da
2024-12-10 02:32:10 -08:00
Andrew Datsenko a298ccabe2 Add snapshot update / delete capability (#48096)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48096

Changelog: [Internal]

Managing snapshot state internally by adding / updating snapshot data.

Reviewed By: christophpurrer

Differential Revision: D66707175

fbshipit-source-id: 0366d834eafa0ca702f03de0210392181fd90a58
2024-12-09 19:09:57 -08:00
Andrew Datsenko a8a136f3ef Add .toMatchSnapshot() (#48029)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48029

Changelog: [Internal]

Adding snapshot support for rendered output only for now.
This will only work if snapshot is created beforehand by hand.

# Next steps
* Create snapshot when no prior snapshot is available
* Pass and update if instructed

Reviewed By: christophpurrer

Differential Revision: D66601387

fbshipit-source-id: fe528cded43c5ba36d314bd9af8e3fb84b98ac3e
2024-12-09 19:09:57 -08:00
Andrew Datsenko a4a2c2867a Add jest-snapshot (#48095)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48095

Changelog: [Internal]
Add `jest-snapshot` `v29.7.0`

Reviewed By: christophpurrer

Differential Revision: D66714069

fbshipit-source-id: 783584519e95b337d36c4a00610bcd970a041d4d
2024-12-09 19:09:57 -08:00
Jorge Cabiedes Acosta 6d235853fb Fix background getting clipped when border-radius is set (#47939)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47939

Before we were clipping Android background drawable to the padding box. This is not how its done on web.

The background should remain under the border so that if the border is traslucent you can see the background underneath

Reviewed By: NickGerleman

Differential Revision: D66463305

fbshipit-source-id: 427acea760b2748a07cc28bbd362aaaae0811093
2024-12-09 18:35:45 -08:00
Christoph Purrer 0b866aa40d Share common (Base)TextInputState properties (#48133)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48133

[Changelog] [Internal] -  Share common (Base)TextInputState properties

This change allows to share common TextInput State properties between various platforms.

Reviewed By: rshest

Differential Revision: D66855831

fbshipit-source-id: d0f85c419b82445ac84bfcc606f1bf752f5dba73
2024-12-09 15:02:58 -08:00
heoblitz 331d99a941 Update YGNodeStyleGetGap to return YGValue (#47973)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47973

Gap can be styled using both `points` and `percentages`, but YGNodeStyleGetGap currently returns a float value.

To maintain alignment with the `padding` and `margin` functionalities and allow it to be handled in bridging code, this function has been updated to return YGValue.

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

Reviewed By: joevilches

Differential Revision: D66513236

Pulled By: NickGerleman

fbshipit-source-id: b7110855c037f20780f031f22a945bde4446687d
2024-12-09 13:38:05 -08:00
Pieter De Baets 4ec4a85b1b Unbreak OSS Android CI (#48186)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48186

Broken by https://github.com/facebook/react-native/commit/37c532a063c6054ea974612a40551f7c1399c147 since we use different OkHttp versions internally and in open-source.

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D66968229

fbshipit-source-id: a110cec0f9bd55e6ae5c90b766e8e6220703e6c3
2024-12-09 13:11:18 -08:00
Christoph Purrer 7ea5deb802 Remove unused defaultThemePaddingStart|End|Top|Bottom from AndroidTextInputState (#48161)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48161

[Changelog] [Internal] -  Remove unused defaultThemePaddingStart|End|Top|Bottom from AndroidTextInputState

This data is set, but never read

Reviewed By: javache

Differential Revision: D66904641

fbshipit-source-id: 4db1cd49e9ec63b62f75070b478d2006ea101f8c
2024-12-09 11:22:57 -08:00
Nick Lefever aef13d1f43 Enable shadow node reference updates by default (#48180)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48180

Changelog: [Internal]

Releasing runtime shadow node reference updates, enabling it by default now that the fix for RN Windows landed.

Reviewed By: javache

Differential Revision: D66959896

fbshipit-source-id: dcf1c4a7257fe60ae0faffe1952fc2c80effe406
2024-12-09 10:52:21 -08:00
Pieter De Baets c31b42aaa2 Fix flow-type of selectionColor (#48184)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48184

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D66962089

fbshipit-source-id: cd45784d830a12a620800290235a5a1cad3097f3
2024-12-09 10:20:12 -08:00
Jakub Piasecki 47822e9048 Fix adjustsFontSizeToFit for strings with a single character (#47082)
Summary:
Fixes https://github.com/facebook/react-native/issues/47045

On Android `adjustsFontSizeToFit` relies on two metrics:
- Text with line breaks results in more lines than `maximumNumberOfLines`
- The overall height of the text is larger than the available height

None of these two was fulfilled when a single-character string had a higher width than the available one (a single character will not be broken into multiple lines). This PR adds exactly that as a third option to trigger the scaling algorithm - a single-character string that has a higher width than the available one.

On iOS `adjustsFontSizeToFit` relies on `truncatedGlyphRangeInLineFragmentForGlyphAtIndex` which seems to be returning `NSNotFound` when a single-character sting gets truncated. Similarly to Android, this PR adds an additional check to make sure that single-character strings actually fit inside the container.

## Changelog:

[GENERAL] [FIXED] - Fixed `adjustsFontSizeToFit` not working for text with a single character

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

Test Plan:
Tested on the code from the issue:

|Android (old arch)|Android (new arch)|iOS (old arch)|iOS (new arch)|
|-|-|-|-|
|<img width="406" alt="android_old" src="https://github.com/user-attachments/assets/91b1af41-4ef7-46cc-bb04-374f860d93ac">|<img width="406" alt="android_new" src="https://github.com/user-attachments/assets/90e3cde1-e6c0-4b25-8325-c62a37773002">|<img width="546" alt="ios_old" src="https://github.com/user-attachments/assets/902b9c10-84e0-4372-bcc8-07cd1ef006f6">|<img width="546" alt="ios_new" src="https://github.com/user-attachments/assets/f4df4f0e-7649-47f3-9c81-e38f8665d9a2">|

Reviewed By: javache

Differential Revision: D64664351

Pulled By: NickGerleman

fbshipit-source-id: b68f318a0fbd5ebed947a70d1e3fb0515b5fb409
2024-12-09 10:12:10 -08:00
Ben Handanyan eda4f185b3 Enable hermes debugger by configuration type instead of configuration name (#48174)
Summary:
Fixes an [issue](https://github.com/facebook/react-native/issues/48168) where only iOS configurations with "Debug" in the name are configured to use the hermes debugger.

## Changelog:

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

Pick one each for the category and type tags:

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

[IOS] [FIXED] - Enable hermes debugger by configuration type instead of configuration name

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

Test Plan:
Added new test scenarios that all pass:
```
ruby -Itest packages/react-native/scripts/cocoapods/__tests__/utils-test.rb
Loaded suite packages/react-native/scripts/cocoapods/__tests__/utils-test
Started
Finished in 0.336047 seconds.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
56 tests, 149 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
166.64 tests/s, 443.39 assertions/s
```

In a personal project with the following configurations:
```
project 'ReactNativeProject', {
    'Local' => :debug,
    'Development' => :release,
    'Staging' => :release,
    'Production' => :release,
  }
```
I added the following to my Podfile:
```
installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
        puts "#{config.name} is debug? #{config.type == :debug}"
    end
end
```
To confirm that my logic is correct:
```
Local is debug? true
Development is debug? false
Staging is debug? false
Production is debug? false
```

Reviewed By: robhogan

Differential Revision: D66962860

Pulled By: cipolleschi

fbshipit-source-id: 7bd920e123c9064c8a1b5d45df546ff5d2a7d8be
2024-12-09 08:51:00 -08:00
Pieter De Baets 0916d530f0 Allow CookieJar to be disabled in NetworkingModule (#48113)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48113

Processing cookies can have a non-trivial impact on startup-time. It requires reading OkHttp's `PublicSuffixDatabase` but also allocating various WebKit components. Instead handle the cookiejar being set to non-CookieJarContainer instances gracefully, which allows a custom client builder to set `CookieJar.NO_COOKIES`.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D66787514

fbshipit-source-id: bf790691496f674ec743ba4791552b12e06eda29
2024-12-09 08:37:32 -08:00
Mateo Guzmán 37c532a063 test(image): [android] react okhttp network fetcher cache control tests (#47953)
Summary:
This is a follow up for the new cache control options for the Android Image component introduced in https://github.com/facebook/react-native/issues/47182, https://github.com/facebook/react-native/issues/47348 & https://github.com/facebook/react-native/issues/47426. And to make sure the cache control header works as expected and avoid missing the issue fixed in https://github.com/facebook/react-native/issues/47922, this PR introduces test cases to make sure this is getting applied as expected in the `ReactOkHttpNetworkFetcher`.

## Changelog:

[INTERNAL] [ADDED] - `ReactOkHttpNetworkFetcher` cache control tests

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

Test Plan:
```bash
yarn test-android
```

Reviewed By: rshest

Differential Revision: D66498305

Pulled By: javache

fbshipit-source-id: 7a9a0cc596e49964943e59189614743ca8a472a1
2024-12-09 07:36:46 -08:00
Rubén Norte 3cc67fed36 Add Fantom mode for development with Hermes bytecode (#48178)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48178

Changelog: [internal]

Adds a new mode for Fantom to run tests with dev-mode bytecode. Right now the modes were only dev (development with source code) or opt (optimized bytecode).

Reviewed By: rshest

Differential Revision: D66888986

fbshipit-source-id: 34b2566a65d138790e16f8fb5787fd9c2bcde536
2024-12-09 05:43:27 -08:00
Rubén Norte 4d07fb7662 Use enum for Fantom modes (#48179)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48179

Changelog: [internal]

Migrating this type to an enum, which is safer, because it prevents errors like:

```
// when it's actually 'dev'
if (mode === 'development') {

}
```

Reviewed By: rshest

Differential Revision: D66888985

fbshipit-source-id: 4f3f91fad6ca5256baa2123425b2bad11fe036f9
2024-12-09 05:43:27 -08:00
Rubén Norte 07a7b63fdd Only prewarm in CI (#48151)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48151

Changelog: [internal]

We have global setup step in Fantom to prewarm caches to properly attribute test running time, but this isn't necessary when running tests locally. Attribution isn't as important there. This disables the prewarming step so we can run individual tests as fast as we can.

Reviewed By: sammy-SC

Differential Revision: D66877990

fbshipit-source-id: 1f33c19a3c537c1c0e499fd7a6c405450cb9f86d
2024-12-09 05:43:27 -08:00