Commit Graph

12270 Commits

Author SHA1 Message Date
Riccardo Cipolleschi a0ddcd256a Only include ReactCommon and ios platform for TextInput (#48754)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48754

The React-FabricComponent was importing some non-existent files when we build for iOS with cocoapods.

This change fixes it.

## Changelog
[Internal] -  Only include ReactCommon and ios platform for TextInput

Reviewed By: GijsWeterings

Differential Revision: D68319960

fbshipit-source-id: 45ddd7765f6afc0efef6dc1dadea782871fbd779
2025-01-17 05:07:05 -08:00
nishan (o^▽^o) cc89ddd50b feat: linear gradient px and transition hint syntax support (#48410)
Summary:
- Adds support for color transition hint syntax in linear gradients. e.g. `linear-gradient(red, 20%, green)`
- Adds `px` support. Combination of `px` and `%` also works.
- Simplified color stops parsing.
- The `processColorTransitionHint` and `getFixedColorStops` is moved to native code so it can support combination of `px` and `%` units as it requires gradient line length, which is derived from view dimensions and gradient line angle.
- Follows CSS [spec](https://drafts.csswg.org/css-images-4/#coloring-gradient-line) (Refer transition hint section) and implementation is referred from [blink engine source](https://github.com/chromium/chromium/blob/a296b1bad6dc1ed9d751b7528f7ca2134227b828/third_party/blink/renderer/core/css/css_gradient_value.cc#L240).

## Changelog:

[GENERAL] [ADDED] - Linear gradient color transition hint syntax and `px` unit support.

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

Test Plan:
Added testcase in processBackgroundImage-test.ts and example in LinearGradientExample.js

<img width="500" alt="Screenshot 2025-01-05 at 11 38 13 PM" src="https://github.com/user-attachments/assets/62858bb7-1dbf-40cf-8dd4-ec0daf84ac1b" />

## Todo

Add testcases for `getFixedColorStops` and `processColorTransitionHint` in native code for both platforms. That's the only downside of moving it out of JS 🤦

Reviewed By: NickGerleman

Differential Revision: D67870375

Pulled By: joevilches

fbshipit-source-id: b91d741f3108c25df8000d220726bf180c64be60
2025-01-16 15:00:37 -08:00
Nick Gerleman 69f761f1ac Allow parser to support generic data types (#48718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48718

This diff looks a bit scary, but it's mostly just structural changes of existing code and some deletion, on a well tested path 😅.

The current parser implementation tries to special case "basic" data types. When I was looking at how to add in support for more complex values, such as lists, function notations, and more compounded types, this distinction ends up not making much sense.

Instead of treating some types as basic, this diff instead moves to a model where a user can declare any structure as a `CSSDataType`, so long as they also supply a parser, which may be visited when iterating through CSS syntax blocks (preserved tokens, function blocks, or simple blocks, which probably won't be used). The user then specifies a list of supported CSS data types to parse, which invokes said parser, calling any defined methods for specific syntax. E.g.

```cpp
struct CSSNumber {
  float value{};
};

template <>
struct CSSDataTypeParser<CSSNumber> {
  static constexpr auto consumePreservedToken(const CSSPreservedToken& token)
      -> std::optional<CSSNumber> {
    if (token.type() == CSSTokenType::Number) {
      return CSSNumber{token.numericValue()};
    }

    return {};
  }

  // Could also accept function block here as well (e.g. for future math
  // expressions)
};

static_assert(CSSDataType<CSSNumber>);
```

```cpp
// Can be one of std::monostate (variant null-type), CSSWideKeyword,
// CSSNumber, CSSLength, or CSSPercentage. In this case, a CSSLength.
auto value = parseCSSProperty<CSSNumber, CSSLength, CSSPercentage>("5px");
```

This breaks a whole lot of assumptions I made a year ago, especially around `CSSValueVariant` which must now be able to handle arbitrary values. For now, for the sake of simplicity, I threw this out, and migrated parser code to use plain-old `std::variant`, which has a downside of being a bit less optimized in terms of storage. I also ended up completely throwing out `CSSDeclaredStyle`, since it would majorly need to change, and we're not going to be migrating style storage quite yet. This change also broke the `CSSProperties.h` property definitions and parsing shorthand a bit, which we will need for value processing later. I also opted to delete this for now (a big centralized list is the wrong structure anyways), but will likely copy bits from its source history later.

Another particular hairy bit, that likely won't bite us in practice, is that some strings may be parseable under different data types. This just adds caller requirement to order the types correctly, instead of precedence being implemented as part of the parser.

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D68245734

fbshipit-source-id: 132b11053cf41f57483c89176a9a6dceebb69fad
2025-01-16 11:42:34 -08:00
Nick Gerleman 2b925c8358 Fix unintentional fallthrough in keyword parsing (#48717)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48717

tsia

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68246769

fbshipit-source-id: a5192880423cb00616981f4e1b24b7819062bc3b
2025-01-16 11:42:34 -08:00
Nick Gerleman ddf68eb949 Handle "transparent" color ident (#48716)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48716

`transparent` is specced as a special `<named-color>` outside the table the others were derived from. Let's add it, since it is supported today by `normalizeColor`.

https://www.w3.org/TR/css-color-4/#named-colors

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68246770

fbshipit-source-id: 3ff7ed68ebb3d6bc59b24a25d35342620670f0c3
2025-01-16 11:42:34 -08:00
Nicola Corti de5bccf080 Cleanup prealpha logic from the JS Publishing Scripts (#48691)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48691

We don't intent to use the prealpha logic in the near future so it makes sense to remove it for
to simplify our already complicated release process. We can always revive it if we wish.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D68206014

fbshipit-source-id: f05eeae3997d52df1127852e03437a387a01f5ad
2025-01-16 11:36:42 -08:00
David Vacca 878185678f Migrate ContentSizeWatcher to kotlin (#48743)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48743

Migrate ContentSizeWatcher to kotlin
changelog: [internal] internal

Reviewed By: tdn120

Differential Revision: D68278772

fbshipit-source-id: ba3c88be13aad3c49a8dd3771332b48725ea76c1
2025-01-16 11:36:06 -08:00
David Vacca c5041ea099 Migrate ScrollWatcher to Kotlin (#48742)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48742

Migrate ScrollWatcher to Kotlin

changelog: [internal] internal

Reviewed By: tdn120

Differential Revision: D68278771

fbshipit-source-id: 550c3b6c83999b1d610cb3d75ec91f552d89c028
2025-01-16 11:36:06 -08:00
Nicola Corti 40c18e1259 Remove last tasks.creating invocation inside hermes-engine (#48739)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48739

Follow-up to https://github.com/facebook/react-native/pull/48603
I realized there is one last `tasks.creating` invocation inside `hermes-engine` that needs migration. This fixes it.

Changelog:
[Internal] [Changed] -

Reviewed By: alanleedev

Differential Revision: D68276984

fbshipit-source-id: d58cf64cf41c7943464f15d12c7a04c3cc43ec7d
2025-01-16 11:00:59 -08:00
Rob Hogan f30c46efbd Fix "paused on debugger" overlay icon (#48736)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48736

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

This icon was broken by D65457771, identified in [OSS testing for the 0.77 release](https://github.com/reactwg/react-native-releases/issues/724).

By explicitly setting the image for the `Disabled` state to the same as `Normal`, we get the same behaviour as the deprecated [`adjustsImageWhenDisabled = NO`](https://developer.apple.com/documentation/uikit/uibutton/adjustsimagewhendisabled?language=objc) without the need for `configurationUpdateHandler`.

Changelog: [iOS][Fixed] Restore "Paused in debugger" overlay icon

Reviewed By: cipolleschi

Differential Revision: D68274336

fbshipit-source-id: 3f4b84eb7cfb518ca953c721da9885df8f98b437
2025-01-16 10:51:58 -08:00
Samuel Susla 6fa4cc6085 Back out "Animated: Optimize onUserDrivenAnimationEnded Deopt" (#48733)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48733

Original commit changeset: e7d7e486bbfd

Original Phabricator Diff: D67872307

changelog: [internal]

Reviewed By: yungsters

Differential Revision: D68268701

fbshipit-source-id: 1eb0dcb257c2d568cbc02ab2aa4a16b161797b24
2025-01-16 10:48:23 -08:00
Samuel Susla 67fc85615a Back out "fix Pressable when transform style is animated" (#48732)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48732

Original commit changeset: e2ac108b064a

Original Phabricator Diff: D68154908

changelog: [internal]

please read summary in D68268701

Reviewed By: yungsters

Differential Revision: D68268700

fbshipit-source-id: ba908e0be5bd171d818efe1bcbb3a97279bafafe
2025-01-16 10:48:23 -08:00
Samuel Susla b059050c87 Back out "Animated: Defer onAnimatedValueUpdate on Attach + Native" (#48731)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48731

Original commit changeset: 2089100a773e

Original Phabricator Diff: D68236594

changelog: [internal]

please read summary in D68268701

Reviewed By: yungsters

Differential Revision: D68268698

fbshipit-source-id: f122336209c4a5ec480d7a6a37224391eb1d2311
2025-01-16 10:48:23 -08:00
iwater 0511e2e49a Disable weak event emitter in AttributedString for Apple Silicon Mac running iOS build app (#48583)
Summary:
https://github.com/facebook/react-native/issues/48225 fixed the same problem on Mac Catalyst build, but this crash also happen on a iOS build app running on Apple Silicon Mac.
The weak event emitter in AttributedString attributes is causing a serialization error when typing into a TextInput in a iOS build app running on Apple Silicon Mac.

## Changelog

[iOS][Fixed] - Workaround for a iOS build app running on Apple Silicon Mac(in Xcode Destination: "Mac(Designed for iPad)") TextInput crash due to serialization attempt of WeakEventEmitter

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

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

Reviewed By: javache

Differential Revision: D68093083

Pulled By: cipolleschi

fbshipit-source-id: ac48be3305eb01ff2b62d63283b929e8ab6b250c
2025-01-16 10:09:03 -08:00
Peter Abbondanzo 8a12672e8a Declare shared interface for accessibility delegate methods (#48543)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48543

Introduces a shared interface for methods that need to be called by the `ReactScrollViewAccessibilityDelegate`

Changelog: [Internal]

Reviewed By: alanleedev

Differential Revision: D67948151

fbshipit-source-id: 9bafaa0b5f9ad5ba2fd73b7b1929d784fa4951c9
2025-01-16 10:05:30 -08:00
Nicola Corti 44b18b9207 Use Gradle configuration avoidance API (#48603)
Summary:
Since we updated Gradle, I've noticed several warnings related to configuration avoidance API:
https://docs.gradle.org/current/userguide/task_configuration_avoidance.html

We should be using tasks.registerting rather than tasks.creating as this is going to break in Gradle 9/10.
This PR fixes it.

## Changelog:

[INTERNAL] -

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

Test Plan: CI

Reviewed By: javache

Differential Revision: D68270870

Pulled By: cortinico

fbshipit-source-id: 0ed44d903692c20d102143082fd0939f4dbeaa88
2025-01-16 08:49:32 -08:00
Peter Abbondanzo bc810e5115 Only apply event throttling to scroll view events (#48712)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48712

Currently, all scroll events can be throttled by the `scrollEventThrottle` value when the intention is only to throttle `onScroll` calls. As a result, the scroll view helper unintentionally drops events unrelated to scrolling, like momentum begin/end. It's imperative that these momentum events dispatch so the scroll view does not lock itself in an "animated" state on the JS side; if locked in an animation state, children of the scroll view will not receive touch events. This can happen when the throttle is sufficiently high and momentum scrolling completes before the throttle time has elapsed.

Changelog:
[Android][Fixed] - Scroll view throttle no longer impacts events other than `onScroll`

Reviewed By: javache, rshest

Differential Revision: D68234045

fbshipit-source-id: d5c11412d3f273811a45e6f61af08d3fcf9f61d5
2025-01-16 07:46:03 -08:00
Parsa Nasirimehr 166347ead9 chore(Android): migrate MessageQueueThread and it's implementation to Kotlin (#48652)
Summary:
Continuing our usual journey, this time migrating MessageQueueThread. Was not expecting to see that many assertions in ReactContext.
One important thing to note on this PR: I had to add an extra Throw RuntimeException to `startNewBackgroundThread`. It already had one from the`dataFuture.getOrThrow()`, but if your thread is not associated with a Looper, calling `myLooper` (Line 203 of MessageQueueThreadImpl) Can return null. Until now, this would have been a `NPE`, i just decided to make it a `RuntimeException` with the message `Looper not found for thread`. Let me know if you want me to make that function return a nullable, or throw another message or exception, or if you want me to treat Looper as Nullable in the whole class.

## Changelog:

[INTERNAL] [FIXED] - Migrate MessageQueueThread and MessageQueueThreadImpl to Kotlin

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

Test Plan: <img width="1318" alt="Screenshot 2025-01-13 at 21 03 00" src="https://github.com/user-attachments/assets/462cc8af-4648-4437-9260-5ffa6c69e763" />

Reviewed By: tdn120

Differential Revision: D68155120

Pulled By: rshest

fbshipit-source-id: 1082a832df5b1d8ee64ca7be26e4b85e79152f88
2025-01-16 07:34:03 -08:00
Mateo Guzmán 9f1236eff2 Fix RTL examples in dark mode (#48719)
Summary:
RTL examples are not visible in dark mode.

## Changelog:

[INTERNAL] - Fix RTL examples in dark mode

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

Test Plan:
<details>
<summary>Before and after screenshots</summary>

| Before                                                                                     | After                                                                                     |
|--------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|
| ![Screenshot_1737000292](https://github.com/user-attachments/assets/4f36c5d3-ea51-4e9a-a962-b6cafbeb82da) | ![Screenshot_1737000381](https://github.com/user-attachments/assets/42f87100-6452-465b-b1de-e5dd26542459) |
</details>

Reviewed By: Abbondanzo

Differential Revision: D68265351

Pulled By: rshest

fbshipit-source-id: c4abcc3d11240c77248475ee34fbe4f5196e7834
2025-01-16 06:53:09 -08:00
Dawid Małecki c720000ae0 Change Promise import syntax (#48725)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48725

Changelog:
[Internal] - Changed Promise import syntax

Reviewed By: cipolleschi

Differential Revision: D68214422

fbshipit-source-id: 1a92449dfae85148c680e449348fef0830c38769
2025-01-16 06:13:48 -08:00
Ruslan Shestopalyuk 918638c1be Fix crash in TouchEvent when initialized with scroll MotionEvent action (#48723)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48723

## Changelog:
[Internal] -

In certain scenarios `TouchEvent` can be initialized with "unexpected" event actions, such as `ACTION_SCROLL`.

This caused an exception , even though such scenarios may be legitimate.

Reviewed By: javache

Differential Revision: D68265040

fbshipit-source-id: d31881e03d9110bb4f6af38548a4f73a41c54d2b
2025-01-16 04:35:51 -08:00
Dawid Małecki 0e6cb590ec Replace $FlowFixMe generated in StaticRenderer snap and migrate to the 'export' syntax (#48667)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48667

Changelog:
[General][Changed] - refactored StaticRenderer syntax

Reviewed By: javache, elicwhite

Differential Revision: D68155216

fbshipit-source-id: a9ea2adef8e2d5aeaac5be4ec4a021595c4edf1f
2025-01-16 04:23:20 -08:00
Riccardo Cipolleschi 198adb47af Fix ruby (#48721)
Summary:
Following the suggestions [here](https://stackoverflow.com/questions/79360526/uninitialized-constant-activesupportloggerthreadsafelevellogger-nameerror), it seems that concurrent-ruby has been released tonight and it is bugged. Let's pin it to the right version.

## Changelog:
[iOS][Changed] - Pin 'concurrent-ruby' to a working version

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

Test Plan: GHA

Reviewed By: robhogan

Differential Revision: D68262719

Pulled By: cipolleschi

fbshipit-source-id: fc6410e28cc96f9d3769d3082a77cac0a3efe6db
2025-01-16 02:57:24 -08:00
Dawid Małecki fa2fac1372 Replace $FlowFixMe in WebSocketEvent (#48693)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48693

Changelog:
[General][Changed] - Improved eventInitDict type in WebSocketEvent class

Reviewed By: elicwhite, cortinico

Differential Revision: D68207452

fbshipit-source-id: 55bb62134c2d67f250c5079304a9c2758d9361df
2025-01-16 02:19:54 -08:00
Dawid Małecki 9a29264ffb Set explicit types in I18nManager exports
Summary:
Changelog:
[Internal] - Added explicit types in I18nManager exports

Reviewed By: elicwhite

Differential Revision: D68214193

fbshipit-source-id: 960ef7b9c0171aed983f4db620bb895ccbff6cd2
2025-01-16 02:08:37 -08:00
Dawid Małecki 595d8c7fa1 Replace import syntax in ReactNativeTestTools (#48687)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48687

Changelog:
[Internal] - Replaced React and ReactTestRenderer import syntax in ReactNativeTestTools

Reviewed By: javache

Differential Revision: D68205425

fbshipit-source-id: 9dd31b57f3d09f602f8e5746b70e16edaf11cb4e
2025-01-16 02:07:05 -08:00
Dawid Małecki 68ae3ca5e9 Change flatten import syntax in StyleSheet (#48705)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48705

Changelog:
[Internal] - Changed flatten import syntax in StyleSheet

Reviewed By: elicwhite

Differential Revision: D68213648

fbshipit-source-id: bf6c33387ae9d36b6ce41b57639948c2b4902e55
2025-01-16 02:04:05 -08:00
Dawid Małecki df9d43f02b Replace $FlowFixMe in TextAncestor (#48704)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48704

Changelog:
[General][Changed] - Improved types in TextAncestor

Reviewed By: fabriziocucci

Differential Revision: D68213115

fbshipit-source-id: d71a2703799b518eb1adb70fb5792165b5956868
2025-01-16 01:48:51 -08:00
Tim Yung 843582b8b5 Animated: Defer onAnimatedValueUpdate on Attach + Native (#48715)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48715

{D68154908} fixed a problem with the `onAnimatedValueUpdate` listener not being correctly attached if `__attach` were called before `__makeNative` (which sets `__isNative` to true).

We're potentially seeing production symptoms of stuttering interactions and user responsiveness, after queuing up many operations. Our hypothesis is that in scenarios where `ensureUpdateSubscriptionExists` is being called during `__makeNative` (instead of during `__attach`), a backup of operations occurs leading to these symptoms.

This diff attempts to validate and mitigate this hypothesis by deferring `ensureUpdateSubscriptionExists` to when an `AnimatedValue` instance has had both `__attach` and `__makeNative` invoked.

Changelog:
[Internal]

Differential Revision: D68236594

fbshipit-source-id: 2089100a773ebfc161fb5b567123eb58a893939f
2025-01-15 17:00:44 -08:00
Tim Yung e0c0476553 RN: Re-enable useInsertionEffectsForAnimations (#48708)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48708

{D68171721} [facebook/react-native#48678](https://github.com/facebook/react-native/pull/48678) mitigated the bug that necessitated this revert.

Changelog:
[General][Changed] - (Reapply) The `AnimatedNode` graph will not occur during the insertion effect phase, which means animations can now be reliably started during layout effects.

Reviewed By: sammy-SC

Differential Revision: D68217144

fbshipit-source-id: 6796440f2839d897158528642e07869951651327
2025-01-15 10:32:27 -08:00
Devan Buggay e566c1ec06 Implement escape/cancel key press callback for TextInput (#48680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48680

## Changelog:

[General] [Added] - Adds the escape key to the key press event handler payload.

Reviewed By: shwanton

Differential Revision: D68186072

fbshipit-source-id: 01786c309bff4991c12fa667e933ff6105efe638
2025-01-15 08:34:55 -08:00
Iwo Plaza c89c5d7e3d Migrated Alert/*.js and ActionSheetIOS/*.js to use export syntax. (#48703)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48703

## Motivation
Modernising the react-native codebase to allow for ingestion by modern Flow tooling

## This diff
- Updates files in Libraries/Alert and Libraries/ActionSheetIOS to use `export` syntax
  - `export default` for qualified objects, many `export` statements for collections (determined by how it's imported)
- Appends `.default` to requires of the changed files.
- Updates Jest mocks of the related modules
- Updates the public API snapshot (intented breaking change)

Changelog:
[General][Breaking] - Files inside `Libraries/Alert` and `Libraries/ActionSheetIOS` use `export` syntax, which requires the addition of `.default` when imported with the CJS `require` syntax.

Differential Revision: D68210738

fbshipit-source-id: a984034b165908f75485f2bad33fcccadd865494
2025-01-15 08:23:49 -08:00
Dawid Małecki 1126bbb149 Add explicit type to supported commands in TextInputNativeCommands (#48688)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48688

Changelog:
[General][Changed] - Added explicit type to supported commands in TextInputNativeCommands

Reviewed By: cortinico

Differential Revision: D68205568

fbshipit-source-id: 53501cdeaf4d790b36156b59f76686e8fef5cc5f
2025-01-15 08:15:37 -08:00
Dawid Małecki f36bfe5dfa Remove redundant {||} syntax (#48686)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48686

Changelog:
[Internal] - Removed redundant `{||}` syntax

Reviewed By: javache

Differential Revision: D68205038

fbshipit-source-id: f7d3271142b6443a5859c3b668b7aebd3ce3ef3f
2025-01-15 07:07:01 -08:00
Fabrizio Cucci e8a64fd638 Migrate rn-tester/IntegrationTests/ImageCachePolicyTest.js to function components (#48701)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48701

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68153254

fbshipit-source-id: 24789c814550cd592cb68a0576c5037088734a75
2025-01-15 06:11:21 -08:00
Fabrizio Cucci 8c64e0868e Migrate rn-tester/IntegrationTests/SimpleSnapshotTest.js to function components (#48700)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48700

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152855

fbshipit-source-id: 121cb5dd65673121a021da12d10c7a7e118bd0dc
2025-01-15 06:11:21 -08:00
Fabrizio Cucci 086e93d227 Migrate rn-tester/IntegrationTests/AppEventsTest.js to function components (#48699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48699

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152557

fbshipit-source-id: 9fa6cad408f6fbd3da513623379b864d0c33c63d
2025-01-15 06:11:21 -08:00
Fabrizio Cucci f864d6b533 Migrate rn-tester/IntegrationTests/ImageSnapshotTest.js to function components (#48698)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48698

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152467

fbshipit-source-id: 0f747f1646be5a3ca010c2c0e0591f13bfcaf2f4
2025-01-15 06:11:21 -08:00
Fabrizio Cucci d1153ff468 Migrate rn-tester/IntegrationTests/PromiseTest.js to function components (#48697)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48697

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152416

fbshipit-source-id: 32d6d503ed119f8d7e5b9c139060b61ef44b8768
2025-01-15 06:11:21 -08:00
Fabrizio Cucci 1a1714300e Migrate rn-tester/IntegrationTests/SyncMethodTest.js to function components (#48696)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48696

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152294

fbshipit-source-id: 16b36d4702159528fe99c1a7d54c2c7b58d30349
2025-01-15 06:11:21 -08:00
Fabrizio Cucci c33954c80d Migrate rn-tester/IntegrationTests/GlobalEvalWithSourceUrlTest.js to function components (#48695)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48695

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152232

fbshipit-source-id: 918236f8c9789efab9cc43b85e53fa398909808c
2025-01-15 06:11:21 -08:00
Tim Yung 00d272fb3b Animated: Fix onUserDrivenAnimationEnded w/ Insertion Effects (#48678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48678

While diagnosing a recent issue in which `AnimatedValue` instances were not being correctly updated as expected, the insertion effects feature flag was identified as a root cause.

Upon further investigation, it appears that this is because the `onUserDrivenAnimationEnded` listener was not implemented the same way in the two feature flag states:

- When `useInsertionEffectsForAnimations` is disabled, `useAnimatedProps` listens to `onUserDrivenAnimationEnded` in a passive effect, after all nodes have been attached.
- When `useInsertionEffectsForAnimations` is enabled, `useAnimatedProps` listens to `onUserDrivenAnimationEnded` in an insertion effect when attaching nodes.

The bugs occurs because `useAnimatedProps` checks whether native driver is employed to decide whether to listen to `onUserDrivenAnimationEnded`. However, we do not know whether native driver will be employed during the insertion effect. (Actually, we do not necessarily know that in a passive effect, either... but that is a separate matter.)

This fixes the bug when that occurs when `useInsertionEffectsForAnimations` is enabled, by moving the listening logic of `onUserDrivenAnimationEnded` into a passive effect. This is the same way that it is implemented when `useInsertionEffectsForAnimations` is disabled.

Changelog:
[Internal]

Reviewed By: javache, sammy-SC

Differential Revision: D68171721

fbshipit-source-id: 50b23348fd4641580581cacebc920959651f96a7
2025-01-15 05:40:15 -08:00
Mateo Guzmán e7378f0d9e Migrate HeaderUtil to Kotlin (#48676)
Summary:
Migrate `HeaderUtil` to Kotlin.

## Changelog:

[INTERNAL] - Migrate `HeaderUtil` to Kotlin

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

Test Plan:
The file had tests:

```bash
yarn test-android
```

Reviewed By: fabriziocucci

Differential Revision: D68205283

Pulled By: javache

fbshipit-source-id: 23ad7726a5e597d5012eec6b194af3b1e10a8b7a
2025-01-15 04:45:02 -08:00
Nicola Corti d90c278672 Reformat MutationObserver test to comply with yarn lint --fix (#48692)
Summary:
Whenever I run `yarn lint --fix` I noticed that this test is not formatted correctly. This fixes it.

## Changelog:

[Internal] [Changed] -

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

Test Plan: CI

Reviewed By: sammy-SC

Differential Revision: D68207001

Pulled By: cortinico

fbshipit-source-id: 2a6c44ca02249f6662b03c87f0c4d4f3eb5a3054
2025-01-15 04:43:50 -08:00
Nicola Corti 9a4b2cecd5 Cleanup prealpha logic from Cocoapods (#48690)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48690

We don't intent to use the prealpha logic in the near future so it makes sense to remove it for
to simplify our already complicated release process. We can always revive it if we wish.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D68205691

fbshipit-source-id: 22a3416335052a4bf6a76faa6e6af622254a6e56
2025-01-15 04:30:37 -08:00
Nicola Corti 63442d3757 RNGP - Cleanup prealpha logic from the Gradle Plugin (#48689)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48689

We don't intent to use the prealpha logic in the near future so it makes sense to remove it for
to simplify our already complicated release process. We can always revive it if we wish.

Changelog:
[Internal] [Changed] - RNGP - Cleanup prealpha logic from the Gradle Plugin

Reviewed By: cipolleschi

Differential Revision: D68205665

fbshipit-source-id: 81d5257544df97b566421164944e3b6e71f06635
2025-01-15 04:30:37 -08:00
Levi c09b71b990 Fabric: Support stylistic sets for fontVariant (#48674)
Summary:
In the old arch, stylistic sets were supported however in the new arch support was not added. It seems that fontVariant support was actually initially missed on iOS fabric however a limited version was added in https://github.com/facebook/react-native/pull/44112 . I referenced that PR and also old arch implementation for these changes.
<img width="480" alt="Screenshot 2025-01-14 at 11 15 18 AM" src="https://github.com/user-attachments/assets/ec32a356-fadd-4281-83b9-15871bbcd18f" />

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

[GENERAL] [ADDED] - Support stylistic sets for fontVariant

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

Test Plan:
- Verified that the "Unsupported FontVariant" native log no longer displays on both platforms
- On iOS was easy to test in the tester app as SF supports stylistic sets by default:
```
<Text>
  Stylistic{'\n'}
  <Text>Normal: ${'\n'}</Text>
  <Text style={{fontVariant: ['stylistic-four']}}>
    Stylistic Four: $
  </Text>
</Text>
```

<img width="391" alt="Screenshot 2025-01-14 at 11 59 29 AM" src="https://github.com/user-attachments/assets/1ede258e-783f-448f-8300-4c8c710796ef" />

- On Android I could not find any system fonts that support stylistic sets by default so I added Raleway and confirmed with a W character
![image](https://github.com/user-attachments/assets/e4b661ba-0013-4e60-90d0-1864be538159)

I did not add font variant example to the tester apps as I felt it could be confusing for people at a glance to understand why there is only a system font example on iOS and why I chose the specific stylistic set.

Reviewed By: cipolleschi

Differential Revision: D68205738

Pulled By: javache

fbshipit-source-id: 03ce572d3c8ecafca71fe00fc0e88eeafc2558bb
2025-01-15 04:23:39 -08:00
Pieter De Baets a18bc58645 Provide default implementation of ViewManager#getDelegate (#48664)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48664

Simplify ViewManager base-class by making `ViewManager`'s delegate non-nullable and using a single path for updating properties.

The ViewManagerDelegate API can map back to the original ViewManagerSetter API transparently, allowing us to remove the codepath from `ViewManagerPropertyUpdater`.

Changelog: [Android][Removed] `ViewManagerPropertyUpdater.updateProps` is deprected, use the related ViewManager APIs instead

Reviewed By: mdvacca, rshest

Differential Revision: D68120420

fbshipit-source-id: cd8b906dc36d4803dbe09ee0283654285eb81fd4
2025-01-15 04:05:47 -08:00
Pieter De Baets 54ac150324 Convert com.facebook.react.uimanager.ViewManagerPropertyUpdater to Kotlin (#48658)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48658

Migrate to Kotlin before I make further changes to this. Generics are really tricky due to our previous usage of raw generics on the Java side, but were worked around by some combination of unchecked cast and `Nothing`

Changelog: [Internal]

Reviewed By: mdvacca, rshest

Differential Revision: D68102210

fbshipit-source-id: 90013f09db0826f571a4e2a84132ae3b49fa299d
2025-01-15 04:05:47 -08:00
Joe Vilches 3420eb87b0 Allow text inputs to handle native requestFocus calls (#48547)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48547

For some unknown reason, we have been swallowing [`requestFocus`](https://developer.android.com/reference/android/view/View#requestFocus(int) calls since `TextInput` is a controlled component - meaning you can control this components value and focus state from JS. This decision was originally made pre 2015 and I cannot find the reason why

I do not think this makes sense. We can still request focus from JS, while allowing the OS to request focus as well in certain cases and we would still be controlling this text input.

This is breaking keyboard navigation. Pressing tab or arrow keys will no-op if the next destination is a `TextInput`. This is because Android will call `requestFocus` from [here](https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/view/ViewRootImpl.java;l=7868?q=performFocusNavigation) when handling key events. Notably, Explore By Touch (TalkBack) swiping gestures WOULD focus `TextInputs` since they go through `ExploreByTouchHelper` methods which we override to call the proper `requestFocusInternal()` method.

**In this diff**: I move the logic in `requestFocusInternal()` into `requestFocus`.

Changelog: [Android] [Fixed] - TextInputs can now receive focus via external keyboard

Reviewed By: NickGerleman

Differential Revision: D67953398

fbshipit-source-id: 506006769a7c8a63f0a9b7ce27cfbe8578777790
2025-01-14 16:31:52 -08:00