Commit Graph
34076 Commits
Author SHA1 Message Date
Rubén Norte a2e22404fb Remove feature flag to skip mount hook notifications (#43504)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43504

Changelog: [internal]

We identified the issue in the experiments already, so we can remove this flag.

Reviewed By: sammy-SC

Differential Revision: D54945099

fbshipit-source-id: 4d547569eb3bbfd011f5d6894d87bfa542cac07b
2024-03-18 06:15:52 -07:00
Rubén Norte ebe26c198e Improve thread safety of MountingCoordinator (#43503)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43503

Changelog: [internal]

## Context

In the experiments to enable mount hooks on Android we saw some crashes that we couldn't reproduce or pinpoint accurately.

We ran another experiment excluding part of the code in one of the variants, and we found that the problem was in this block (only crashes when `skipMountHookNotifications` is false):
https://github.com/facebook/react-native/blob/121b26184acbb77ff4f2360647cb322ff560b145/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp#L726-L734

Looking more closely at the mounting coordinator code, I realized that some of the methods are not thread-safe, which is likely causing these issues.

~~We're probably only seeing these issues on Android because we have a push model there (we call `pullTransaction` from whatever thread we're committing to, JS thread or Fabric background thread) whereas in the rest of platforms we have a pull model and we always access call `pullTransaction` from the main thread, as we do to report mounts.~~

This is probably fine because both cases are protected by a mutex when accessing through `ShadowTreeRegistry::visit`. But there's a case that doesn't go through it that could be causing the issues: prerendering:
https://github.com/facebook/react-native/blob/121b26184acbb77ff4f2360647cb322ff560b145/packages/react-native/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp#L289

## Changes

1) Make `getBaseRevision` return a copy of the revision rather than a reference.
2) Make all methods that access `baseRevision_` and `lastRevision_` thread-safe.

Reviewed By: javache

Differential Revision: D54945100

fbshipit-source-id: d8b211137d0eac02a5814cc6c376c22733290eab
2024-03-18 06:15:52 -07:00
Rubén Norte 87b73a0bad Enable event loop by default when bridgeless is enabled (#43396)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43396

Changelog: [General][Changed] Enabled new event loop behavior when bridgeless (new architecture) is enabled.

Reviewed By: rshest

Differential Revision: D54682678

fbshipit-source-id: ff8c45bc1caae0e9182aa94d915d7b6f9427caf9
2024-03-18 04:51:39 -07:00
Rubén Norte a1c752cd87 Update OSS renderers with compatibility with event loop (#43507)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43507

Changelog: [General][Changed] - sync React renderers to 18.3.0-canary-9372c6311-20240315

Syncs React renderers to https://github.com/facebook/react/commit/9372c63116fc1e855c51d93d83f5150661371ec3 which is canary for 18.3.0-canary-9372c6311-20240315.

This includes the necessary changes to enable the use of microtasks for scheduling in Fabric.

Reviewed By: yungsters

Differential Revision: D54947212

fbshipit-source-id: 8fd5def5107d77e6a248f653a9d0260b392fab6b
2024-03-18 04:51:39 -07:00
Alex Hunt 14a7202983 Add prepare_release_new workflow, configure via flag (#43518)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43518

This is a minimum approach to achieve a **single-command publish flow** for React Native, unifying the previous `yarn bump-all-updated-packages` and `yarn trigger-react-native-release` workflow entry points.

This diff aims to change as little as possible to achieve the above — introducing a new job that merges operations to create the versioning commit. The triggered publish jobs are unchanged. In future, we may follow this change with further simplifications down the workflow tree.

**Key changes**

- Adds a new CircleCI workflow, `prepare_release_new`, which versions **all packages** and writes a single release commit.
- This replaces `yarn bump-all-updated-packages`, now implemented with the newer `set-version` script.
- Wires this up as an experiment within `trigger-react-native-release.js`, conditionally running the new workflow when `--use-new-workflow` is passed.

**Not changed**

- The single release commit written will continue to trigger both of the existing CI workflows on push (`publish_release` and `publish_bumped_packages`), which are unchanged.
    - The commit summary now includes the `#publish-packages-to-npm` marker, in order to trigger `publish_bumped_packages`.
- Usage: Release Crew members will continue to use the existing local script entry point (as [documented in the releases repo](https://github.com/reactwg/react-native-releases/blob/main/docs/guide-release-process.md#step-7-publish-react-native)), with the opt in flag.
    ```
    yarn trigger-react-native-release --use-new-workflow [...args]
    ```

After we're happy with the E2E behaviour of this workflow in the next 0.74 RC, I will follow up by dropping the `--use-new-workflow` flag and removing the old scripts (T182533699).

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D54956345

fbshipit-source-id: 35fd7af8f3e60a39507b5d978ccd97472bf03ddb
2024-03-18 02:22:46 -07:00
Samuel Susla 06dc448d85 use structs instead of class for TextInputMetrics and KeyPressMetrics (#43510)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43510

changelog: [internal]

- use designated initializers.
- make TextInputMetrics and KeyPressMetrics structs.
- move TextInputMetrics and KeyPressMetrics inside of TextInputEventEmitter.
- Utilise RCTSizeFromCGSize, RCTEdgeInsetsFromUIEdgeInsets and RCTPointFromCGPoint when creating  TextInputMetrics.

Reviewed By: rshest

Differential Revision: D54895928

fbshipit-source-id: 4afd49ffa77c5afafc794808aac7f11bb8213944
2024-03-16 12:12:46 -07:00
Jane Li f2f62cdf54 Back out "Add onUserLeaveHint support to ReactActivityDelegate"
Summary:
This is causing Twilight Android app to hang and crash on start

Original commit changeset: 3f24271405f6

Original Phabricator Diff: D54905564

Reviewed By: sammy-SC

Differential Revision: D54960053

fbshipit-source-id: 5c1063f11ae1314e71288905eb6d8da32ddbfadd
2024-03-15 13:37:22 -07:00
Fabrizio Cucci e19d77828d Make rn-tester navbar follow the current theme (#43514)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43514

Changelog: [Internal]

The navbar active/inactive colors were fundamentally broken on dark theme.

Reviewed By: rubennorte

Differential Revision: D54952629

fbshipit-source-id: 9cfd7d4eb904c7b6a8d7e1e900b4ff076b8aba12
2024-03-15 12:17:21 -07:00
Moti Zilberman 0277871f77 Fix ConsoleApiTest
Summary:
Changelog: [Internal]

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D54957923

fbshipit-source-id: 2178f2715e9c924ee58ac39b728279c914d4891d
2024-03-15 11:48:33 -07:00
Alex Hunt d43cdee98c Remove dangerous "9999" version string default (#43516)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43516

As titled. This seems dangerous — removing with the motivation that we'd prefer this script to fail during execution than to succeed in publishing `9999`.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D54956661

fbshipit-source-id: 23f8d49abd300385dde74871b6d2492ef63f058e
2024-03-15 11:48:22 -07:00
Rob Hogan e180f805e5 Update eslint to ^8.57.0 (#43481)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43481

Update `eslint` to `8.57.0` to satisfy the peer dependency requirements of some incoming plugin updates.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D54898017

fbshipit-source-id: 39a8ac0f9653a104277a7f0054bb7e1fe3ec54f4
2024-03-15 10:33:20 -07:00
Alex Hunt 6f6aaae73e Fix RNTester Podfile.lock update in release workflow (#43513)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43513

The previous `update_podfile_lock.sh` script would fail as executed from the repo root (could not locate RNTester dir). Delete this and replace with direct calls in `prepare-package-for-release.js`, which will fail script on error.

 {F1469216632}

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D54949214

fbshipit-source-id: 4f032069e803e84f835c279d01332d16787dfafc
2024-03-15 10:32:07 -07:00
Fabrizio Cucci f2c335ac96 Fix auto-download of CMake (#43511)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43511

Changelog: [Internal]

This is an attempt to fix [#39783](https://github.com/facebook/react-native/issues/39783).

It seems that when `configureBuildForHermes` runs (as part of `yarn android` in `rn-tester`) cmake may not be available and is not installed automatically:
* for 3p, even after installing the latest Android Studio, cmake 3.22.1 is not available by default but needs to be installed manually
* for Meta employees, same story when looking at the `ANDROID_HOME` set by the `setup_fb4a.sh` in the `.zshrc` file:
```
# added by setup_fb4a.sh
export ANDROID_SDK=/opt/android_sdk
export ANDROID_NDK_REPOSITORY=/opt/android_ndk
export ANDROID_HOME=${ANDROID_SDK}
export PATH=${PATH}:${ANDROID_SDK}/emulator:${ANDROID_SDK}/tools:${ANDROID_SDK}/tools/bin:${ANDROID_SDK}/platform-tools
```

This diff introduces an explicit task to install cmake.

### ALTERNATIVE 1

See D54897379.

### ALTERNATIVE 2

Suggested by cortinico:

> Create a mini module called :packages:react-native:ReactAndroid:hermes-engine:cmake-downloader which just triggers an empty cmake build via Android SDK

Reviewed By: cortinico

Differential Revision: D54859484

fbshipit-source-id: f9ecdf78ff408947b1e85e7da4f112c89d3a8c89
2024-03-15 10:16:29 -07:00
Rubén Norte fb42a55bdf Remove unnecessary enable_shared_from_this from built-in C++ TMs (#43506)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43506

Changelog: [internal]

We've been making all the built-in C++ TurboModules in RN extend `enable_shared_from_this` because we copied from the same template that needed it, but none of them do. This removes that unnecessary extension.

Reviewed By: sammy-SC

Differential Revision: D54901332

fbshipit-source-id: 795c7696e70041d640399e3b9f177999e22fd90b
2024-03-15 07:48:44 -07:00
Rubén Norte 60d3b75d92 Extract user timing classes to a separate module (#43471)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43471

Changelog: [internal]

Just a minor refactor

Reviewed By: sammy-SC

Differential Revision: D54854693

fbshipit-source-id: 4ba4a74cd9a2f0d96fe6259b15b348d990a66d37
2024-03-15 07:48:44 -07:00
Rubén Norte af44ba25bc Create method in NativePerformance module for performance.now (#43469)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43469

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D54854692

fbshipit-source-id: cfcdbb0596ced71d9eddc39c3a6a8d8ae8d9a543
2024-03-15 07:48:44 -07:00
Rubén Norte 5f7483c7f6 Move native code for NativePerformance to ReactCommon (#43470)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43470

Changelog: [internal]

This moves the native code for the Web Performance API to `ReactCommon`, to align with the other default C++ native modules we've defined there.

Reviewed By: sammy-SC

Differential Revision: D54860194

fbshipit-source-id: 32dccb080fb8ebd1e2acbdd59fa2dfe47e372c17
2024-03-15 07:48:44 -07:00
Alex Hunt 3515e51856 Use Hermes CDPAgent by default (#43482)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43482

## Context

We are migrating to the new Hermes `CDPAgent` and `CDPDebugAPI` APIs in the modern CDP server (previously `HermesCDPHandler`).

## This diff

Now that we are confident that `CDPAgent` is stable, switch to it by default and remove the previous integration.

- Drop `inspectorEnableHermesCDPAgent` feature flag.
- Rename and replace `HermesRuntimeAgentDelegateNew` as `HermesRuntimeAgentDelegate`.
- Drop "Hermes integration: CDPAgent" log message.
- Update tests.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D54897841

fbshipit-source-id: 8a5212d27f21c54112c0820a2a3611e05d606880
2024-03-15 07:14:40 -07:00
zhongwuzw fa8fdc7888 iOS: Change image source url encode ascii to utf8 (#43502)
Summary:
We should use utf8 to cover more characters.

## Changelog:

[IOS] [FIXED] - [Fabric] iOS: Change image source url encode ascii to utf8

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

Test Plan: Fixes https://github.com/facebook/react-native/issues/43462

Reviewed By: rshest

Differential Revision: D54944653

Pulled By: cortinico

fbshipit-source-id: 0bbd3d46c8e5c04ceffe7e0ebae46dc2ce9507df
2024-03-15 06:15:44 -07:00
Moti Zilberman 04de21abb9 Console API tests
Summary:
TSIA

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D54846940

fbshipit-source-id: f322ed9b60f35f0b01b64a74a329572a16b1d485
2024-03-15 06:09:26 -07:00
Wojciech Dróżdż 3cf6c64a80 Add onUserLeaveHint support to ReactActivityDelegate (#43488)
Summary:
This PR adds `onUserLeaveHint` support into the `ReactActivityDelegate`. It allows modules to receive an event every time user moves the app into the background. This is slightly different than `onPause` - it's called only when the user intentionally moves the app into the background, e.g. when receiving a call `onPause` should be called but `onUserLeaveHint` shouldn't.

This feature is especially useful for libraries implementing features like Picture in Picture (PiP), where using `onUserLeaveHint` is the [recommended way of auto-entering PiP](https://developer.android.com/develop/ui/views/picture-in-picture#:~:text=You%20might%20want%20to%20include%20logic%20that%20switches%20an%20activity%20into%20PiP%20mode%20instead%20of%20going%20into%20the%20background.%20For%20example%2C%20Google%20Maps%20switches%20to%20PiP%20mode%20if%20the%20user%20presses%20the%20home%20or%20recents%20button%20while%20the%20app%20is%20navigating.%20You%20can%20catch%20this%20case%20by%20overriding%20onUserLeaveHint()%3A) for android < 12.

This is a re-submission of https://github.com/facebook/react-native/pull/42741. The problematic `assert` has been changed to an `if` - it's not a problem if onUserLeaveHint is received from an activity different to the current one, but in that case we shouldn't emit the event.

## Changelog:

[ANDROID] [ADDED] - Added `onUserLeaveHint` support into `ReactActivityDelegate`

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

Test Plan: Tested in the `rn-tester` app - callbacks are correctly called on both old and new architecture.

Reviewed By: javache

Differential Revision: D54905564

Pulled By: cortinico

fbshipit-source-id: 3f24271405f66bf3a9450320a484e522224eefc1
2024-03-15 05:48:59 -07:00
Nicola Corti 9c7742b7db Bump needs-attention to v2.0.0 (#43493)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43493

This is a bump of one of our external GH custom action
Closes #38046

Changelog:
[Internal] [Changed] - Bump needs-attention to v2.0.0

Reviewed By: GijsWeterings

Differential Revision: D54905530

fbshipit-source-id: 1ecc25926144641bfc080b4ca7b8551a00a0caa1
2024-03-15 05:41:20 -07:00
Moti Zilberman 121b26184a Make JsiIntegrationPortableTest reusable in other test suites
Summary:
Changelog: [Internal]

TSIA - useful for the `console` test suite I'm currently writing (D54846940) which would be awkward to fit into `JsiIntegrationTest.cpp`.

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D54846938

fbshipit-source-id: 9e20bfae7c518b3822da468adf484e51cdc4d0b9
2024-03-15 04:23:57 -07:00
Moti Zilberman 949296571b Console polyfill: preserve unknown methods from originalConsole if found (#43459)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43459

Changelog: [General][Changed] - Console polyfill now copies all properties from the existing `console` object

Fusebox now exposes a full WHATWG `console` object integrated directly with CDP debugging (D54826073). Some WHATWG `console` methods are missing from React Native's polyfill/shim, so let's pass those through unmodified so they can still be called.

(Long term, we shouldn't need most of `console.js`, but let's get there gradually as there are many RN users still depending on `nativeLoggingHook` etc.)

NOTE: We also update the "bundled" copy of `console.js` that lives in the jsinspector-modern C++ test suite.

Reviewed By: huntie

Differential Revision: D54827902

fbshipit-source-id: c6c9128903496810192614f4f8d80b68b02e25c4
2024-03-15 04:23:57 -07:00
Ruslan Shestopalyuk 80bcdc9942 Fix broken RNTester build in OSS (Android) (#43495)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43495

## Changelog:
[Internal] -

Fixes build regression of RNTester on  OSS, coming from D54764898.

NOTE: This is only Android bit for now, looking into the iOS one.

Reviewed By: cortinico

Differential Revision: D54908736

fbshipit-source-id: 70081d1378a56dd0df3f76322377f5a0e6615f80
2024-03-15 03:44:10 -07:00
Moti Zilberman c0e84ece4f Add regression test for Hermes CDP + lazy compilation bug (#43461)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43461

Adds a regression test for the duplicate `scriptParsed` bug in Hermes (T182003727). In the process, we enable Hermes lazy compilation in all our CDPAgent JSI integration tests.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D54852326

fbshipit-source-id: 52e23458d3e9e21902c3659fc944ef85c68731ac
2024-03-15 03:43:28 -07:00
Janic Duplessis a9e6759bb5 Fix maintainVisibleContentPosition on Android during momentum scroll (#43425)
Summary:
When using maintainVisibleContentPosition (mvcp) on Android it doesn't work properly when items are added during a momentum scroll. This happens because the android scrollview momentum scroll animation overrides the scroll position that the mvcp implementation sets [here](https://github.com/facebook/react-native/blob/2d547a3252b328251e49dabfeec85f8d46c85411/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/MaintainVisibleScrollPositionHelper.java#L132).

To fix this we need to cancel the momentum scroll animation, update the scroll position then restart the scroll animation with the previous animation remaining momentum.

## Changelog:

[ANDROID] [FIXED] - Fix maintainVisibleContentPosition during momentum scroll

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

Test Plan:
Tested in RNTester on Android with both vertical and horizontal scrollviews using the following code:

```ts
// packages/rn-tester/js/RNTesterAppShared.js

import {
  Button,
  SafeAreaView,
  ScrollView,
  Text,
  View,
} from 'react-native';
import React, {useLayoutEffect, useRef, useState} from 'react';

const generateUniqueKey = () => `_${Math.random().toString(36).substr(2, 9)}`

const initialData = Array.from(Array(100).keys()).map(n => ({
  id: generateUniqueKey(),
  value: n,
}))

function ListItem({item}) {
  const color = `hsl(${item.value * 10}, 75%, 85%)`;

  return (
    <View
      style={{
        backgroundColor: color,
        height: 100,
      }}>
      <Text>List item: {item.value}</Text>
    </View>
  );
}

export default function FlatListRepro() {
  const numToAdd = 10;
  const [numbers, setNumbers] = useState(initialData);
  const ref = useRef();

  const addAbove = () => {
    setNumbers(prev => {
      const additionalNumbers = Array.from(Array(numToAdd).keys())
        .map(n => ({
          id: generateUniqueKey(),
          value: prev[0].value - n - 1,
        }))
        .reverse();

      return additionalNumbers.concat(prev);
    });
  };

  useLayoutEffect(() => {
    ref.current.scrollTo({y: numbers.length * 100, animated: false});
  // eslint-disable-next-line react-hooks/exhaustive-deps
  }, []);

  return (
    <SafeAreaView style={{flex: 1}}>
      <View style={{flexDirection: 'row', alignItems: 'center'}}>
        <Button title="Add Above" onPress={addAbove} />
      </View>
      <View>
        <ScrollView
          ref={ref}
          maintainVisibleContentPosition={{
            minIndexForVisible: 0,
          }}
        >
          {numbers.map((item) => (
            <ListItem key={item.id} item={item} />
          ))}
        </ScrollView>
      </View>
    </SafeAreaView>
  )
}
```

Before:

https://github.com/facebook/react-native/assets/2677334/a7102665-991e-449e-9d0a-ef06c370dc71

After:

https://github.com/facebook/react-native/assets/2677334/5430ecb1-26a9-4c92-9f16-c762d75685db

Reviewed By: javache

Differential Revision: D54883984

Pulled By: NickGerleman

fbshipit-source-id: 95fd673a87cf5ada3bf9a7c166bba77ce557c89b
2024-03-14 20:00:56 -07:00
Dmitry Rykun 5c34ce0587 Fix RNTester OSS build (#43496)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43496

This diff adds another sub-sub-spec to React-Fabric pod to fix import paths in `textinput`.

Changelog: [Internal]

Reviewed By: philIip, rshest

Differential Revision: D54918454

fbshipit-source-id: 3949f8b8b201157f4c9eb256f3eb5bd5d66bc228
2024-03-14 19:24:35 -07:00
Samuel Susla b3a8eba5a1 merge BatchedEventQueue into EventQueue (#43438)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43438

changelog: [internal]

EventQueue can now be merged with BatchedEventQueue since there isn't anything else subclassing it.

Reviewed By: javache

Differential Revision: D54687859

fbshipit-source-id: f646583db0e46789b667f8d79d24d0cf9d7fc00c
2024-03-14 13:39:14 -07:00
Moti Zilberman 7af288e523 Lazy-init HermesRuntimeTargetDelegate
Summary:
Changelog: [Internal]

We are currently eagerly constructing a `HermesRuntimeTargetDelegate` regardless of whether the Fusebox feature flags are enabled. This can interfere with the legacy CDP backend. Instead, let's lazily construct the target delegate in a code path that only runs when the modern backend is in use.

bypass-github-export-checks

Reviewed By: rozele

Differential Revision: D54907887

fbshipit-source-id: 7dc13506739866ea6690ed21d03d91ad24ef68c5
2024-03-14 12:44:44 -07:00
Pieter De Baets a2d277f740 Flag missing DefaultHardwareBackBtnHandler interface in bridgeless too (#43487)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43487

Inconsistent between bridge and bridgeless, but if you forget to implement this interface, ReactDelegate will silently not do anything in bridgeless.

Changelog: [Android] Enforce Activities using ReactDelegate implement DefaultHardwareBackBtnHandler.

Reviewed By: arushikesarwani94

Differential Revision: D54900747

fbshipit-source-id: 5dd31d4f81e4ec37e1c3ee906be836a8a9c6a944
2024-03-14 12:21:47 -07:00
Arushi Kesarwani f345fcf3e8 Support onKeyLongPress in Bridgeless (#43472)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43472

Implement `onKeyLongPress` in Bridgeless

Changelog:
[Android][Breaking] Implement onKeyLongPress in Bridgeless

Reviewed By: cortinico

Differential Revision: D54876052

fbshipit-source-id: 88d572eab087d913205bdfa02dba96b169066393
2024-03-14 12:10:57 -07:00
Arushi Kesarwani b14f7d58e3 Support onKeyDown in Bridgeless (#43466)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43466

Implement `onKeyDown` in Bridgeless by adding it to ReactHostImpl

Changelog:
[Android][Breaking] Implement `onKeyDown` in Bridgeless

Reviewed By: cortinico

Differential Revision: D54870966

fbshipit-source-id: 0f8e48b29679f1bca92f6ac7b6ebf1592cdc5dac
2024-03-14 12:10:57 -07:00
Dmitry Rykun 9700540bec Bring back the UNSET constant to TextAttributeProps (#43491)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43491

This diff brings back the `UNSET` constant to `TextAttributeProps`.
The removal of this constant was an unnecessary breaking change, that has broken several third-party libraries.

Changelog: [Android][Fixed] - Bring back the UNSET constant to TextAttributeProps.

Reviewed By: fabriziocucci

Differential Revision: D54899524

fbshipit-source-id: 368bde77d43f310fd458537d0191d09174fa5167
2024-03-14 11:10:54 -07:00
Moti Zilberman 305c2811cf Implement native console object in RuntimeTarget (#43456)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43456

Changelog: [Internal]

Implements the [WHATWG `console` spec](https://console.spec.whatwg.org/) directly in `RuntimeTarget`, based on the Hermes-powered `addConsoleMessage` method first used in D54494298.

Benefits:

* This allows the console API to work independently of the polyfill shipped in RN, including very early during JS execution.
* It also opens the door to better stack traces (once we start reporting those) and richer functionality in the `console` object itself.

Reviewed By: robhogan

Differential Revision: D54826073

fbshipit-source-id: d5b0bd004bf35c2fce91742ae84ea86225ec1c61
2024-03-14 10:33:47 -07:00
Pieter De Baets eca4d76d81 Rollout enableBridgelessArchitectureSoftExceptions (#43485)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43485

Already fully rolled out internally.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D54804177

fbshipit-source-id: 128822d408b6943f1f1536eb0101c6684cd45106
2024-03-14 10:31:37 -07:00
Pieter De Baets 7488dc05e8 Use CopyOnWriteArrayList in MemoryPressureRouter (#43486)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43486

We use `CopyOnWriteArrayList` in other places across the React Native codebase, as it assumes that reading happens more frequently than updating. This saves us from needing to synchronize and copy when we access the list of listeners.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D54806272

fbshipit-source-id: d1b54d532edb2af3391a7e4fdc758f705621227d
2024-03-14 10:31:37 -07:00
Pieter De Baets a27e2acef4 Rollout bridgelessArchitectureMemoryPressureHackyBoltsFix (#43478)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43478

This is rolled out internally already. Also exposing `memoryPressureRouter` to match the ReactInstanceManager interface.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D54802021

fbshipit-source-id: b74dcde71296d3925acfc2171d2a77d90960e15e
2024-03-14 10:31:37 -07:00
zhongwuzw 10d48134c9 iOS: Fixes textinput onscroll event payload (#43445)
Summary:
Fixes https://github.com/facebook/react-native/issues/43428 . cc cortinico .

## Changelog:

[IOS] [FIXED] - [Fabric] iOS: Fixes textinput onscroll event payload

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

Test Plan:
```
    const onInputScroll = (e) => {
      if (Platform.OS !== "web") {
        const {
          nativeEvent: {
            contentOffset: { x, y },
          },
        } = e;
        console.log('onInputScroll ====', e?.nativeEvent)
      }
    };

<TextInput
          onScroll={onInputScroll}
          // ref={inputRef}
          multiline
  />
```

Reviewed By: cortinico

Differential Revision: D54813378

Pulled By: sammy-SC

fbshipit-source-id: 76671fbb390c2fbc67a9c29b6c2a834ba699fff4
2024-03-14 08:33:49 -07:00
Moti Zilberman 4148a31912 Integration test for CDPAgent reentrancy bugs
Summary:
Changelog: [Internal]

Adds a regression test for a Hermes CDPAgent bug using `JsiIntegrationTest`. See details in comments.

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D54890188

fbshipit-source-id: 325a32b83b145d2d35f99feaef9988028f15f196
2024-03-14 07:59:31 -07:00
Bartłomiej Błoniarz 0d7a92b551 Add conditional return in handleRemoveView (#43389)
Summary:
I was recently working on an [issue](https://github.com/software-mansion/react-native-reanimated/issues/5715) in Reanimated where z-index of some views was broken after a Layout Animation was used. The issue was that in some cases we were calling the `removeView` function on a already removed view. On plain Android this wouldn't be an issue, since the `removeView` function ignores such calls. Unfortunately, the `ReactViewGroup.java` implementation maintains a counter of views with user defined z-index. This counter is decremented whenever a call to `removeView` is made, even if the view is not a child of this `ViewGroup`. This PR adds an additional check in the `handleRemoveView` function to unify the `removeView` behavior between Android and react-native.

## Changelog:
[ANDROID] [CHANGED] - Changed the `handleRemoveView` function in `ReactViewGroup.java` to ignore calls for `Views` that are not children of this `ViewGroup`

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

Test Plan: I tested if the `rn-tester` app behaves correctly after those changes.

Reviewed By: NickGerleman

Differential Revision: D54874780

Pulled By: javache

fbshipit-source-id: f1a34947419ef6106ee73b196ae99b7f8c2f7a77
2024-03-14 07:27:29 -07:00
Blake Friedman 47a3f52007 Add RFC-0759 deprecation logging cli init
Summary:
Implements the RFC which progressively provides warnings to users of the `npx react-native init` command as we gradually deprecate.

Changelog:
[General][Deprecated] - init cli deprecation logging

Reviewed By: cortinico

Differential Revision: D54423109

fbshipit-source-id: 679b6672bdbfc42a9b82a2aad38fd3253c6ea6a2
2024-03-14 03:37:44 -07:00
Pieter Vanderwerff 082decb76d Deploy 0.231.0 to xplat (#43475)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43475

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D54886285

fbshipit-source-id: cc4f6eeb7986a25d2bb423dac0b7d1d5a74b9703
2024-03-13 22:23:03 -07:00
Joe Vilches 50d587b67f Fix clipping children in scroll views (#43464)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43464

While working on filters I noticed that my blurred image was cropped on the scrollview. Setting `overflow: visible` for `contentContainerStyle` did not change anything. Turns out we do not call `setClipChildren(false)` like we do with [ReactViewGroup](https://www.internalfb.com/code/fbsource/[93517723586c]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java?lines=145).

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D54640466

fbshipit-source-id: 3f71af3170df8f75887d57643b84e64807856ca6
2024-03-13 19:30:54 -07:00
Joe Vilches 5c58811bd5 Add FilterHelper to get all RenderEffects needed to apply filters (#43357)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43357

This diff adds a class to get the needed RenderEffects to support CSS filters on Android. This diff does not add any of the plumbing for it to actually work, that comes in the next diff, but I figured this was complicated and isolated enough to be on its own.

Note that I did not add blur or drop shadow as those are a bit more involved and I plan on adding them later.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D54603892

fbshipit-source-id: 5780d7c846fdb1116e29e0a940ee02da609b01f5
2024-03-13 19:30:54 -07:00
Eric Rozell e032963727 Remove unused forward declaration of RCTMountingManager (#43453)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43453

The forward declaration for RCTMountingManager doesn't appear to be used anywhere. It can be deleted.

## Changelog

[Internal]

Reviewed By: NickGerleman

Differential Revision: D54692764

fbshipit-source-id: ba8206408fdd515387a0a6aff6a3e43c51221e57
2024-03-13 16:13:52 -07:00
Arushi Kesarwani b2e1db0fbf Support onConfigurationChanged in Bridgeless (#43463)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43463

Implement `onConfigurationChanged` in Bridgeless by adding it to ReactHostImpl

Changelog:
[Android][Breaking] Implement onConfigurationChanged in Bridgeless

Reviewed By: cortinico, RSNara

Differential Revision: D54792399

fbshipit-source-id: 6851daca815f486f4d839e128a1d740d3fec1996
2024-03-13 15:08:55 -07:00
kolyaVV 5807ada292 change: replace twitter with x (#43423)
Summary:
When users create a new app, there is an option: Follow us on Twitter with the description. Twitter is X now.
![twitter](https://github.com/facebook/react-native/assets/8622007/7565a692-0e83-4549-a688-08f3ba28c76b)

## Changelog: [Internal]
Replace the Twitter link, title, and description with X.

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

Test Plan: Set the environment for React Native app and then `npx react-native@latest init AwesomeProject`, `npm start`, and `npm run ios`

Reviewed By: cortinico

Differential Revision: D54850199

Pulled By: huntie

fbshipit-source-id: 424cb9212962d78a5b2d93d973f56498ba948136
2024-03-13 12:02:13 -07:00
Blake Friedman f855de7fed Add @react-native/core-cli-utils to build script
Summary:
Changelog: [Internal]

Use our build script for packages and to generate the TypeScript types.

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D54428870

fbshipit-source-id: 2a1666d30ac472300979b2be078a906d390e919a
2024-03-13 11:07:12 -07:00
Blake Friedman 62acc29896 Port: @react-native-community/cli#android → @react-native/core-cli-utils#android (#43289)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43289

Move react-native-community/cli build-android into core per RFC0759.  Provides:

- assemble
- build (assemble + tests)
- install

Changelog:
[General][Added] RFC-0759 Move cli Android build into core

Reviewed By: cortinico, cipolleschi

Differential Revision: D54112210

fbshipit-source-id: 2c9016dd3abd4d382a3d73abd90ba4b0eca7728c
2024-03-13 11:07:12 -07:00