Commit Graph

12270 Commits

Author SHA1 Message Date
Nikita Lutsenko d386dfc804 rn | Remove set but unused variable. (#46891)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46891

This was set but never directly used - fix it.
Changelog:
[iOS][Fixed] Removed usage of set but unused variable.

Reviewed By: mg-here

Differential Revision: D64029449

fbshipit-source-id: 0d60428317de95aa235f249c512fa968aa04f879
2024-10-08 12:48:45 -07:00
generatedunixname89002005232357 6b2bbcf632 Revert D63643856
Summary:
This diff reverts D63643856

`_highestMeasuredFrameIndex` is not properly invalidated causing issues with previous logic when data size shrinks.

bypass-github-export-checks

Changelog:
[General][Changed] - Revert "Fix onEndReached not being called when getItemLayout is present and we scroll past render window"

Reviewed By: NickGerleman

Differential Revision: D64009287

fbshipit-source-id: 8a21b57f5247fc743e65f9a730ff33a9a89d2bc1
2024-10-08 12:13:10 -07:00
Nicola Corti cbc0978bb6 Bump AGP to 8.7.0 (#46886)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46886

This brings AGP to the latest stable version.

Changelog:
[Android] [Changed] - Bump Android Gradle Plugin (AGP) to 8.7.0

Reviewed By: tdn120

Differential Revision: D64038466

fbshipit-source-id: d7ba1c8e5840f6c8658f037fc5846fb640ab3922
2024-10-08 10:59:40 -07:00
Anatoliy Magda d54c25fdae Improve FpsDebugFrameCallback.getTotalTimeMS accuracy (#46869)
Summary:
`FpsDebugFrameCallback.getTotalTimeMS()` implementation loses accuracy due to incorrect order of type casting to int

## Changelog:

[ANDROID] [CHANGED] - Improve FpsDebugFrameCallback.getTotalTimeMS() accuracy

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

Test Plan:
- Launch some test app
- Open up the [Dev Menu](https://reactnative.dev/docs/debugging#accessing-the-dev-menu) in your app and toggle Show Perf Monitor
- Compare results of current & improved implementations

Reviewed By: rshest

Differential Revision: D64024054

Pulled By: arushikesarwani94

fbshipit-source-id: 438792bace0e3443d151cf13364f6e94b66dfb5e
2024-10-08 10:49:10 -07:00
Panos Vekris 19fc1c75d4 replace '$TEMPORARY$object' with '$ReadOnly' [1/n] (#46879)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46879

* `js1 flow-runner codemod flow/replaceTempObjWithReadOnly`
* Suppress errors

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D64019269

fbshipit-source-id: 811deeff3be2f9ebed750719da67a4e87a074a67
2024-10-08 10:28:56 -07:00
Panos Vekris 9038a78948 replace '$TEMPORARY$string<str>' with 'str' (#46877)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46877

* Used codemods of [this commit](https://www.internalfb.com/intern/commit/cloud/FBS/3a8982d63197fff7bac8b6d448545ec9660f331e)
* `flow-runner codemod flow/replaceTempStringWithStringLiteral`
* `~/fbsource/xplat/js/scripts/flow/tool add-comments .`

Reviewed By: SamChou19815

Differential Revision: D63991777

fbshipit-source-id: 0b2314c4e88c43c0ca1f92f34516f2408a30624b
2024-10-08 10:28:56 -07:00
Sam Zhou 9b5fef32f1 Update some React.AbstractComponent type to use component type (#46855)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46855

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D63947642

fbshipit-source-id: bec8a2498961b5bc602d86ecb2b5a4b5c4785e09
2024-10-08 09:20:42 -07:00
Thibault Malbranche d7a8aae9ac fix: override podspecs dependencies c++ version (#46888)
Summary:
Some dependencies would override C++ version like [this](https://github.com/mrousavy/react-native-vision-camera/blob/83abb0832a22b6b080f8412ed17b0992532b0eb2/VisionCamera.podspec#L36).

We force it back to be the current version set by react-native so that we are sure projects are using the correct version

## Changelog:

[IOS] [FIXED] - Enforce we use the correct C++ version for all, even if dependency tries to set it

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

Test Plan:
This can be test via
https://github.com/Titozzz/cpp17bug

Reviewed By: blakef

Differential Revision: D64042099

Pulled By: cipolleschi

fbshipit-source-id: c36dda0a718e52e19d53c3e9d895315141cb040c
2024-10-08 08:09:25 -07:00
Peter Abbondanzo ff1c3824d2 Remove unused vector drawable code path (#46878)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46878

Removes an unused code path from `ResourceDrawableIdHelper`. Vector drawables are now loaded via Fresco decoder so we don't need to offer this utility anymore. While part of the public API, it only made it into 0.76.0 RCs and should have really been marked internal.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D64021956

fbshipit-source-id: 6e8073e0f7f079d023fa1e45a5a43f8652ca2826
2024-10-08 07:24:28 -07:00
Alonso Paulino aaf7a6a3ab Back out "cache JNI calls to FabricUIManager::getColor" (#46871)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46871

changelog: [internal]

Original commit changeset: 748efce7f0b8

Original Phabricator Diff: D59859754

This is temporarily until we find an actual solution that can both cache the colors and also react to theme changes updating the colors value properly.

Reviewed By: javache

Differential Revision: D64002346

fbshipit-source-id: 9ba3bd0d653b9a0d8617f45d42c0c3d966fba01f
2024-10-08 04:39:27 -07:00
Panos Vekris 40a4feb681 replace '$TEMPORARY$string<>' with 'string' (#46876)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46876

* Used codemods of [this commit](https://www.internalfb.com/intern/commit/cloud/FBS/3a8982d63197fff7bac8b6d448545ec9660f331e)
* `js1 flow-runner codemod flow/replaceTempStringWithString`
* `js1 flow-runner codemod flow/simplifyUnionsOfString`

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D63991775

fbshipit-source-id: 5b9d1fdf045405230ca2b0969357ae92479692b5
2024-10-07 19:18:14 -07:00
Panos Vekris bed5323374 manually remove instances of '$TEMPORARY$string<>' (#46874)
Summary:
Remove instances of an unsound flow type

Changelog: [internal]

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

Reviewed By: SamChou19815

Differential Revision: D63991776

fbshipit-source-id: 1817b1287803d22195bf521e07b3027b86562f47
2024-10-07 19:18:14 -07:00
Arushi Kesarwani 7b877a4bed Adding support for custom C++ TM wrapper to CxxReactPackage (#46822)
Summary:
Modifying the CxxReactPackage by changing the annotation from UnstableReactNativeAPI to FrameworkAPI so as to now support custom C++ TM wrapper

Changelog:
[Android][Changed] - Modify CxxReactPackage to support custom C++ TM wrapper

Reviewed By: shwanton, christophpurrer

Differential Revision: D63740964

fbshipit-source-id: 175b1104dcd11674413199b30415516d4d324a97
2024-10-07 17:28:00 -07:00
Eli White a669de1dd2 Parse string unions as StringLiteralUnionTypeAnnotation (#46845)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46845

Previously, the parser was throwing away the values of a string union when storing it in the schema. It would only store the union as

```
{
  type: 'UnionTypeAnnotation',
  memberType: 'StringTypeAnnotation'
}
```

We now track the string literals through the parser and store them in the schema:

```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

We aren't changing the generators, those still just output "string". They could eventually be made smarter.

The value of this is that the compat checker can now error when the union changes.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D63917685

fbshipit-source-id: 34a10e1f1910d2935837a3659f66049fd4473134
2024-10-07 16:56:04 -07:00
Eric Rozell 1ffef5669c Fix for multi-root apps with Modal (#46867)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46867

In multi-root Android React Native apps (e.g., multiple ReactFragments), if the following sequence occurs:
1. a Modal is displayed via the secondary root
2. the secondary root is destroyed
3. the app is backgrounded
4. the app is foregrounded

The LifecycleEventListener on the ReactModalHostView will fire, causing the Modal to be rehydrated in the onHostResume callback.

Removing the lifecycle event listener when the modal is detached from the window resolves the issue.

## Changelog

[Android][Fixed] Fix issues with Modals and lifecycle events in multi-surface apps

Reviewed By: alanleedev

Differential Revision: D64001103

fbshipit-source-id: 10f8304cd9cca0d5c90e39f5e361290f4fc35283
2024-10-07 16:09:53 -07:00
Peter Abbondanzo 86d92e41d2 Bump Fresco version to 3.3.0 (#46864)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46864

## Summary
Fresco v3.3.0 contains necessary adjustments to allow downsample overrides per image request (see https://github.com/facebook/fresco/pull/2787), as well as numerous other bug fixes and adjustments across both Drawee and Vito images.

## Changelog
[Android][Changed] - Update Fresco from 3.2.0 to 3.3.0

Reviewed By: oprisnik

Differential Revision: D63983051

fbshipit-source-id: 9ad0c40dfc864d24ffa39ca9e2bc0ddf8210f4f7
2024-10-07 13:44:44 -07:00
Eli White d2f3f06826 Add support for StringLiteralTypeAnnotation (#46827)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46827

You can now define a native module that takes an argument that is a specific string literal:

Like this:
```
export interface Spec extends TurboModule {
  +passString: (arg: string) => void;
  +passStringLiteral: (arg: 'A String Literal') => void;
}
```

On the native side, this will still generate `string`, but the schema will now store the string literal, and it will be allowed in JS. This should allow more strict flow / typescript types for modules.

This will also allow the compatibility check to fail if the literal changes.

This is a step towards accepting a union of string literals.

Changelog: [General][Added] Codegen for Native Modules now supports string literals

Reviewed By: GijsWeterings

Differential Revision: D63872440

fbshipit-source-id: e54b97d34af4a3d1af51727db0777f26fb7b778c
2024-10-07 12:35:19 -07:00
Alan Lee 73ce1984e8 fix crash for Modal not attached to window manager (2) (#46764)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46764

This is a patched fix to earlier attempt (D63700769) and resolving crash due to`java.lang.IllegalArgumentException: View=DecorView@b9f88af[AdsManagerActivity] not attached to window manager`.
- removing ` !dialogWindow.isActive` check as it is always true resulting in always doing early return causing other bugs
- adding try/ catch instead so the code can still run but can catch the known exception without crashing

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

Reviewed By: mdvacca

Differential Revision: D63712422

fbshipit-source-id: 85fb6df340eb1139f954c92b5f1daf0dc41671d2
2024-10-07 12:31:20 -07:00
Thomas Nardone eb04be8ec0 Add ReactViewGroupTest (#46843)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46843

Add some simple tests for ReactViewGroup clipping logic

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63903975

fbshipit-source-id: 8ce683a4aeba2f3916a26d7b4e93b4a30227c6d5
2024-10-07 10:37:44 -07:00
Nick Gerleman 276e3a7df7 Fix mising ANTI_ALIAS_FLAG when resetting Text Paint (#46848)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46848

D63303172 introduced a bug showing truncation on versions of Android <= 28. I tracked this down to `ANTI_ALIAS_FLAG` getting cleared when we reset the paint. This applies it again after resetting, for consistency with previous behavior, and TextView.

This bug doesn't effect newer versions of Android, since API 29+ applies this flag by default. https://github.com/aosp-mirror/platform_frameworks_base/commit/47c51fe80e3dd9d6b518c11c2e1714c271835af5#diff-57b6a0bc3755a19d1faf73c130b0e56e8e13930148c5434666c5a186aeb01c78R256

Changelog:
[Android][Fixed] - Fix mising `ANTI_ALIAS_FLAG` when resetting Text Paint

Reviewed By: javache

Differential Revision: D63930051

fbshipit-source-id: bb4c98834954637b0a8f0dba8502188626a68b54
2024-10-07 10:34:32 -07:00
Tomasz Żelawski cc6d1eb844 feat: Expose MetroConfig type directly from @react-native/metro-config (#46602)
Summary:
React Native [app template provided by the CLI](https://github.com/react-native-community/template) currently uses [`metro-config` directly for `MetroConfig` type](https://github.com/react-native-community/template/blob/main/template/metro.config.js#L7).
However, it doesn't have `metro-config` as neither a dependency or dev dependency, which can lead to version mismatches.

While this is obviously a mistake on the template repo side, `metro-config` versions aren't matched with `react-native` versions. Therefore, getting the correct version of `metro-config` from `react-native/metro-config` would require reflecting on `react-native/metro-config`'s package.json etc. which is far from ideal. In my opinion it's would be much better to expose `MetroConfig` type from `react-native/metro-config` directly.

Version mismatching can happen in a monorepo setup. Say we have the monorepo structure using Yarn Modern:

```tree
.
├── RN75-app (workspace)
├── RN76-app (workspace)
│   ├── metro.config.js
│   └── node_modules
│       └── react-native
│           └── metro-config (0.76)
│               └── node_modules
│                   └── metro-config (version for 0.76)
└── node_modules
    ├── react-native
    │   └── metro-config (0.75)
    └── metro-config (version for 0.75)
```

`react-native@0.75` gets hoisted to the monorepo root while `react-native@0.76` sits in an RN 0.76 app workspace.

Say we have the following `RN76-app/metro.config.js` contents:

```js
const {getDefaultConfig, mergeConfig} = require('react-native/metro-config');

/**
 * Metro configuration
 * https://reactnative.dev/docs/metro
 *
 * type {import('metro-config').MetroConfig}
 */
const config = {};

module.exports = mergeConfig(getDefaultConfig(__dirname), config);
```

In this case, `require('react-native/metro-config')` would resolve to `RN76-app/node_modules/react-native/node_modules/metro-config` since `react-native/metro-config` is a (dev) dependency of the App.

However `import('metro-config).MetroConfig` would resolve to `node_modules/metro-config` since it's not a direct dependency.

This is how we have a mismatch - imported functions come from different packages than imported type.

## Changelog:

[GENERAL] [ADDED] - Expose `MetroConfig` type directly from `react-native/metro-config`.

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

Test Plan:
`yarn build` to generate dist for `react-native/metro-config`, see it has the export of `MetroConfig`.

## Notes

If this PR gets approved, I'll submit relevant one to the CLI template.

Reviewed By: huntie

Differential Revision: D63258881

Pulled By: robhogan

fbshipit-source-id: e6f3c880eb4a0aa902c62932d58f243c38b07c2e
2024-10-07 06:35:01 -07:00
Nick Lefever 7510ba3c2a Clean up layout-only shadow node reference update feature flag (#46825)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46825

Changelog: [Internal]

Removing the `useRuntimeShadowNodeReferenceUpdateOnLayout` feature flag after releasing `useRuntimeShadowReferenceUpdate`.

Reviewed By: shwanton

Differential Revision: D63831444

fbshipit-source-id: 61fd800f5c9f933ce5c18d066a6b5984daed2647
2024-10-07 06:11:36 -07:00
Nick Lefever 7316e3233d Remove layout-only shadow node reference updates (#46824)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46824

Changelog: [Internal]

Removing the implementation of layout-only shadow node reference updates, since the full version of shadow node reference updates are being released.

Reviewed By: shwanton

Differential Revision: D63831453

fbshipit-source-id: 84cb231be6c16bdc4a4b12a559c41b5a77064813
2024-10-07 06:11:36 -07:00
Nick Lefever de56fb6309 Enable shadow node reference updates by default (#46823)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46823

Changelog: [Internal]

Releasing runtime shadow node reference updates, enabling it by default.

Reviewed By: shwanton, rubennorte

Differential Revision: D63829891

fbshipit-source-id: 9292df3f8c7c8986d8e06d3c526ad1e6e8773916
2024-10-07 06:11:36 -07:00
Alex Hunt 2f07130bb3 Align logIfUpdateAvailable to use resolved RN version from CLI (#46777)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46777

Simplifies this internal logic plus ensures there is one source of truth for `reactNativeVersion` in our CLI plugin. Also, renames the `ctx` variable to `cliConfig`, to more clearly signal that this is an integration point with the Community CLI.

Completes this wave of `community-cli-plugin` simplifications.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D63534247

fbshipit-source-id: bf5779fcf971dee1e0caf58b071df360636c53e9
2024-10-07 05:53:37 -07:00
Nicola Corti d1a256f51a Remove ReactNativeFlipper object (#46839)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46839

The `ReactNativeFlipper` object is not referenced in the template since 0.75. We can safely remove it as users should not reference it anymore.

Changelog:
[Android] [Breaking] - Remove ReactNativeFlipper object, deprecated in 0.75

Reviewed By: huntie

Differential Revision: D63897187

fbshipit-source-id: a7d73a98550518e46f8dbc0c9b859e0afb16e8a9
2024-10-07 04:51:45 -07:00
Ramanpreet Nara d0912ed067 Fix global.__fetchSegment's error case (#46854)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46854

When segment fetch fails, it seems incorrect to call the callback twice: once with error, and once with null.

This seems like a bug.

Created from CodeHub with https://fburl.com/edit-in-codehub

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D63959015

fbshipit-source-id: f3ebb0f4732d99d91b5717a5bf193f44d957bde4
2024-10-06 15:13:40 -07:00
Nicola Corti 352c063589 Removed unused mJSEngineResolutionAlgorithm from ReactHostImpl (#46842)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46842

This filed is unused, let's just remove it.

Changelog:
[Internal] [Changed] - Removed unused `mJSEngineResolutionAlgorithm` from ReactHostImpl

Reviewed By: NickGerleman

Differential Revision: D63899705

fbshipit-source-id: 09fbd57333b32071540bf4c0aab9200a83a76010
2024-10-04 20:59:22 -07:00
Nick Gerleman 0b0ac81fbe Fix some cases where we override setBackgroundColor on View-level instead of VM level (#46846)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46846

As of D61658739, BaseViewManager setting color now goes through BackgroundStyleApplicator, which gives a default implementation of setting a background color, while storing information in a way where we can impement things like border radii and shadows on background for out of the box views.

I knew this could lead to breaks where we previously overrode view-level `setBackgroundColor` to do something custom, but didn't override on VM level, but didn't see any external usages so I assumed it should be relatively safe. Turns out we have some internal usages which run into this pattern (D63913128 already fixed one), including a usage in RN itself! Let's override the view managers in these to delegate to the view's custom drawing.

Changelog:
[Android][Fixed] - Fix some cases where we override setBackgroundColor on View-level instead of VM level

Reviewed By: Abbondanzo

Differential Revision: D63922722

fbshipit-source-id: af988d1436c790be97b2be1325541aa418bf43a3
2024-10-04 18:43:49 -07:00
Joe Vilches 3f1e381ded Add RNTester box sizing example and e2e test round 2
Summary:
Add the tests back!

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63844898

fbshipit-source-id: 6c08557e54be01a1dc156cf72f187a5bb6c5d791
2024-10-04 17:07:05 -07:00
Joe Vilches 3ca796edc3 Plumbing to get boxSizing prop to Yoga round 2 (#46820)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46820

Relanding this as we had to unship due to some issues, which are fixed in the previous diff

Reviewed By: NickGerleman

Differential Revision: D63844167

fbshipit-source-id: b3e62004fe87ff732aac1c1622ac35d581b4980f
2024-10-04 17:07:05 -07:00
Joe Vilches f3d51ef519 Fix issue where padding for box sizing is resolved against wrong reference length (#46799)
Summary:
X-link: https://github.com/facebook/yoga/pull/1715

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

Content box impl had a bug where we resolved padding % against the same reference length as the dimensions. Padding should always be against containing block's width. This is also true for width, but not for height, which should be against containing block's height.

This just pipes the width into our box sizing functions.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63787577

fbshipit-source-id: e512338770f25b66506cabab5a7cde8f04397ea0
2024-10-04 17:07:05 -07:00
Benoit Girard f0527d8662 Instrument XMLHttpRequest (#46844)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46844

Currently we can't see when a network query is made. It makes it hard to debug performance in apps like Store because it's unclear which queries are preloaded, which are fetched as early as they can and which ones are fetched late.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D63858486

fbshipit-source-id: 29d74a68f96a7d4c7b212453d7c0ceba525f3e39
2024-10-04 14:27:25 -07:00
Riccardo Cipolleschi ab2c47be28 Fix deadlock when a new surface is getting started while another is stopped (#46841)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46841

Some apps are crashing because surfaces are started and stopped concurrently and this can create a deadlock.

This is an attempt to disentangle the deadlock by not moving synchronously to the main queue when starting a surface

## Changelog
[iOS][Changed] - Do not move to the main queue synchronously when starting a new surface

Reviewed By: fkgozali

Differential Revision: D63899469

fbshipit-source-id: 98cb313ebd610c65f6b06a683912856a00102e44
2024-10-04 13:23:20 -07:00
Eli White 3af126b562 Add support for basic unions for native modules (#46747)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46747

You can now use unions in native modules.

Support for this pretty much existed, but one callsite was throwing for non-cpp modules which meant nobody could use this.

Previously, StructCollector would throw that this was not supported because it couldn't generate it for objc. Instead of generating something smart in the native code for each option, it just tells native to treat them like the base type (number, string, object).

Changelog: [General][Added] Codegen now supports Union Types in NativeModules

Reviewed By: GijsWeterings

Differential Revision: D63664505

fbshipit-source-id: 73278ed9cd64452173c5170aba44ced71181510f
2024-10-04 12:08:51 -07:00
Ariel Lin af3bee6511 add support for iOS "Darker System Colors" (Increase Contrast) setting into AccessibilityInfo (#46826)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46826

This change adds `isDarkerSystemColorsEnabled()` to `AccessibilityInfo` to enable access to iOS's "Increase Contrast" setting option. It also adds a new event, `darkerSystemColorsChanged`, to enable listeners to subscribe to changes on this setting.

## Changelog

[iOS][Added] - Added `isDarkerSystemColorsEnabled()` to `AccessibilityInfo` to read "Increase Contrast" setting value

Reviewed By: cipolleschi

Differential Revision: D63880393

fbshipit-source-id: a476f8fc4d7354826bc344876b359eb1a3485f0d
2024-10-04 11:46:10 -07:00
Nicola Corti 7bb12ebbea Convert react/nativemodule/samples/ to Kotlin (#46816)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46816

This converts the same native module from Java to Kotlin.
I've converted the whole module as it was quite simple + I've fixed some of the warnings.

Changelog:
[Internal] [Changed] - Convert react/nativemodule/samples/ to Kotlin

bypass-github-export-checks

Reviewed By: javache

Differential Revision: D63837631

fbshipit-source-id: bb126d7649a6e8a36510bf2b252ecdfae91fe09f
2024-10-04 07:57:46 -07:00
muskan27797 fa62b7e1ed Add test for background color and border width in text.yml (#46829)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:

- ME2E0017
- ME2E0018

## 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 e2e test for button

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

Test Plan:
yarn e2e-test-ios
yarn e2e-test-android

Reviewed By: rshest

Differential Revision: D63889079

Pulled By: cipolleschi

fbshipit-source-id: ca2ede3142d77170fcb4121b025eab56818ffb07
2024-10-04 07:05:40 -07:00
Ahmed Bilal 1a2532b1fc Add Modal Testing to modal.yml (#46796)
Summary:
This pr is part of issue https://github.com/facebook/react-native/issues/46757 solving tasks [ME2E0001] and [ME2E0002].
## 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
-->
[ Internal ] [ Added ] - Add e2e test for modal

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

Test Plan:
yarn e2e-test-ios
yarn e2e-test-android

Reviewed By: cortinico

Differential Revision: D63829299

Pulled By: cipolleschi

fbshipit-source-id: ff64d0babde8aea6e2586c2f69056a10533750f9
2024-10-04 06:02:13 -07:00
Riccardo Cipolleschi fdee0ebbcb Avoid calling keyWindow on any UIScene (#46832)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46832

After bumping to minIOSVersion 15.1, we refactored the code to remove some check.
In the refactoring, we changed how the `keyWindow` is returned and now we are unsafely casting `UIScene` to `UIWindowScene`.

We have some internal apps that use `UIScene` that are not `UIWindowScene` and the change is causing them to crash.

This change fixes the crash by checking whether the selector is available in the UIScene and casting it only in that case.
Otherwise we return `nil`, the same behavior we used to have before the refactor.

## Changelog
[iOS][Fixed] - Cast the UIScene to UIWindowScene only if the scene respond to the selector

Reviewed By: javache

Differential Revision: D63890980

fbshipit-source-id: 3230e0075f06ed3f3d759b48f9c7bd13d8787b44
2024-10-04 05:53:39 -07:00
Yasir 1c923ad8ab Add Pressable testing case in pressable.yml (#46808)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:

- ME2E0013
- ME2E0014

## 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
-->
[INTERNAL] [ADDED] - Added E2E for Pressable

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

Test Plan:
yarn e2e-test-ios
yarn e2e-test-android

Reviewed By: rshest

Differential Revision: D63838828

Pulled By: cipolleschi

fbshipit-source-id: a28f654a14fbf7f9b79dedf04f402593042fb4a3
2024-10-04 05:53:07 -07:00
shubhamguptadream11 699f73a6b0 Added Submit Application test to button.yml (#46805)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:
- ME2E0011
- ME2E0012

## 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 e2e test for button

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

Test Plan:
```
yarn e2e-test-ios
yarn e2e-test-android
```

Reviewed By: cortinico

Differential Revision: D63829243

Pulled By: cipolleschi

fbshipit-source-id: 87d8e62650c66fb07e116877a212eff79f10eaf2
2024-10-04 04:53:26 -07:00
Oskar Kwaśniewski a1ec345e2a refactor(iOS): move RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED to const (#46833)
Summary:
This PR moves `RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED` as it was used as string in the codebase and in OSS libraries.

## Changelog:

[IOS] [FIXED] - move RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED to const

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

Test Plan: CI Green

Reviewed By: cipolleschi

Differential Revision: D63891220

Pulled By: javache

fbshipit-source-id: d4fa1f751b4b0cb131ab6c6d4dd0a345762d7c71
2024-10-04 04:26:29 -07:00
Saad Najmi 47748c7935 fix(iOS): Properly retain/release backgroundColor in RCTBorderDrawing (#46797)
Summary:
I discovered this while working on my shim of `UIGraphicsImageRenderer` for macOS (See https://github.com/microsoft/react-native-macos/pull/2209). A variable of type`CGColorRef` is not automatically retained and released when passed into a block. There was a case in `RCTBorderDrawing` where we were doing so. To fix this, we have two options:

1. Pass a `UIColor` instead (Requires a change to the signature of the function calling it)
2. Properly retain and release the variable.

The first option would technically be a breaking change (we would need to change the signature of `RCTGetBorderImage`, so I'm opting for option 2.

## Changelog:

[IOS] [FIXED] -  Properly retain/release backgroundColor in RCTBorderDrawing

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

Test Plan: CI should pass. Locally, borders still draw fine for me.

Reviewed By: joevilches

Differential Revision: D63827824

Pulled By: cipolleschi

fbshipit-source-id: 926601d062b90a7d741d7a1af3070cec4b8795ae
2024-10-04 03:56:30 -07:00
Cedric van Putten eeb6122f39 fix(dev-middleware): respond with status code 200 when launching RNDT (#46814)
Summary:
This fixes an issue where `POST /open-debugger?appId&device&target` does not return a proper status code, meaning that the request will never be answered and clients might hang until the request timeout is hit.

## 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] [FIXED] - Respond with status code `200` when successfully launching RNDT

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

Test Plan:
- `curl -v -X POST "<deviceUrl>"`
- This should show a proper response for the request.

before | after
 --- | ---
![image](https://github.com/user-attachments/assets/5b820acd-1168-4642-90ec-f2eeec0afc16) | ![image](https://github.com/user-attachments/assets/82bb2a6c-3c7b-483f-a4a1-ad00e5ca0178)

Reviewed By: NickGerleman

Differential Revision: D63837025

Pulled By: huntie

fbshipit-source-id: ac72fc793e015f0eec498f4a35b4fb9e301c5b32
2024-10-04 02:45:59 -07:00
Riccardo Cipolleschi bd50c4a460 Make sure that all the pods in a project use the same C++ version (#46787)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46787

This issue was raised by a some partner that were integrating with libraries that were setting the wrong C++ version.

With this change, RN takes ownership of the version of C++ that must be supported.

## Changelog
[iOS][Breaking] - Cocoapods decide the C++ version for iOS pods

Reviewed By: blakef

Differential Revision: D63760271

fbshipit-source-id: 5e629c61accd97fb10a199430d31e8b4c73d482b
2024-10-04 02:17:15 -07:00
Nick Gerleman 309cdea337 Use BackgroundStyleApplicator when setting background color in BaseViewManager (#46160)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46160

We use this for all built-in components now, and rely on going through `BackgroundStyleApplicator` to be able to set additional background effects like borders, rounded corners, box shadow, outlines.

Let's use this in `BaseViewManager`, to allow exposing those other effects to all views, letting RN manage the background drawable for views using `BaseViewManager` and exposing the props for the managed styles.

This is technically breaking, in the case where a custom component could previously inherit directly from `BaseViewManager`/`ReactViewGroupManager`, (vs `SimpleViewManager`/`ReactViewManager`), then override `setBackgroundColor` on the Android View, instead of the view manager, but this effected zero of the [276 top libraries](https://github.com/elicwhite/react-native-libraries), so I don't think it would be common to hit.

Changelog:
[Android][Breaking]  - Use BackgroundStyleApplicator when setting background color in BaseViewManager

Reviewed By: tdn120

Differential Revision: D61658739

fbshipit-source-id: 15af649328ea18fda3cd68e56d481ed1c0fd43c4
2024-10-03 14:55:15 -07:00
Joe Vilches 211534b481 Add default test for box sizing (#46800)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46800

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

Had a mini heart attack thinking I set the default to content box. Wrote this to double check and it passed. Might as well check it in

Technically the default to BoxSizing.h is ContentBox, but in the style we override that. Regardless I switched that around so border box was the default.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63802722

fbshipit-source-id: 49ed29657c964bc12a2bf70988061ab4599267ec
2024-10-03 12:21:16 -07:00
Peter Abbondanzo 420229d669 Disable loading XML on main thread (#46712)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46712

## Summary

Now that XML resources are loaded via Fresco decoder, this change removes the custom branch that attempts to load drawables on the main thread. Loading (i.e. binary XML decompression) is performed on a background decoder thread from Fresco the same as every other image type.

## Changelog
[Android][Fixed] - Avoid blocking the main thread when decompressing drawable resources

Reviewed By: javache

Differential Revision: D63476282

fbshipit-source-id: a8510d140f85a55b90bf4aab6fd4cf5e46dfc7fd
2024-10-03 11:41:25 -07:00
Thomas Nardone 0aef7b64dc Convert ReactClippingViewManager (#46812)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46812

Convert to Kotlin as close a 1:1 as possible.

Changelog: [Internal]

Reviewed By: alanleedev

Differential Revision: D63773448

fbshipit-source-id: 72d67ec5993ffb225b016937e6a33fc8d4a8af16
2024-10-03 11:40:41 -07:00