Commit Graph
30512 Commits
Author SHA1 Message Date
David VaccaandFacebook GitHub Bot 91fe3b484b Fully rollout FabricSharedEventPipeline (#42949)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/42949

Reviewed By: javache, sammy-SC

Differential Revision: D53552253

fbshipit-source-id: 67e9db9bd48dd9c37a78e74faf0406fef0c3ad8d
2024-02-09 18:27:03 -08:00
Joe VilchesandFacebook GitHub Bot ee21b85dae Support for (de)serializing node state (#42751)
Summary:
X-link: https://github.com/facebook/yoga/pull/1570

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

tsia. Need node state

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D53206323

fbshipit-source-id: eb48c3873536eb52c8ffcce8005725da274e5373
2024-02-09 16:44:32 -08:00
Joe VilchesandFacebook GitHub Bot e1afa023aa Support for (de)serializing config values (#42750)
Summary:
X-link: https://github.com/facebook/yoga/pull/1571

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

tsia. This is state we need to capture as it can drastically affect the benchmark times

Reviewed By: NickGerleman

Differential Revision: D53203385

fbshipit-source-id: 47178458d039df90fb15d8a420f9e0f17e4fe6ca
2024-02-09 16:44:32 -08:00
Nicola CortiandFacebook GitHub Bot 3c2b2b181c Kotlin to 1.9.22 (#42927)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42927

This bumps Kotlin to 1.9.22 which is the latest in OSS and closer to the version we use inside fbsource.

Turns out that Explicit API mode was not enabled correctly, so I had to go over all the Kotlin classes
and correctly set them to `public` if they were intended to be for public consumption.

I updated some of them to `private` or `internal` but otherwise I've defaulted to `public` which is the default
we have right now.

Changelog:
[Android] [Changed] - Kotlin to 1.9.22

Reviewed By: cipolleschi

Differential Revision: D53576844

fbshipit-source-id: dd8b08ce9bf87f738159f60fd850e3e3bc490ebc
2024-02-09 10:58:29 -08:00
Eric RozellandFacebook GitHub Bot cadaf26cde Fix clang warning for -Winconsistent-missing-destructor-override (#42942)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42942

Instance derives from jsinspector_modern::InstanceTargetDelegate, which defines a virtual destructor, but Instance does not mark its destructor with override.

## Changelog [Internal]

Reviewed By: cipolleschi

Differential Revision: D53609922

fbshipit-source-id: b30df7d59478fa72b53ddc2eeb04c291a6f5f9eb
2024-02-09 06:31:31 -08:00
Riccardo CipolleschiandFacebook GitHub Bot f6f461593b Make [RCTBridge currentBridge] work also inBridgeless for backward compatibility. (#42940)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42940

We might have some libraries that goes through the interop layer that are using [RCTBridge currentBridge]. Although this is an API that we would like them not to use, that's the sad reality and if we don't want to force a migration on those libraries, we need to be backward compatible.

This diff sets the `RCTBridgeProxy` as the `currentBridge` in case the app is running in BridgelessMode. This should make Bridgeless backward compatible.

## Changelog
[iOS][Fixed] - Make [RCTBridge currentBridge] work in bridgeless mode

Reviewed By: RSNara

Differential Revision: D53575361

fbshipit-source-id: 179e440662b577954a577e8400e0ce0dc5b4d3ff
2024-02-09 05:29:10 -08:00
Samuel SuslaandFacebook GitHub Bot 5fbdc994f9 remove animation from borderLayer to stop unwanted animations (#42922)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42922

changelog: [fix][ios] prevent unwanted border animation

The problem: CALayer and its properties are animatable. If RN applies mutations inside an animation block, it will animate. In this particular example, it was animated because of a transition applied by the library and because we were not creating new views, but recycling views from previous screen.

This caused size of _borderLayer to change from value A to value B inside of animation block. To resolve this, call removeAllAnimations on borderLayer.

Reviewed By: cipolleschi

Differential Revision: D53566886

fbshipit-source-id: 98e0b01a9185046e1ee500665c1832060ecc8884
2024-02-09 04:06:52 -08:00
Edmond ChuiandFacebook GitHub Bot 7afc8b8623 disable "Open Debugger" menu item if the bundler is disconnected (#42876)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42876

Changelog:
[Android][Fixed] Disable the "Open Debugger" item from dev menu if the bundler is disconnected

# Existing
In our dev menu, the "Open Debugger" menu item is shown even if the packager isn't connected.

{F1451833462}

# In this PR
The "Open Debugger" menu item is disabled when the packager is disconnected with the message "Connect to the bundler to debug JavaScript"

{F1451834019}

# Reference
* There are existing checks, but they're async. We don't need the check to be accurate; and we don't want to delay the dev menu from opening
    * [isMetroRunning()](https://github.com/facebook/react-native/blob/db066acfe3994787d706ad082ce718a91b8249f5/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java#L1013-L1027)
    * [isPackagerRunning(…)](https://github.com/facebook/react-native/blob/db066acfe3994787d706ad082ce718a91b8249f5/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java#L798-L805)
* Also on iOS: D53354110

Reviewed By: hoxyq

Differential Revision: D53428914

fbshipit-source-id: 3e70d7fec9fc8fc63a8519c5385a91775febce9a
2024-02-09 03:05:36 -08:00
Phillip PanandFacebook GitHub Bot d7dce975f9 introduce native api to access RuntimeExecutor (#42882)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42882

Changelog: [Android][Added] - introduce native api to access RuntimeExecutor

This is the android equivalent of [PR#42758](https://github.com/facebook/react-native/pull/42758).

From [PR#42758](https://github.com/facebook/react-native/pull/42758)

> The goal of this API is to provide a safe way to access the jsi::runtime in bridgeless mode. The decision to limit access to the runtime in bridgeless was a conscious one - the runtime pointer is not thread-safe and its lifecycle must be managed correctly by owners.

> However, interacting with the runtime is an advanced use case we would want to support. Our recommended ways to access the runtime in bridgeless mode is either 1) via the RuntimeExecutor, or 2) via a C++ TurboModule.

This diff introduces the API that would allow for 1). because react context can be non-null before react instance is ready, this can still return null. however, the callsite should be cognizant of when this will happen. in the case of expomodules, the runtime should be ready when the module is init, unless it is a eager initialized module

Reviewed By: RSNara

Differential Revision: D53461821

fbshipit-source-id: 69555d0593a59f8655e4dcd2f0ef1f78f4cfff7d
2024-02-08 18:09:36 -08:00
Bart TyrpienandFacebook GitHub Bot 40bb425f48 Update tsconfig to not run on files inside Pods (#42909)
Summary:
Opening the VisionOS fork crashes `tsserver.js` inside VSCode because of some Pods files. This stops `tsserver` from looking at any files inside Pods

[Link to issue](https://github.com/callstack/react-native-visionos/issues/97)

## Changelog:

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

Pick one each for the category and type tags:

[GENERAL] [ADDED] - Added a folder inside the `exclude` array inside `tsconfig`

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

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

Reviewed By: lunaleaps

Differential Revision: D53518533

Pulled By: cipolleschi

fbshipit-source-id: 8d7819ec3ae8f0b413389157a34f49961434037f
2024-02-08 18:04:16 -08:00
Phillip PanandFacebook GitHub Bot b796cda38b fix crash
Summary: blocks don't capture C++ objects so this will would crash

Reviewed By: sammy-SC, cipolleschi

Differential Revision: D53572123

fbshipit-source-id: 323f29c30d99616080aef6b0a895df4599788395
2024-02-08 12:24:48 -08:00
Oskar KwaśniewskiandFacebook GitHub Bot 2ca7bec0c2 fix: [Codegen] log supported apple platforms if there are any (#42819)
Summary:
This PR adds check if there are any supported platforms to log.

For built-in modules this was logging empty line (as some of them doesn't contain podspecs):

![CleanShot 2024-02-02 at 15 54 42@2x](https://github.com/facebook/react-native/assets/52801365/c7e36052-9c48-4e00-a539-6ee5d528bbee)

## Changelog:

[GENERAL] [FIXED] - Log Codegen supported platforms if any are available

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

Test Plan: Run Codegen and check if it prints empty `Supported Apple platforms`

Reviewed By: cortinico

Differential Revision: D53566301

Pulled By: cipolleschi

fbshipit-source-id: 3f6b6d3b44da1ab7174432a5fac7f7d3fde11103
2024-02-08 09:52:55 -08:00
Riccardo CipolleschiandFacebook GitHub Bot 527d1931b1 Install CMake on Windows replying yes to the prompt (#42926)
Summary:
CircleCI is failing because chocolatey started asking for user input in CI. This change should allow CI to proceed.

## Changelog:
[Internal] - Fix CI on Windows

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

Test Plan: CircleCI is green

Reviewed By: cortinico

Differential Revision: D53576331

Pulled By: cipolleschi

fbshipit-source-id: 990a195618140263001ffce3e5c17240cc679aa7
2024-02-08 09:21:38 -08:00
Nicola CortiandFacebook GitHub Bot eb619468c1 Fix linking of local app modules turbomodules (#42921)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42921

I realized that we were missing a bit to properly link app modules on Android.
The `_ModuleProvider` was never linked correctly so the TM won't be loaded at all.

With this change I'm getting the App Target (say `AppModule`) and passing it down to the
default-app-setup with a couple of macros.

This makes sure that if there is a codegen local module, we import the correct header and query the `AppModule_ModuleProvider` correctly.

Changelog:
[Android] [Fixed] - Fix linking of local app modules turbomodules

Reviewed By: cipolleschi

Differential Revision: D53567201

fbshipit-source-id: d14e61b7f2d86f15363600cd9dd1ed1ca27bd1fc
2024-02-08 08:15:28 -08:00
Oskar KwaśniewskiandFacebook GitHub Bot 12e4a5745d feat: add nullable annotations to RCTBundleURLProvider (#42293)
Summary:
This PR adds nullable annotations to `RCTBundleURLProvider` also allowing to return optional (the default that will be returned when metro is not running). Not having this may lead to crashes because Swift will try to unwrap optional with nil when metro is not running.

## Changelog:
[iOS] [Added] - add nullable annotations to RCTBundleURLProvider

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

Test Plan: CI Green

Reviewed By: sammy-SC

Differential Revision: D52797676

Pulled By: cipolleschi

fbshipit-source-id: 98b4f99aa71828f5397276d22f35d24e48657dc8
2024-02-08 07:56:05 -08:00
Nicola CortiandFacebook GitHub Bot 50bd9e367b Bump Gradle to 8.6
Summary:
Let's keep things up to date.

Changelog:
[Internal] [Changed] - Bump Gradle to 8.6

Reviewed By: cipolleschi

Differential Revision: D53566538

fbshipit-source-id: abbb2a53c944cb5eb4232a70b8af7e34b37fb6a2
2024-02-08 06:24:40 -08:00
Samuel SuslaandFacebook GitHub Bot f6b984d504 Back out "Make font styling work when using specific font name on the new architecture" (#42919)
Summary:
Changelog:
[IOS] [FIXED] - backout https://github.com/facebook/react-native/pull/37109

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

Original commit changeset: 1f0a6a52a714

Original Phabricator Diff: D45351185

Reviewed By: cipolleschi

Differential Revision: D53566506

fbshipit-source-id: e96813edfee4b54a7828ac02c3dc8aaffc83d6b7
2024-02-08 05:14:34 -08:00
Oskar KwaśniewskiandFacebook GitHub Bot 3dfedbc1ae (iOS) Add RCTUIStatusBarManager and properly retrieve StatusBar style and height (#42241)
Summary:
This PR migrates from the deprecated way of retrieving the status bar info. It introduces a helper method `RCTUIStatusBarManager` which gets the `UIStatusBarManager` from the KeyWindow.

It also removes the unused `getHeight` method.

## Changelog:

[IOS] [ADDED] - Add `RCTUIStatusBarManager` and properly retrieve StatusBar style and height
[IOS] [REMOVED] - Remove unused getHeight method from StatusBar

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

Test Plan: CI Green, Ensure that preferredStatusBarStyle and preferredStatusBarHidden is properly retrieved for Modals

Reviewed By: philIip

Differential Revision: D52729974

Pulled By: cipolleschi

fbshipit-source-id: 40adef810c1d419900fb7ba706af6fb095941e10
2024-02-08 02:39:35 -08:00
Riccardo CipolleschiandFacebook GitHub Bot c7a0dff760 Make Modal's onDismiss work on Fabric. (#42601)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42601

After S390064, the OnDismiss event for Modal from D52445670 was reverted.
The diff was too big and caused the SEV, so we are trying to reimplement it gradually to make sure we don't brake anything.

The most important thing for our short term goal is to make the `OnDismiss` work only for iOS (following the official docs, Android never supported it) for Fabric (Bridge and Bridgeless).

We also want to minimize the changes t the JS infrastructure, so we are trying not to alter the JS APIs.

## The Problem:
The reason why the onDismiss event does not work is because, as soon as the `visible` property is turned to `false`, the component is removed by the React tree.
When this happens, Fabric deallocate the ShadowNode and the EventEmitter. Therefore, the event is not fired.

## The Solution:
We made this work by "delaying" when the component need to be removed from the reacat Tree.

Rather then rendering or node or not based on the `visible` props, we are introducing a `State` object that keeps track when the Modal is rendered or not.

The `state.isRendering` property is set to `true` when the `visible` prop is set to `true`.
For iOS, when `visible` prop is set to `false`, instead, we wait for the Native side to actually dismiss the View and to invoke the event. When the event is fired, we manually set the `state.isRendering` property to false and the Modal can be considered dismissed.

Notice that this makes also useless to have the Modal Native's snapshot to simulate that the modal is still presented.

## Changelog:
[iOS][Fixed] - `onDismiss` now work on iOS with Fabric, in both Bridge and Bridgeless mode.

Reviewed By: sammy-SC

Differential Revision: D52959996

fbshipit-source-id: 365ca1d0234e3742df9db87007523d1a4a86079f
2024-02-08 02:22:36 -08:00
David VaccaandFacebook GitHub Bot fe7b9e5199 Mark classes of package utils as @Nullsafe (#42859)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42859

All these classes are NullSafe, let's mark them as NullSafe(Local) to ensure lint detect errors in the future

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D53393475

fbshipit-source-id: 442439c03e251d018f289ba4bb45dde9e6a0ab7f
2024-02-07 21:06:14 -08:00
David VaccaandFacebook GitHub Bot e2fa62d6ad Mark nullability of RNLog class (#42865)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42865

Mark nullability of RNLog class

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D53393953

fbshipit-source-id: 122e7be226170af36793664a646585b16ec2d305
2024-02-07 21:06:14 -08:00
Janic DuplessisandFacebook GitHub Bot 4dcc1d3efb Fix onStartReached not called when list content is small (#42902)
Summary:
Currently if the virtualized list content is small `onStartReached` won't be called initially when the list is mounted. This is because when the content is small `onEndReached` will be called initially preventing `onStartReached` from being called. In `_maybeCallOnEdgeReached` calling `onEndReached` and `onStartReached` are in the same conditional so they cannot both be triggered at once. To improve the consistency of `onStartReached` we should call both `onEndReached` and `onStartReached` if needed.

## Changelog:

[GENERAL] [FIXED] - Call onStartReached initially when list is small and `onEndReached` is called

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

Test Plan:
I used this code to test in RN Tester (replace content of RNTesterAppShared.js)

```ts
import React, { useState, useEffect } from "react";
import { StyleSheet, FlatList, View, Text, TouchableOpacity } from "react-native";

function App() {
  const [data, setData] = useState(generatePosts(4));
  const [idCount, setIdCount] = useState(1);

  const renderItem = ({ item }) => <Item data={item} />;
  const keyExtractor = (item) => item.id.toString();

  console.log("-------")
  return (
    <View style={{ flex: 1, marginVertical: 20 }}>
      <FlatList
        key={idCount}
        data={data}
        renderItem={renderItem}
        keyExtractor={keyExtractor}
        onEndReachedThreshold={0.05}
        onEndReached={() => console.log("onEndReached")}
        onStartReachedThreshold={0.05}
        onStartReached={() => console.log("onStartReached")}
        inverted
      />
      <TouchableOpacity  style={{height: 50, width: '100%', backgroundColor: 'purple'}} onPress={()=>{
          setIdCount(state => state + 1)
          setData(generatePosts(2))
      }}><Text> Press</Text></TouchableOpacity>
    </View>
  );
}

function Item({ data }) {
  return (
    <View style={styles.item}>
      <Text style={styles.title}>
        {data.id} - {data.title}
      </Text>
    </View>
  );
}

const styles = StyleSheet.create({
  item: {
    backgroundColor: "#f9c2ff",
    padding: 20,
    marginVertical: 8,
    marginHorizontal: 16,
  },
  title: {
    fontSize: 24,
  },
});

const generatePosts = (count, start = 0) => {
  return Array.from({ length: count }, (_, i) => ({
    title: `Title ${start + i + 1}`,
    vote: 10,
    id: start + i,
  }));
};

export default App;
```

Before the change only onEndReached is called, after the change both onStartReached and onEndReached is called.

Reviewed By: sammy-SC

Differential Revision: D53518434

Pulled By: cipolleschi

fbshipit-source-id: bc34e0d4758df6d5833be7290e5a66efaf252ffd
2024-02-07 20:44:34 -08:00
Alex Taylor (alta)andFacebook GitHub Bot e37da1e71a Update hermes-parser and related packages in fbsource to 0.19.1 (#42901)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42901

Bump hermes-parser and related packages to [0.19.1](https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: gkz

Differential Revision: D53485553

fbshipit-source-id: 9ecc0cd30606462bcbd29a7a75daccda8d442dd6
2024-02-07 12:47:15 -08:00
Rubén NorteandFacebook GitHub Bot 5e03813d18 Migrate enableBackgroundExecutor feature flag to new system (#42910)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42910

TSIA

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D53516252

fbshipit-source-id: 6371317737d0125d2418ff226bb73017cb213767
2024-02-07 12:27:15 -08:00
Rubén NorteandFacebook GitHub Bot d1e7caa1d4 Mark override and dangerouslyReset in ReactNativeFeatureFlags as JVM static (#42908)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42908

Changelog: [internal]

Just a small ergonomic improvement to do `ReactNativeFeatureFlags.override` instead of `ReactNativeFeatureFlags.INSTANCE.override` in Java.

We already did this for the methods to access the feature flags in the same class.

Reviewed By: rshest

Differential Revision: D53516254

fbshipit-source-id: cdaa90b3baae4f780a42a96ebb07de78bd968019
2024-02-07 12:27:15 -08:00
Nicola CortiandFacebook GitHub Bot 85257a993f Fix Reload behavior being different on Bridgeless (#42917)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42917

If the app is not connected to Metro, the behavior of the refresh is different between bridgeless and bridge. This is because the `handleReloadJS` is implemented differently between the two support managers. I'm fixing it.

Changelog:
[Android] [Fixed] - Fix Reload behavior being different on Bridgeless

Reviewed By: cipolleschi

Differential Revision: D53526369

fbshipit-source-id: 63509b5595c3738a1d6d9eb4352036c174643770
2024-02-07 11:34:10 -08:00
Alex HuntandFacebook GitHub Bot f0d1d9214d Relocate RNTester E2E wrapper script under package (#42906)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42906

Makes way to relocate repo E2E testing + Verdaccio logic under `scripts/e2e/`. The contents of this script are minimal and are better located with `rn-tester-e2e`.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53516117

fbshipit-source-id: e7e50af0383788f2219da190bf921ea93a6455eb
2024-02-07 08:31:29 -08:00
Riccardo CipolleschiandFacebook GitHub Bot dc38988bcc Fix warning when loading RCTUIManager and A11yManager (#42733)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42733

When we fixed the race condition between A11yManager and RCTUIManager, we did it by moving the A11yManager on a background queue.
In the old architecture, this was raising a warning which our users might find confusing. Plus, that change was not aligned with what the A11yManager declared in its configuration because we are actually initializing it starting from a BG queue.

{F1405693310}

With this change we anticipate the initialization of the module in a place where:
1. We know we are in the main queue
2. We know we are going to need it (so it is not violating the lazy load principle)
3. We know it is safe.

This should allow us to also remove the feature flag of `RCTUIManagerDispatchAccessibilityManagerInitOntoMain` because now it is safe to use the main_queue as requested by the module.

## Changelog:
[iOS][Fixed] - Initialize the A11yManager in the main queue and when we need it.

Reviewed By: philIip

Differential Revision: D53225120

fbshipit-source-id: fa6ef7fac380e17684cc02de0b4a46504b26bb3d
2024-02-07 08:26:18 -08:00
Edmond ChuiandFacebook GitHub Bot 635732aa8f Fix order of Metro hotkey console messages (#42896)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42896

Changelog:
[General][Fixed] Fix order of Metro hotkey console messages

# Existing

Key handler is printing messages to the console _after_ it has been processed, this causes error messages to appear before the `info` message.

# In this PR

The `info` messages are logged before the event is processed.

Reviewed By: GijsWeterings

Differential Revision: D53479732

fbshipit-source-id: 25af47450662de4eb03d0dfd52af5af014ef3e49
2024-02-07 07:44:24 -08:00
Oskar KwaśniewskiandFacebook GitHub Bot c1b8f37580 fix: UpdatePropertiesExampleView mutate existing appProperties instead of overwriting (#42634)
Summary:
For Bridgeless mode we set `fabric` and `concurrentRoot` property for newly initialized views. This example overwrites those properties. I think we should Instead copy previous dictionary and only overwrite `color` key.

This issue results in a warning: "Using Fabric without concurrent root is deprecated. Please enable concurrent root for this application."

Note: This Example crashes on Bridgeless but my other PR https://github.com/facebook/react-native/issues/42263 fixes it.

## Changelog:

[INTERNAL] [FIXED] - UpdatePropertiesExampleView to mutate existing `appProperties` instead of overwriting

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

Test Plan:
1. Wait for this example to get fixed for Bridgeless
2. Click the button to update props
3. Check if there is no warning

Reviewed By: cortinico

Differential Revision: D53126953

Pulled By: cipolleschi

fbshipit-source-id: fa0e8bda50a47696467d279845616c2ba51fe310
2024-02-07 07:31:32 -08:00
Jakub PiaseckiandFacebook GitHub Bot 61774088d7 Make font styling work when using specific font name on the new architecture (#37109)
Summary:
Currently, when `fontFamily` style is set to a specific font instead of a font family, [that specific font is used](https://github.com/facebook/react-native/blob/2058da8f2012578c3e82f1af19c3248346655f9a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTFontUtils.mm#L126) to display the text on iOS when using the new architecture. This is different behavior to the old architecture, where the font family and [font properties were extracted from the specified](https://github.com/facebook/react-native/blob/2058da8f2012578c3e82f1af19c3248346655f9a/packages/react-native/React/Views/RCTFont.mm#L450-L457) font and overridden if not provided by the user.

## Changelog:

[IOS] [FIXED] - Make font resolution work when using specific font name on the new architecture

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

Test Plan:
You can verify the problem on a simple snippet:
```jsx
import React from 'react';
import {SafeAreaView, Text} from 'react-native';

function App() {
  return (
    <SafeAreaView style={{flex: 1}}>
      <Text
        style={{
          fontFamily: 'Helvetica Light Oblique',
          fontWeight: 'bold',
          fontStyle: 'normal',
        }}>
        Some random text
      </Text>
    </SafeAreaView>
  );
}

export default App;
```

<details>
<summary>
Here's before & after
</summary>

Without changes from this PR:
<img src="https://user-images.githubusercontent.com/21055725/234618852-07cbe67c-f534-4b04-b760-828f4edef549.png" width=400 />

With changes from this PR:
<img src="https://user-images.githubusercontent.com/21055725/234618902-9e44a389-8f27-4ab0-95dc-e34ca781d2ed.png" width=400 />

</details>

Reviewed By: NickGerleman

Differential Revision: D45351185

Pulled By: sammy-SC

fbshipit-source-id: 1f0a6a52a714ca4989775817d1fb53ae593143f8
2024-02-07 07:25:30 -08:00
Tommy NguyenandFacebook GitHub Bot 8f4f09bf70 fix(dev-middleware): fix react-native config failing in pnpm setups (#42907)
Summary:
In a pnpm setup, `react-native config` fails to read `react-native/react-native.config.js` because `ws` was not installed:

```
% node --print 'require("react-native/react-native.config.js")'
node:internal/modules/cjs/loader:1137
  throw err;
  ^

Error: Cannot find module 'ws'
```

## Changelog:

[GENERAL] [FIXED] - fix `react-native config` failing in pnpm setups

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

Test Plan: n/a

Reviewed By: cipolleschi

Differential Revision: D53516703

Pulled By: robhogan

fbshipit-source-id: 3aded393187df4ca9a7abb64a2c8e0f2c9a5fcd9
2024-02-07 07:17:12 -08:00
Fabrizio CucciandFacebook GitHub Bot bd6a199f21 Convert InputAccessoryView to ESM (#42887)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42887

As per title.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53355779

fbshipit-source-id: 2e4aa8e0dec83c7e2700eb8df76efa122c4adea8
2024-02-07 05:57:57 -08:00
Alex HuntandFacebook GitHub Bot 009542f4ee Move release testing scripts into subdirectory (#42900)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42900

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D53471278

fbshipit-source-id: 56b16c20b85c88577e5d899b0e85d078ab8aa51f
2024-02-07 05:40:26 -08:00
Nicola CortiandFacebook GitHub Bot 30d186c368 Set concurrentRoot to true whenever Fabric is used in renderApplication (#42821)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42821

As the title says, we want `concurrentRoot iif fabric`.
This makes sure we invoke renderApplication correctly.

Changelog:
[Internal] [Changed] - Set concurrentRoot to true whenever Fabric is used in renderApplication

Reviewed By: sammy-SC

Differential Revision: D53353017

fbshipit-source-id: 8de88adf528eb71f233233bd85c2c6ef9430fb16
2024-02-07 05:29:52 -08:00
Ruslan ShestopalyukandFacebook GitHub Bot 665c400460 Allow to chain custom transformers when resolving asset sources (#42892)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42892

## Changelog:
[Internal]-

This adds an ability to have multiple custom source transformers when resolving asset sources, which is beneficial in some scenarios.

The transformers are chained, being executed in order they are registered, until one of them returns a non-null value.

If none does, then the default one is returned.

Reviewed By: GijsWeterings

Differential Revision: D53472320

fbshipit-source-id: ed9baf8789b8bd41c8ce78eed71ebb65868cf178
2024-02-07 04:00:51 -08:00
Jack PopeandFacebook GitHub Bot 8da1da2e73 Add findAll base query method (#42829)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42829

This is the base query method that we can wrap to use specific matchers like `findByTestID` or `findByRole`

Changelog: [internal]

Reviewed By: noahlemen

Differential Revision: D53359005

fbshipit-source-id: d1ac9c503b05d479567b6ced71d4517d5bc55b0b
2024-02-06 13:32:28 -08:00
Edmond ChuiandFacebook GitHub Bot bc3fe0d76d disable "Open Debugger" item when packager is disconnected (#42873)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42873

Changelog:
[iOS][Fixed] Disable the "Open Debugger" item from dev menu if packager is disconnected

# Existing
In our dev menu, the "Open Debugger" menu item is shown even if the packager isn't connected.

{F1434746954}

# In this PR
The "Open Debugger" menu item is disabled when the packager is disconnected.

{F1451344668}

# Reference
* Also on Android: D53428914

Reviewed By: robhogan

Differential Revision: D53354110

fbshipit-source-id: 6eb4e826fe9317798c704a5441b5e462edab1c4b
2024-02-06 06:40:17 -08:00
Alex HuntandFacebook GitHub Bot 9ba56f6f5d Remove matching of Modern/Legacy page types (#42885)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42885

## Context

We're introducing the concept of **capability flags** to provide granular control of behaviours in the Inspector Proxy, to replace the recently added `type: 'Legacy' | 'Modern'` target switch.

A capability flag disables a specific feature/hack in the Inspector Proxy layer by indicating that the target supports one or more modern CDP features.

## This diff

Following D53355413, we're now able to remove the previous `type: 'Legacy' | 'Modern'` page concept, implemented in this diff.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D53358480

fbshipit-source-id: 62e53a1bd60760291ada3479121dfca9e1f6edbc
2024-02-06 04:09:53 -08:00
Alex HuntandFacebook GitHub Bot d75fc992a2 Replace "type" with "capabilities" in /json response (#42884)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42884

## Context

We're introducing the concept of **capability flags** to provide granular control of behaviours in the Inspector Proxy, to replace the recently added `type: 'Legacy' | 'Modern'` target switch.

A capability flag disables a specific feature/hack in the Inspector Proxy layer by indicating that the target supports one or more modern CDP features.

## This diff

This updates the pages response in `jsinspector-modern` to send a capability flags configuration, replacing `InspectorPageType`/`"type"`.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D53355413

fbshipit-source-id: 710f9eb11fcc61ab06bfc3051517dd4dd204c68a
2024-02-06 04:09:53 -08:00
Alex HuntandFacebook GitHub Bot 74ea826464 Add nativeSourceCodeFetching capability flag (#42818)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42818

## Context

We're introducing the concept of **capability flags** to provide granular control of behaviours in the Inspector Proxy, to replace the recently added `type: 'Legacy' | 'Modern'` target switch.

A capability flag disables a specific feature/hack in the Inspector Proxy layer by indicating that the target supports one or more modern CDP features.

## This diff

Implements a second granular flag, `nativeSourceCodeFetching`, and adds tests for this.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D53352242

fbshipit-source-id: 94b62d84c731c903c5f99f8206d5c91bc501d030
2024-02-06 04:09:53 -08:00
Alex HuntandFacebook GitHub Bot 96db0fd1b6 Add support for target capability flags (#42817)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42817

## Context

We're introducing the concept of **capability flags** to provide granular control of behaviours in the Inspector Proxy, to replace the recently added `type: 'Legacy' | 'Modern'` target switch.

A capability flag disables a specific feature/hack in the Inspector Proxy layer by indicating that the target supports one or more modern CDP features.

## This diff

- Implements capability flags in `InspectorProxy`, via an optional `"capabilities"` key returned by a device's CDP server.
- Wires up an initial flag, `nativePageReloads`, to disable the legacy "React Native Experimental (Improved Chrome Reloads)" page and emulated page reload behaviour.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D53352244

fbshipit-source-id: 622fc6028174919b9bf776e3ac52724d97ca2734
2024-02-06 04:09:53 -08:00
Alex HuntandFacebook GitHub Bot 1429378bc0 Improve CDP Flow types (#42816)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42816

Some refactoring to formalise CDP protocol types (`protocol.js` is aligned with [Chrome's `protocol.d.ts` source](https://github.com/ChromeDevTools/devtools-protocol/blob/master/types/protocol.d.ts)), and to demarcate these from other types in the Inspector Proxy prototol.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D53352243

fbshipit-source-id: b2e413bdbd6164fd1b8adba6b5853ac107725b34
2024-02-06 04:09:53 -08:00
Phillip PanandFacebook GitHub Bot 343a0d3cd8 introduce native api to access RuntimeExecutor (#42758)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42758

Changelog: [iOS][Added] - introduce native api to access RuntimeExecutor

The goal of this API is to provide a safe way to access the `jsi::runtime` in bridgeless mode. The decision to limit access to the runtime in bridgeless was a conscious one - the runtime pointer is not thread-safe and its lifecycle must be managed correctly by owners.

However, interacting with the runtime is an advanced use case we would want to support. Our recommended ways to access the runtime in bridgeless mode is either 1) via the RuntimeExecutor, or 2) via a C++ TurboModule.

This diff introduces the API that would allow for 1). The integration consists of these parts:
- wrapper object for RuntimeExecutor access, `RCTRuntimeExecutor`. The NSObject wrapper is necessary so we can make it the property of a swift module
- new protocol API,`RCTRuntimeExecutionModule`, for modules to access the RuntimeExecutor block
- integration within the bridgeless infrastructure

Reviewed By: javache

Differential Revision: D53256188

fbshipit-source-id: 8fadbe8f760cdb8928bbf3f7e4829e27b7617b9d
2024-02-06 03:56:48 -08:00
Fabrizio CucciandFacebook GitHub Bot db066acfe3 Convert InputAccessoryView to function component (#42883)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42883

As per title.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D53355697

fbshipit-source-id: cb145c31764ae8b57489b1a1183918924e6cb49b
2024-02-06 03:09:54 -08:00
George ZaharievandFacebook GitHub Bot 608029aed2 Convert unannotated variable declaration with cast init to annotated variable declaration in xplat/js (#42880)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42880

Convert `const x = (a: T)` into `const x: T = a`. These are equivalent in Flow, and helps reduce the amount of colon-casts.

```
js1 flow-runner codemod flow/castToAnnotatedVariable --target colon xplat/js
```

Changelog: [Internal]

drop-conflicts

Reviewed By: SamChou19815

Differential Revision: D53392999

fbshipit-source-id: 3b4602618d6990e8642b423edaeb4e89b01a199a
2024-02-05 23:07:17 -08:00
Alex Taylor (alta)andFacebook GitHub Bot 1ad3bbc437 Deploy 0.228.0 to xplat (#42802)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42802

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D53337590

fbshipit-source-id: 31e40d692495fc795d3d69b20ba12fcb420b28e7
2024-02-05 19:12:57 -08:00
David VaccaandFacebook GitHub Bot 14de9aabd8 Mark classes of package uimanager as @Nullsafe (#42860)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42860

All these classes are NullSafe, let's mark them as NullSafe(Local) to ensure lint detect errors in the future

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D53393473

fbshipit-source-id: 93e6be94cee4f852c85464ce151670b1c8f1f913
2024-02-05 18:05:24 -08:00
David VaccaandFacebook GitHub Bot cb816c1cf0 Fix lint warn (#42866)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42866

Fix nullability lint warn

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D53395978

fbshipit-source-id: 01c34bf8051d8beb3eaa831f981f67daf580c0ad
2024-02-05 18:05:24 -08:00
David VaccaandFacebook GitHub Bot 942013dffa Mark classes of package uimanager/layoutanimation as @Nullsafe (#42857)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42857

All these classes are NullSafe, let's mark them as NullSafe(Local) to ensure lint detect errors in the future

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D53393472

fbshipit-source-id: 717507391623d67d03d83bf344475a4a830504a7
2024-02-05 18:05:24 -08:00