Commit Graph

38536 Commits

Author SHA1 Message Date
Sam Zhou 105aa129d8 Deploy 0.248.0 to fbsource
Summary: Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D64225120

fbshipit-source-id: ce00574ea5d367737191ac430017332799906ebe
2024-10-11 09:59:44 -07:00
Thomas Nardone fc199bb5f3 Convert ReactViewManager to Kotlin (#46965)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46965

Converting this class as close to 1:1 as possible.

Changelog: [Internal]

Reviewed By: NickGerleman, rshest

Differential Revision: D64124890

fbshipit-source-id: 2034ed8ecb877bb267a953b183b77daaf883a80a
2024-10-11 09:14:55 -07:00
Peter Abbondanzo 483b928224 Swallow exceptions on draw, forward to onError (#46964)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46964

Graceful degradation is better than outright crashing. When rendering images that exceed Android's memory limits, React Native applications will fatally crash. This change intervenes by swallowing the exception that Android raises and forwards it to the `onError` handler. As a result, no image will be rendered instead of fatally crashing.

Fresco already intervenes by default. It will raise a `PoolSizeViolationException` if the bitmap size exceeds memory limits set by the OS and applies a 2048 pixel maximum dimension to JPEG images, but it's still possible for these configuration limits to be removed and for images to fall just short of Fresco's memory limit. The exception is raised when we attempt to draw the bitmap, not when the bitmap is allocated in memory, so we must handle the exception here and not in Fresco.

## Changelog

[Android][Fixed] - Apps will no longer fatally crash when trying to draw large images

Reviewed By: tdn120

Differential Revision: D64144596

fbshipit-source-id: 32b69ad4ecef0564c2cad7a287a31b56688f38b8
2024-10-11 09:10:30 -07:00
Blake Friedman 44fe0643ff Add changelog for 0.76.0-rc.3 (#46752)
Summary:
Add changelog for 0.76.0-rc.3

Changelog:
[Internal] - add changelog

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

Reviewed By: cortinico, cipolleschi

Differential Revision: D63693195

Pulled By: blakef

fbshipit-source-id: a1a0ef6b24c3caab11527f8c89ce9d642be125a8
2024-10-11 08:56:45 -07:00
Samuel Susla ca6dc67570 fix stale contentSize in ScrollView (#46981)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46981

changelog: [internal]

stateUpdate with closure syntax has to be used in order to not override contentSize stored inside of C++ state.

Reviewed By: jessebwr

Differential Revision: D64242221

fbshipit-source-id: 32d55ccc03e32922f2746293ccb6c0941ca67d92
2024-10-11 08:44:29 -07:00
Nick Lefever aacd4bba29 Disable shadow node reference updates by default (#46961)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46961

Changelog: [Internal]
Runtime Shadow Node Reference Syncing causes asserts when updating the shadow tree without passing through the JS-thread. This diff disables the feature by default to avoid the asserts encountered on RN Windows.

Reviewed By: sammy-SC

Differential Revision: D64188839

fbshipit-source-id: eb65206662d842f8150f1771c86dc8d190cbc3aa
2024-10-11 08:35:34 -07:00
Fabrizio Cucci c09f824962 Replace React.AbstractComponent with component type in ActivityIndicator (#46951)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46951

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

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D64175898

fbshipit-source-id: 4db76dda0c4ac604c38dc3acf5bc39448cad006e
2024-10-11 06:53:43 -07:00
Fabrizio Cucci bcb6dafedc Replace React.AbstractComponent with component type in Pressable (#46950)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46950

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

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D64175859

fbshipit-source-id: 56c3fe658a372b5148952850166781b733bbb37a
2024-10-11 06:53:43 -07:00
Riccardo Cipolleschi ce5358866f Disable e2e on PR (#46974)
Summary:
Commit https://github.com/facebook/react-native/commit/d4edbcffbf9e797d33bf06a8873c73874ec51bdc mistakingly enable iOS e2e on PRs
This change disable them again

## Changelog:
[Internal] - disable e2e in PRs

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

Test Plan: GHA

Reviewed By: cortinico

Differential Revision: D64239005

Pulled By: cipolleschi

fbshipit-source-id: 5b3655d1f8ebb07fd552f656fee0e8e3f255301a
2024-10-11 06:40:40 -07:00
Nicola Corti 972c2c864c Bump Kotlin 1.9.x to 2.0.x (#46955)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46955

This is a major bump of Kotlin. It comes with no breaking changes for the Kotlin API, but there are several new warnigns that I had to fix.
Most importantly several `override` methods that are overriding Deprecated API, also need to be deprecated as well in Kotlin.

Changelog:
[Android] [Changed] - Bump Kotlin 1.9.x to 2.0.x

Reviewed By: tdn120

Differential Revision: D64179842

fbshipit-source-id: 295ab2636ce9f9bb04e9d8c7ed27d9f8a1a64338
2024-10-11 05:34:02 -07:00
Riccardo Cipolleschi d4edbcffbf Move E2E tests to larger machines to see if flakyness decreases (#46960)
Summary:
This change move E2E tests to larger mac machines to see if we can reduce the flakyness.
Most of the time the flakyness is due to slowness in connecting to the simulator or slowness in Metro to provide the bundle to RNTester when we run the tests in Debug.
More power should speed-up those processes.

E2E tests took < 30 min in this diff
on Main, they took > 120 min

## Changelog:
[Internal] - Move the E2E tests to bigger machines

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

Test Plan: GHA

Reviewed By: blakef

Differential Revision: D64237659

Pulled By: cipolleschi

fbshipit-source-id: c2458413c8de70c07fae8f2b5f202371c6293815
2024-10-11 05:10:10 -07:00
Nicola Corti 2c4567562c RNGP - Pass PROJECT_ROOT_DIR to CMake (#46958)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46958

This will make it easier to link against custom C++ TM which will most likely live inside ./shared or
some other paths outside of ./android.

CMake will have access to `PROJECT_ROOT_DIR` which points to ./android (the folder where the settings.gradle file exists).

Changelog:
[Internal] [Changed] - RNGP - Pass PROJECT_ROOT_DIR to CMake

Reviewed By: cipolleschi

Differential Revision: D64183641

fbshipit-source-id: 347256c04f10e92cf5a13e9c70db16aa29bcb741
2024-10-11 03:34:54 -07:00
Nick Gerleman b69a92e2c9 Add boxShadow support to BaseViewManager (#46936)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46936

Let's enable box-shadow everywhere! This should be safe, now that we assume any background mutating methods in BaseViewManager go through BackgroundStyleApplicator. `boxShadow` is also already in `BaseViewConfig` instead of configs for each native component (bc we were already planning to make this change).

Changelog:
[Android][Added] - Add boxShadow support to BaseViewManager

Reviewed By: mdvacca

Differential Revision: D64140841

fbshipit-source-id: e937a4bcaa4506fd25d0916633313083c7e49333
2024-10-10 18:02:50 -07:00
Nick Gerleman 6741fd94ad Add missing BaseViewManager props to BaseViewManagerDelegate (#46934)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46934

BaseViewManagerDelegate is a handcrafted second source of truth, used specifically for codegen.

The organization here has some problems, but this diff adds the props currently missing from it, so that these work correctly in generated view managers.

Changelog:
[Android][Fixed] - Add missing BaseViewManager props to BaseViewManagerDelegate

Reviewed By: mdvacca

Differential Revision: D64137615

fbshipit-source-id: 4ff85f2524e5472f3b768e212fd5f2d4d9a36e17
2024-10-10 18:02:50 -07:00
Ramanpreet Nara 9119c32785 earlyjs: Implement decoratedExtraDataKey (#46932)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46932

In the old error handling pipeline, when the app [assigns an object to error[ExceptionsManager.decoratedExtraDataKey]](https://fburl.com/code/9t9u8rgv)

```
        const error = new Error('Some error happened');
        // Annotates the error with some custom extra data.
        error[ExceptionsManager.decoratedExtraDataKey] = {foo: 'bar'};
        ExceptionsManager.handleException(error, true);
```

That object [gets forwarded as extraData](https://fburl.com/code/gy7v173u) to ExceptionsManager.

This diff implements that functionality within the c++ earlyjs pipeline.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63927091

fbshipit-source-id: ac88bf3e545714aa42531e8e1365e2eba32a7c2b
2024-10-10 16:03:02 -07:00
Ramanpreet Nara 9619ba5ce6 Integrate logbox into earlyjs c++ pipeline (#46935)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46935

Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript.

## The API

```
if (global.RN$registerExceptionListener != null) {
  global.RN$registerExceptionListener(
    (error: ExtendedExceptionData & {preventDefault: () => mixed}) => {
      error.preventDefault();

      // show logbox
    },
  );
}
```

## The Future API
We want something more aligned with the HTML spec:

```
addEventListener('error', (event) => {
   event.preventDefault();
   // show logbox
});
```

## Fatals vs soft errors
The earlyjs pipeline covers just main bundle execution for now.

So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63769385

fbshipit-source-id: 9c01e1cfe0ec80842af2e5bcfbf0adfb040dbcf3
2024-10-10 16:03:02 -07:00
Ramanpreet Nara 509abff063 Extend earlyjs c++ pipeline for soft errors (#46893)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46893

Before, the c++ pipeline only supported fatal errors.

Now, it supports soft errors!

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63927090

fbshipit-source-id: ddaad0ea9b4aa1f889b24ca388cd6b9b1c83adba
2024-10-10 16:03:02 -07:00
Ramanpreet Nara 934af0c59e Align earlyjs c++ stack trace parsing with js (#46894)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46894

This diff re-implements [js error stack trace parsing](https://github.com/facebook/react-native/blob/86cac6836502aaeb5c894bff6427e837c52c09e0/packages/react-native/Libraries/Core/Devtools/parseErrorStack.js#L41-L57) in c++.

Details:
- I migrated [stacktrace-parser](https://github.com/errwischt/stacktrace-parser/blob/ad379de5e5ac056012bbeb12923cf502aefe4710/src/stack-trace-parser.js#L7)
- I migrated [parseHermesStack.js](https://github.com/facebook/react-native/blob/86cac6836502aaeb5c894bff6427e837c52c09e0/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js#L82)

I also migrated all their tests to c++:
- [stacktrace-parser tests](https://github.com/errwischt/stacktrace-parser/blob/ad379de5e5ac056012bbeb12923cf502aefe4710/test/stack-trace-parser.spec.js#L5)
- [parseHermesStack tests](https://github.com/facebook/react-native/blob/86cac6836502aaeb5c894bff6427e837c52c09e0/packages/react-native/Libraries/Core/Devtools/__tests__/parseHermesStack-test.js#L16)

Changelog: [Internal]

Reviewed By: javache, NickGerleman

Differential Revision: D63659013

fbshipit-source-id: 146acc9db7d4e8907b9fa1d42e4979133ef020f6
2024-10-10 16:03:02 -07:00
Ramanpreet Nara e4645d033a easy: Align earlyjs c++ native data structures with js (#46895)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46895

For the js error handling pipeline, the javascript data structure looks like [this](https://www.internalfb.com/code/fbsource/[6181b57f4ba3619f58056bcec65382650d6ff59a]/xplat/js/react-native-github/packages/react-native/src/private/specs/modules/NativeExceptionsManager.js?lines=17-35):

```
export type StackFrame = {|
  column: ?number,
  file: ?string,
  lineNumber: ?number,
  methodName: string,
  collapse?: boolean,
|};
export type ExceptionData = {
  message: string,
  originalMessage: ?string,
  name: ?string,
  componentStack: ?string,
  stack: Array<StackFrame>,
  id: number,
  isFatal: boolean,
  // flowlint-next-line unclear-type:off
  extraData?: Object,
  ...
};
```

So, I made the c++ data structure look similar
```
  struct ParsedError {
    struct StackFrame {
      std::optional<std::string> file;
      std::string methodName;
      std::optional<int> lineNumber;
      std::optional<int> column;
    };

    std::string message;
    std::optional<std::string> originalMessage;
    std::optional<std::string> name;
    std::optional<std::string> componentStack;
    std::vector<StackFrame> stack;
    int id;
    bool isFatal;
    jsi::Object extraData;
  };
```

Notes:
* [parseErrorStack](https://fburl.com/code/e27q9gkc) doesn't actually generate a collapse property on the error object. So, I omitted it from the c++.
* ExceptionsManager [always provides an extraData field](https://fburl.com/code/2bvcsxac). So, I made it required.
* In C++, I just stored extraData as a jsi::Object. I wanted the freedom to store arbitrary key/value pairs. But, I also didn't want to use folly::dynamic.

Changelog: [Internal]

Reviewed By: alanleedev

Differential Revision: D63929580

fbshipit-source-id: 51d8fcc79c9383789d456cfe4527cdd3f579395f
2024-10-10 16:03:02 -07:00
Eli White ff698f542e Make RN ColorScheme a Union (#46872)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46872

This can now be flow typed as a union because the codegen supports it.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D63681874

fbshipit-source-id: 97783df5ae71292dd10602dee0bea39743e62234
2024-10-10 14:20:49 -07:00
Joe Vilches b0e2cb3371 Back out "fix(iOS): Replace uses of CGColorRef with UIColor to avoid manual memory management" (#46967)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46967

Original commit changeset: 5e85e17567e3

Original Phabricator Diff: D63989547

This is causing some crashes internally

Changelog: [Internal]

Reviewed By: shwanton

Differential Revision: D64194385

fbshipit-source-id: 835469e09971ae39d2db6e82f6c05970b1e6238c
2024-10-10 13:41:13 -07:00
Nicola Corti f25abe51ce Remove Deprecated DefaultDevSupportManagerFactory.create() (#46959)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46959

This method was deprecated in: b8893c7003
since React Native 0.72.

I verified that no-one is using it in OSS so I'm removing it.

This is necessary as I'll need to refactor the BridgelessDevSupportManager a bit.

Changelog:
[Android] [Breaking] - Remove Deprecated DefaultDevSupportManagerFactory.create()

Reviewed By: javache

Differential Revision: D64184635

fbshipit-source-id: a4081b2189d2e22cd9b2067f982a6ffd4f8b054e
2024-10-10 11:32:37 -07:00
Pieter De Baets e4bdde6562 Remove default false/null props from Text (#46956)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46956

isHighlighted/isPressable/selection color are the same as the native default, there's no need to send these in our props payload needlessly.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D64179256

fbshipit-source-id: 22e62c8d440d3bd219a79f445e49739c24fa5d52
2024-10-10 11:30:11 -07:00
Peter Abbondanzo 09682b5109 Fix dark mode text (#46898)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46898

Replaces *many* `Text` component usages with `RNTesterText`: a thin wrapper around `Text` that applies color based on the color scheme chosen by the user. It makes text legible for dark mode across 41 different example files. This changes intentionally do not touch a few larger component sites that expand beyond RNTester, like `Animated` and `NewAppScreen`

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D64053464

fbshipit-source-id: 9516fef2afe1b364eb38e85e3a2dbb5c434e44db
2024-10-10 11:02:18 -07:00
Nikita Lutsenko f7b28e86aa rn/objc | Suppress warnings about set but unused variables. (#46945)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46945

Fixing a warning, so we can enable it globally.

Changelog:
[iOS][Fixed] - Silenced 'set but unused variable' warning.

Reviewed By: cipolleschi

Differential Revision: D64161528

fbshipit-source-id: 39f80d46a04422dd167334a4492fd2119503ca23
2024-10-10 11:00:34 -07:00
Fabrizio Cucci f98006830c Replace React.AbstractComponent with component type in ProgressBarAndroid.android.js (#46928)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46928

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64113211

fbshipit-source-id: f850739f9116cf0cc8705e541a97333aa04c3a44
2024-10-10 10:59:58 -07:00
Fabrizio Cucci c00f0d36b1 Replace React.AbstractComponent with component type in ScrollView (#46927)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46927

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64112934

fbshipit-source-id: d869ccd814cd3bbda2a548c7c2d405f651605716
2024-10-10 10:59:58 -07:00
Fabrizio Cucci c8fd793cff Replace React.AbstractComponent with component type in ScrollViewStickyHeader (#46926)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46926

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64111478

fbshipit-source-id: 674316b9545dd12420e50f77cff6ac1c94783d4e
2024-10-10 10:59:58 -07:00
Fabrizio Cucci 5d07c7232c Replace React.AbstractComponent with component type in TextInput (#46925)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46925

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64109824

fbshipit-source-id: 9823a459c9bd4f3eed4d3c560f0bdaf4be16d410
2024-10-10 10:59:58 -07:00
Ruslan Shestopalyuk e39c91703d Add an event start timestamp field into RawEvent (#46949)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46949

# Changelog:

[Internal] -

This adds an (optional) event start time field into RawEvent, so that it can be threaded by the platform-specific code to tell where is the earliest point of the event start (depending on the platform).

For example, on Android platform it can be the point of time when the original MotionEvent was received.

Reviewed By: rubennorte

Differential Revision: D64175467

fbshipit-source-id: 535c95c695713dbbed74c554bceb70fa5e511d6a
2024-10-10 09:12:15 -07:00
David Rickard 26d8d490e4 Fix null ref on iOS 18 (#46929)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46929

Got this error on Marketplace Home when I tried on the iOS 18 simulator:

```
Cannot read property 'stack' of null

if (rejection.stack && ...
```

This indicated `rejection` was null.

Fixed by adding an extra null check there.

Changelog:
[iOS][Fixed] Fixed crash on promise rejection handler in iOS 18.

Differential Revision: D64116020

fbshipit-source-id: 4198748b47d27c6def9957ff475ee780962d3baa
2024-10-10 09:11:53 -07:00
sarthak-d11 af4907025e fix: change opacity logic from random to decrement by -0.20 (#46830)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:

ME2E0003

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[ Internal ] [ Changed ] - The opacity logic is changed from random to decrement the opacity by -0.2
For more details, see:

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

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

Reviewed By: rshest

Differential Revision: D64173519

Pulled By: cipolleschi

fbshipit-source-id: 69a09b64e7e4f098d3bfd72529401dadb49b93d7
2024-10-10 08:59:25 -07:00
Fabrizio Cucci 1e8bee94cb Replace React.AbstractComponent with component type in TouchableBounce (#46924)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46924

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64108765

fbshipit-source-id: bc10f958948c24b16964e63790a9cb40bce095e9
2024-10-10 08:36:53 -07:00
Fabrizio Cucci 90523b62a5 Replace React.AbstractComponent with component type in TouchableHighlight (#46923)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46923

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64107889

fbshipit-source-id: 824e318da8e833f82d2bd869a8c6485ec9dd541e
2024-10-10 08:36:53 -07:00
Fabrizio Cucci 8d230fa78a Replace React.AbstractComponent with component type in TouchableOpacity (#46922)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46922

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64107774

fbshipit-source-id: f7b9afa8b0a08cedc07c055054bd2cda9a2b5b84
2024-10-10 08:36:53 -07:00
Fabrizio Cucci 15f5ba4f9e Replace React.AbstractComponent with component type in DebuggingOverlay (#46921)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46921

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64107726

fbshipit-source-id: abd75fbb79db0b8f75b55c7c57e8b021b800256f
2024-10-10 08:36:53 -07:00
Thomas Nardone 6c35ff92dc View clipping tweaks (#46933)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46933

Some small tweaks to either resolve or better log clipping-related crashes in ReactViewGroup
Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D63914809

fbshipit-source-id: cf8bfd260c6affb85b8e1ac13447ae9f01d19135
2024-10-10 08:32:15 -07:00
Qichen Zhu ca0abd1b9e Set TextInput selection correctly when attached to window in Android (#46948)
Summary:
On Android, when `ReactEditText` is attached to window, `setTextIsSelectable` moves the caret to the beginning, so we need to restore the selection.

This is similar to what we did in https://github.com/facebook/react-native/pull/17851.

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

## Changelog:

[ANDROID] [FIXED] - Fix TextInput caret moving to the beginning when attached to window

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

Test Plan:
Code to reproduce in RNTester:

```TSX
import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
import {TextInput} from 'react-native';
import {useEffect, useRef} from 'react';

function Playground() {
  const input = useRef(null);
  useEffect(() => { setTimeout(() => input.current?.focus(), 1000); }, []);
  return <TextInput ref={input} value='1.00' selection={{start: 4, end: 4}} />;
}

export default ({
  title: 'Playground',
  name: 'playground',
  render: (): React.Node => <Playground />,
}: RNTesterModuleExample);
```

Before | After
-- | --
![Screenshot_1728553990](https://github.com/user-attachments/assets/382cf3ec-7437-4b0d-8c15-c8923d677afd) | ![Screenshot_1728553884](https://github.com/user-attachments/assets/9883e966-e9b8-4f8a-bedb-6ee43880d482)

Reviewed By: cortinico

Differential Revision: D64175774

Pulled By: rshest

fbshipit-source-id: ef9fdbecca582c8075bcdfd2d9b810b04d87e3d9
2024-10-10 08:29:56 -07:00
Sam Zhou 2bc25be88c Replace last React.Ref type usage in react-native (#46931)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46931

Prepare for deletion of this deprecated type that contain support for string ref in the next flow release.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D64127228

fbshipit-source-id: 9d3a1c0e6303efb35a540349fdc8e42b7b70be8b
2024-10-10 08:19:34 -07:00
Ruslan Lesiutin 4eceb7e568 Implement Runtime.releaseObject and releaseObjectGroup (#46032)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46032

Changelog: [Internal]

Implements the [`Runtime.releaseObject`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#method-releaseObject) and [`Runtime.releaseObjectGroup`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#method-releaseObjectGroup) CDP methods. These are used by CDT in a few places to release inspected objects (e.g. as part of the [popover](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/blob/7b143e5d05a102c8c9cc7e282bab7b0751f75d61/front_end/panels/sources/DebuggerPlugin.ts#L766) feature), which is important to prevent memory leaks in long-running Fusebox sessions.

Reviewed By: dannysu, robhogan

Differential Revision: D61280394

fbshipit-source-id: 82181c6d0d6e52cf606ef2f48d389631e44b295e
2024-10-10 07:49:46 -07:00
Oskar Kwaśniewski 7e1674fc59 feat: deprecate passing separate new arch flags to RCTRootViewFactory (#46652)
Summary:
This PR follows up with the deprecation introduced here: https://github.com/facebook/react-native/pull/46228

The idea is to have new architecture depend on one flag, namely `newArchEnabled`. It exposes additional initializers for RCTRootViewFactory.

## Changelog:

[IOS] [CHANGED] - Use `newArchEnabled` flag in RCTAppDelegate and RCTRootViewFactory

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

Test Plan: CI Green

Reviewed By: javache

Differential Revision: D64173015

Pulled By: cipolleschi

fbshipit-source-id: 49474baf5415a2527e481a5d68ec94ae874185e6
2024-10-10 07:39:16 -07:00
Fabrizio Cucci 865f302e0c Replace React.AbstractComponent with component type in ImageTypes (#46920)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46920

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64107532

fbshipit-source-id: 9fb09e0b5735f9f7b91b46867e35043fe9d679f0
2024-10-10 07:01:29 -07:00
Fabrizio Cucci 5f058018dc Replace React.AbstractComponent with component type in various examples (#46919)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46919

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64105531

fbshipit-source-id: 5729862a95f544a3c1e1a88484d145ba92e192a6
2024-10-10 07:01:29 -07:00
Fabrizio Cucci 6e2b9daf7d Replace React.AbstractComponent with component type in VScrollViewNativeComponent (#46917)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46917

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64108764

fbshipit-source-id: 44cf9316a03bb18b658aeb45b7d951ad346ae3f0
2024-10-10 07:01:29 -07:00
Fabrizio Cucci f86a14e4ad Replace React.AbstractComponent with component type in View (#46916)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46916

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64104990

fbshipit-source-id: c747f4e89b5631a6c1543aca86cbea4db4987f5a
2024-10-10 07:01:29 -07:00
Dawid ab8f3ff3e9 fix: vertical scroll views are detected as horizontals (#46836)
Summary:
There is a numerical issue that causes vertical scroll view to be considered as the horizontal one and leads to problems described [here](https://github.com/facebook/react-native/issues/46592). The problem is no longer visible after checking if the scroll view is horizontal with float equality.

~~I am not sure if it also happens on Android, so I am leaving it as a draft for now.~~

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

## Changelog:

[IOS] [FIXED] - check if scroll view is horizontal with float equality.

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

Pick one each for the category and type tags:

[IOS] [FIXED] - fixed scroll view

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

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

Test Plan: Tested on the repro provided in the above issue.

Reviewed By: rshest

Differential Revision: D64114476

Pulled By: cortinico

fbshipit-source-id: a5048e1403c4bb675d32928937d6411cfb12fd51
2024-10-10 06:37:28 -07:00
Fabrizio Cucci 46a9711454 Replace React.AbstractComponent with component type in SafeAreaView (#46913)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46913

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

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64104922

fbshipit-source-id: 3210b6b7368872f13f9006bb1b19de9f92aa4bc8
2024-10-10 05:21:53 -07:00
Edmond Chui 91a40a28de Fusebox reload-to-profile (Part 1 of 2: native) (#46856)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46856

Changelog:
[General][Added] - Add support for reload-to-profile in Fusebox. (Part 1 of 2: native)

CDT: https://github.com/facebookexperimental/rn-chrome-devtools-frontend/pull/117
React: https://github.com/facebook/react/pull/31021

This diff adds support for reload2profile under bridge and bridgeless for iOS, Android, and C++

Reviewed By: hoxyq

Differential Revision: D63233256

fbshipit-source-id: f2f2814491e785b03af143cc26639ef178881fff
2024-10-10 05:20:18 -07:00
zhongwuzw 77889afa1c Fixes missing char mode of linebreakmode (#46941)
Summary:
cipolleschi , Fixes missing char mode of linebreakmode.

## Changelog:

[IOS] [FIXED] - Fixes missing char mode of linebreakmode

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

Test Plan: char mode works.

Reviewed By: cipolleschi

Differential Revision: D64166107

Pulled By: javache

fbshipit-source-id: 1b1a5c603652e1d3bc9f7a32039fab4de7f59627
2024-10-10 04:24:49 -07:00
Joe Vilches 0d6908f4ed Sunset the value namespace (#46930)
Summary:
X-link: https://github.com/facebook/yoga/pull/1720

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

This is not really needed anymore, we can just use `StyleLength` statics instead

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63922280

fbshipit-source-id: cd953bae8e9f68574463eafc49c33c2e85ac1856
2024-10-09 19:20:15 -07:00