Commit Graph

31468 Commits

Author SHA1 Message Date
Riccardo Cipolleschi 794aaa52d3 Fix enable hermes debugger in Bridgeless mode
Summary:
Set the proper build flags for debugging in Bridgeless mode.

This fixes [#44240](https://github.com/facebook/react-native/issues/44240)

## Changelog:
[iOS][Fixed] - Add `HERMES_ENABLE_DEBUGGER=1` flag to React-RuntimeApple

Reviewed By: cortinico

Differential Revision: D56575647

fbshipit-source-id: a0613a5d46caeb1d3e636e54ecd43428fbaf46e8
2024-04-25 08:28:26 -07:00
Kudo Chien 4e6186555e Defines module for React-jsinspector (#44252)
Summary:
Defines module for `React-jsinspector` that for swift modules to integrate with.

to fix https://github.com/expo/expo/issues/28209, any podspec depends on HermesExecutorFactory should use ` add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')` to add dependency. otherwise it will encounter the header not found issue because use_frameworks will change "jsinspector-modern" to "jsinspector_modern".

to depend on React-jsinspector from expo-modules-core, we need it to define as a module.
otherwise, it will have the error
```
The Swift pod `ExpoModulesCore` depends upon `React-jsinspector`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
```

## Changelog:

[IOS] [CHANGED] - Add `DEFINES_MODULE` for React-jsinspector.podspec

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

Test Plan: ci passed

Reviewed By: cortinico

Differential Revision: D56575102

Pulled By: cipolleschi

fbshipit-source-id: 9b7b4568a3e499f0a741a79a846263118ff2d112
2024-04-25 08:18:20 -07:00
Nick Gerleman 3db7ab6683 Run Android Build and Tests Against 8-core-ubuntu (#44248)
Summary:
The final merged GitHub Actions PR ended up keeping us on `ubuntu-latest` for Android jobs. These are ridiculously slow and are also now running out of disk space (which then files a task on a random change author). E.g. https://github.com/facebook/react-native/actions/runs/8826104037/job/24231379139

Switch to the `8-core-ubuntu`, which is closer to what we were using for CircleCI, and has more disk space: https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/about-larger-runners#specifications-for-general-larger-runners

Changelog:
[Internal]

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

Test Plan: GitHub Actions still runs these successfully

Reviewed By: cortinico

Differential Revision: D56558697

Pulled By: NickGerleman

fbshipit-source-id: 180abcf2d3420760c090c0c21173afc6fa5bcf0c
2024-04-25 06:40:59 -07:00
Samuel Susla b40b3b31a2 delete feature flag enableCustomDrawOrderFabric (#44231)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44231

changelog: [internal]

The flag is not used and is statically set to false, let's delete it.

Reviewed By: NickGerleman

Differential Revision: D56473851

fbshipit-source-id: fe1076d20a765ffed2437f080764f2b5fe060bb6
2024-04-25 04:43:00 -07:00
Samuel Susla 0dbe6f10c1 clean up interfaces for view preallocation (#44232)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44232

changelog: [internal]

surfaceId parameter is not needed `schedulerDidRequestPreliminaryViewAllocation` as it can be derived from shadow node.
Additionally, conversion to ShadowView can happen on the lower layers.

Reviewed By: NickGerleman

Differential Revision: D56350599

fbshipit-source-id: 9c38cc0df36911bbd6927fe0a0d5e64c248d87c4
2024-04-25 04:39:08 -07:00
Riccardo Cipolleschi 42ceacd281 Fallback to the first foregroundInactive window when there are no foregroundActive windows in RCTKeyWindow (#44167)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44167

We received an issue for OSS where, when the main window is inactive and the system tries to present a dialog, the dialog is not presented in the right position on the screen.

This change introduce a fallback to the first inactive window (which is still visible on screen) and it fixes the issues.

## Changelog:
[iOS][Changed] - Fallback to the first `foregroundInactive` window when there are no `foregroundActive` windows in RCTKeyWindow

Reviewed By: dmytrorykun

Differential Revision: D56354741

fbshipit-source-id: fa23131ecd40f6d91c705879a72890506ee21486
2024-04-25 03:28:22 -07:00
szymonrybczak c402dcfe57 chore(dev-middleware): add localhost as default host in start command config (#44244)
Summary:
Inside [Re.Pack](https://github.com/callstack/repack) we consume command's options, to reduce the amount of assumptions that 3rd party tools need to make - we can move assigning default value to config command level, so default values will be aligned across tools.

For default `start` command this change doesn't change any behaviour.

## Changelog:

[INTERNAL] [CHANGED] - Add `localhost` as default host in `start` command config

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

Test Plan: `start` command should work the same way as before.

Reviewed By: huntie

Differential Revision: D56567793

Pulled By: blakef

fbshipit-source-id: fe8f3686ae39a3d2996de11930a0d03364692adc
2024-04-25 03:01:51 -07:00
Nizam 78ab5f4b83 img events fixes for ios and android (#43945)
Summary:
fixes Image events in new architecture
https://github.com/facebook/react-native/issues/43874

## Changelog:

[iOS] [Fixed] - Missing `source` in `onLoad` native event arguments
[iOS] [Fixed] - Missing `error`, `responseCode`, and `httpResponseHeaders` in `onError` native event arguments
[iOS] [Fixed] - Missing `loaded` and `total`  in `onProgress` native event arguments
[Android] [Fixed] - Missing `progress`  in `onProgress` native event arguments

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

Test Plan:
test using Image section of rn-tester app

before
![image](https://github.com/facebook/react-native/assets/1734518/8f7d714b-2ddf-4db0-a539-7be52e3fd948)
after
![image](https://github.com/facebook/react-native/assets/1734518/50f14906-1b65-447f-ae84-634989c1bfc7)

Reviewed By: rozele

Differential Revision: D55945341

Pulled By: NickGerleman

fbshipit-source-id: da4e0e68a78ec8566d94e6df63e17f0436972a4f
2024-04-24 16:25:37 -07:00
Nick Gerleman 15f27bc299 Handle fontWeight normalization for TextInput component
Summary:
Web props work (somewhere around  D41230978 and D39268920) made it so that numeric font weights can be set instead of just strings. This is implemented by converting number to string before passing to native component within the `Text` component.

We have crash with:
```
2024-04-19 09:38:21.360 16963 17190 E ViewManager: Error while updating prop fontWeight
2024-04-19 09:38:21.360 16963 17190 E ViewManager: java.lang.IllegalArgumentException: method com.facebook.react.views.text.ReactBaseTextShadowNode.setFontWeight argument 1 has type java.lang.String, got java.lang.Double
2024-04-19 09:38:21.360 16963 17190 E ViewManager: 	at java.lang.reflect.Method.invoke(Native Method)
```

`TextStyleProps` can also be passed to `TextInput`, which passes to underlying native component, without going through this logic. And the types for Native props directly derive from JS props, so type system does not catch passing incorrect number type to underlying native component.

This does a quick and dirty replication of the exact logic in `Text.js` to `TextInput.js`. I'd love to potentially fix this up for Fabric in a different way when we rethink CSS parsing.

Changelog:
[General][Fixed] - Handle `fontWeight` normalization for TextInput component

Reviewed By: arushikesarwani94

Differential Revision: D56539571

fbshipit-source-id: 8975886c117d814a624f817bffe408841bb03b88
2024-04-24 16:02:46 -07:00
Samuel Susla cf926a1329 decouple commit from mount on Android (#44236)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44236

## Changelog:

[Android] [Fixed] - fix a case when view preallocation or props forwarding on Android lead to dropped props update

# What does this fix

This fixes a bug where prop change is not delivered to Android mounting layer if the prop change was initiated from state update inside of `useLayoutEffect`, `componentDidMount` or `componentDidUpdate`.
This affects android only and when batched rendering is enabled.

There are two root causes of this problem:
1. View preallocation on Android: https://fburl.com/code/r62p3vot
2. Prop forwarding on Android: https://fburl.com/code/644f1ppk

Minimal repro :
```
import React, {useLayoutEffect, useState} from 'react';
import {Button, SafeAreaView, View} from 'react-native';
function Foo() {
  const [bgColor, setBgColor] = React.useState('red');
  useLayoutEffect(() => {
    console.log('useLayoutEffect');
    setBgColor('blue');
  }, []);
  return (
    <View
      style={{
        backgroundColor: bgColor,
        width: '100%',
        height: '100%',
      }}
    />
  );
}
function RNTesterApp() {
  const [show, setShow] = useState(false);
  return (
    <SafeAreaView>
      <Button title="Toggle" onPress={() => setShow(!show)} />
      {show && <Foo />}
    </SafeAreaView>
  );
}
export default RNTesterApp;
```

# The underlaying problem
The problem is combination of view preallocation and batched rendering updates.

Here is a step by step what happens in the repro above:
1. React issues asks Fabric to create new shadow node A with background colour **red**.
2. Fabric asks Android to allocate a view for shadow node A with background colour **red**.
3. React commits tree **T1** and calls layout effects. Meanwhile Fabric waits, without trying to mount the tree **T1**, to prevent painting state that is about to be updated and prevent flickering.
4. React clones node A, changing the background colour to **blue** and commits the new tree **T2**.
5. Fabric, will now go ahead and mount the latest tree **T2**. While creating mount instructions, it will drop prop updates because it believes prop updates where delivered already as part of step 2.

# The fix

The fix is to change two things:
1. Ignore view preallocation for shadow nodes which were cloned with new props.
2. Set hasBeenMounted flag on ShadowNode later in the Fabric pipeline to fix it.

Both of these are hidden behind a single feature flag: `fixMountedFlagAndFixPreallocationClone`

## Performance implication:
I estimate that this will impact around 3% of views.

Reviewed By: rubennorte

Differential Revision: D56353589

fbshipit-source-id: 651d3cd2d0f78bfbbe9c05aa1ae1b1690c15e4ea
2024-04-24 14:54:08 -07:00
Sam Zhou 132563d81c Deploy 0.235.1 to xplat
Summary: Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D56505986

fbshipit-source-id: 2eb4ca02d766f4e2a88ab050e4acd25cd15c490b
2024-04-24 12:27:04 -07:00
Pieter De Baets 766ece7b9b Fix PointerEvents not dispatching post-scroll (#44238)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44238

Changelog: [Android][Fixed] PointerEvents were not dispatching after a scroll event

Reviewed By: RSNara

Differential Revision: D56519337

fbshipit-source-id: 72ea6fba583f1105e6c71560fc3a06913287844f
2024-04-24 08:22:00 -07:00
Pieter De Baets 767197c9a2 Rollout enableFabricPendingEventQueue feature flag (#44208)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44208

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D56467342

fbshipit-source-id: 0461b16727af708769af363125bf51c0761c9505
2024-04-24 06:30:50 -07:00
Pieter De Baets 849da2146c Split scheduler commit and flush delegate methods (#44188)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44188

The current approach used for `batchRenderingUpdatesInEventLoop` is not compatible with Android due to limitations in its props processing model. The raw props changeset is passed through to Android, and must be available for the Android mounting layer to correctly apply changes.

We have some logic to merge these payloads when multiple ShadowNode clones take place but were previously assuming that a ShadowTree commit was a safe state to synchronize.

In the current implementation this means that two commits driven from layout effects (triggering states A → B → C) may cause Android to observe only the B → C props change, and miss out on any props changed in A → B.

Changelog: [Android][Fixed] Cascading renders were not mounting correctly when `batchRenderingUpdatesInEventLoop` is enabled.

Reviewed By: rubennorte

Differential Revision: D56414689

fbshipit-source-id: 7c74d81620db0f8b7bd67e640168afc795c7a1d7
2024-04-24 03:54:10 -07:00
Blake Friedman 9d1f951ab0 remove from build script (#44233)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44233

The package was added to our build scripts, but shouldn't have been.  We're not exporting this package or making it public.

Changelog: [Internal]

This should unblock our OSS CI.

Reviewed By: cipolleschi

Differential Revision: D56513694

fbshipit-source-id: f37c75871253b2570fb933175165d8f0a9593a16
2024-04-24 03:53:34 -07:00
Arushi Kesarwani e25860f07c Fixing exposing ReactDelegate through ReactActivity for reload() (#44227)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44227

In https://github.com/facebook/react-native/pull/44223/ kudo identified the incorrect return type.

Reviewed By: christophpurrer, philIip

Differential Revision: D56497700

fbshipit-source-id: 5d7fc7ef21c3d3033a2567eba51b613eb41f0a1a
2024-04-24 00:20:54 -07:00
Phillip Pan 8b1a01610c remove unused functions from RuntimeExecutor.h (#44197)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44197

Changelog: [General][Breaking] Remove executeAsynchronously and executeSynchronously_CAN_DEADLOCK

these are not used anywhere nor in OSS, we can delete this safely

Reviewed By: javache

Differential Revision: D56447959

fbshipit-source-id: d66c10f676946422385750c1b8825ead2d5d0ed8
2024-04-23 19:43:42 -07:00
Blake Friedman 995d5b832d Add an internal HelloWorld template
Summary:
This is a copy of the current packages/react-native/template that we exclusively use internally for testing.

Changelog: [Internal]

NOTE: Best contribution would be to scan the file list and ensure there isn't anything that shouldn't be in there.

bypass-github-export-checks

Reviewed By: cortinico, cipolleschi

Differential Revision: D56242484

fbshipit-source-id: 0913ff7acff9b0314b49f48e986674b77dbb908e
2024-04-23 15:07:59 -07:00
Riccardo Cipolleschi 05f0861878 Back out "Update ColorPropConverterto support color function values" (#44225)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44225

Back out [#43031](https://github.com/facebook/react-native/pull/43031) as it makes some internal test fails.

## Changelog:
[Android][Fixed] - Revert #43031

Reviewed By: arushikesarwani94

Differential Revision: D56489260

fbshipit-source-id: bd843e6eb60fce0a1d5d8da9f3c5d2a36473ecfb
2024-04-23 13:58:25 -07:00
Sam Zhou 41f525ccae Pre-suppress unsafe string key access errors in xplat/js (#44221)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44221

This diff pre-suppresses errors of the following pattern, to prepare for the next Flow release.

```
declare const obj: {foo: string};
declare const key: string;
obj[key]; // error: invalid-computed-prop
```

Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D56477899

fbshipit-source-id: 5676b8685bd3157a519fe433cfce0fa28e003502
2024-04-23 11:36:14 -07:00
Samuel Susla 4928f44f70 tear down surfaces when React Native instance is destoyed (#44209)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44209

## Changelog:

[Android] [Fixed] - When React Native is destroyed, unmount all Fabric surfaces.

Previously, Fabric surfaces would not be torn down. Meaning that passive and layout effects wouldn't be unmounted and surface infra wouldn't be cleaned up.

For example:

```
useEffect(() => {
    return () => {
      console.log('unmounted');
    }
)};
```

When calling `ReactNativeHost.clear()` on Android in native code, the above effect should be unmounted.

This is a requirement for Fabric.

Reviewed By: javache

Differential Revision: D56238947

fbshipit-source-id: 5dbf5cdef520f34c78953c2b8f2d42349549e893
2024-04-23 10:18:55 -07:00
Blake Friedman c884d19a50 Moved @react-native-community script internally into react-native/scripts
Summary:
This decouples the listing of modules from the linking of those modules into Cocoapods. I've made this backwards compatible, but our internal template wont lean on the community config.

The user can now override how they capture a list of React Native modules, providing an escape hatch for Framework authors to build on.

Changelog: [General][iOS] Use our fork of the react-native-communti/cli-platform-ios use_native_modues.rb script

Reviewed By: cipolleschi

Differential Revision: D56242486

fbshipit-source-id: 78505669ab6abd6718348388c3bfba3290f7071b
2024-04-23 09:50:17 -07:00
Rubén Norte ff094d80d0 Clean up feature flag for mount hooks on Android (#44206)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44206

Changelog: [internal]

We finally managed to implement mount hooks without reliability issues on Android, so we can clean up the feature flag and enable it unconditionally.

Reviewed By: cortinico

Differential Revision: D56467379

fbshipit-source-id: d797ec770b731135332bc9f39df1c1e684b3bde4
2024-04-23 08:48:06 -07:00
Riccardo Cipolleschi 0a80270187 Extend Property Processor to support long properties
Summary:
This change is a preliminary change to add support to `Long` and `long` React props that are required for supporting WideGamut color space.

## Changelog
[Android][Added] - Extend Property Processor to support long props

Reviewed By: cortinico

Differential Revision: D56461183

fbshipit-source-id: 0f70388abe2b414a09df640f04e767f1164d63ce
2024-04-23 08:37:44 -07:00
Ryan Linton 0a9891a2f2 Add isWideColorGamutEnabled to ReactActivityDelegate (#43036)
Summary:
This adds support for enabling wide color gamut mode for ReactActivity per the wide gamut color [RFC](https://github.com/react-native-community/discussions-and-proposals/pull/738).

## Changelog:

[ANDROID] [ADDED] - Add isWideColorGamutEnabled to ReactActivityDelegate

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

Test Plan:
Update RNTesterActivity.kt to enable wide color gamut:

```diff
  class RNTesterActivity : ReactActivity() {
    class RNTesterActivityDelegate(val activity: ReactActivity, mainComponentName: String) :
      // ...
      override fun getLaunchOptions() =
          if (this::initialProps.isInitialized) initialProps else Bundle()

+     override fun isWideColorGamutEnabled() = true
    }
```

Reviewed By: cortinico

Differential Revision: D55749124

Pulled By: cipolleschi

fbshipit-source-id: 44dd5631e1a2e429c86c01ed8747bbebbc8bdb3b
2024-04-23 08:37:44 -07:00
Ryan Linton fa7dbd578d Update ColorPropConverterto support color function values (#43031)
Summary:
This adds support for color function values to ColorPropConverter per the wide gamut color [RFC](https://github.com/react-native-community/discussions-and-proposals/pull/738). It updates the color conversion code so that it returns a Color instance before ultimately being converted to an Integer in preparation for returning long values as needed.

bypass-github-export-checks

## Changelog:

[ANDROID] [ADDED] - Update ColorPropConverter to support color function values

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

Test Plan:
Colors should work exactly the same as before.

Follow test steps from https://github.com/facebook/react-native/pull/42831 to test support for color() function syntax.

While colors specified with color() function syntax will not yet render in DisplayP3 color space they will not be misrecognized as resource path colors but will instead fallback to their sRGB color space values.

Reviewed By: cortinico

Differential Revision: D55749058

Pulled By: cipolleschi

fbshipit-source-id: 37659d22c1db4b1a27a9a4f88c9beb703517b01f
2024-04-23 08:37:44 -07:00
Keion Anvaripour 098454d425 Expose JSExceptionHandler to ReactNativeHost (#44172)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44172

Changelog: [Android][Added] Option to set a custom JSExceptionHandler instance

Reviewed By: javache

Differential Revision: D56382090

fbshipit-source-id: 69ad72ee34f1c9f636d95035d0463c5344cb4a37
2024-04-23 04:04:19 -07:00
Samuel Susla 00055f89a0 reset animation state in TouchableOpacity and TouchableBounce (#44182)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44182

## Changelog:

[iOS] [Fixed] - Fixed stale state on TouchableOpacity and TouchableBounce

When TouchableOpacity and TouchableBounce are unmounted, we need to reset their state. This includes animation state. If we don't do that, view is unmounted on the mounting layer and animation will not be applied. This leaves view in undefined state. In TouchableOpacity, it is view with reduced opacity. TouchableBounce that is view with applied transform.

This was reported in https://github.com/facebook/react-native/issues/44044

Reviewed By: rubennorte, cipolleschi

Differential Revision: D56416571

fbshipit-source-id: 01214ec8a5e07c80a609e082b955a30305ad8396
2024-04-23 03:20:03 -07:00
Phillip Pan d59de54507 decouple BufferedRuntimeExecutor from various targets (#44196)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44196

Changelog: [Internal]

BufferedRuntimeExecutor is unnecessarily coupled with these other targets (React-runtime, React-cxxreact), break that dependency so we can modularize this file

Reviewed By: realsoelynn

Differential Revision: D56382644

fbshipit-source-id: ed9725fbddcda04b73c583d927351440b4fc3328
2024-04-22 18:39:28 -07:00
Frieder Bluemle 968884ae86 Fix space/tab indentation in template project.pbxproj (#44186)
Summary:
After creating a new project with `npx react-native init`, line 39 in `project.pbxproj` contains both spaces and tabs for indentation (accidentally introduced in 520d120375). This line will be unnecessarily touched and rewritten by a subsequent `pod install`.

Fix the indentation by replacing 4 spaces with one tab character (the Xcode managed file exclusively uses tabs for indentation).

## Changelog:

[GENERAL] [FIXED] - Fix space/tab indentation in template project.pbxproj

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

Test Plan: Generate project again with change and observe that the file will be generated with the expected indentation.

Reviewed By: NickGerleman

Differential Revision: D56439289

Pulled By: arushikesarwani94

fbshipit-source-id: ced9f0c94757a4925cd01673c65f2c38d28629e6
2024-04-22 18:15:49 -07:00
Phillip Pan 8e4b7fb4cf add privacy manifest to react native glog
Summary:
Changelog: [Internal]

add this to the framework's resource bundle

from the audit there was a callsite to fstat in our forked copy of glog, so use C617.1.
callsites:
- glog/src/logging.cc

current problem with this method is that the required reasons are not currently be aggregated during app store review, so those need to live in the app's. but go ahead and add it here for now, i think apple will try to fix it.

Reviewed By: cipolleschi

Differential Revision: D55625116

fbshipit-source-id: b10ea2dad2238cc85b5fe30df56269a5808a35b5
2024-04-22 16:15:53 -07:00
Phillip Pan 11def80f5d add privacy manifest to RCT-Folly
Summary:
Changelog: [Internal]

add this to the framework's resource bundle

from the audit there were callsites to fstat variants in our forked copy of boost, so use C617.1.
callsites:
- RCT-Folly/folly/FileUtil.h
- RCT-Folly/folly/portability/SysStat.h

current problem with this method is that the required reasons are not currently be aggregated during app store review, so those need to live in the app's. but go ahead and add it here for now, i think apple will try to fix it.

Reviewed By: cipolleschi

Differential Revision: D55625114

fbshipit-source-id: fb388f474e62543828218925b0d409d4b558c3db
2024-04-22 16:15:53 -07:00
Phillip Pan c05591b25b add privacy manifest to react native boost
Summary:
Changelog: [Internal]

add this to the framework's resource bundle

from the audit there were callsites to mach_absolute_time and fstat variants in our forked copy of boost, so use 35F9.1 and C617.1 respectively.

current problem with this method is that the required reasons are not currently be aggregated during app store review, so those need to live in the app's. but go ahead and add it here for now, i think apple will try to fix it.

Reviewed By: cipolleschi

Differential Revision: D55625113

fbshipit-source-id: 0dcd216116595d1bb14e6b843f711aac68f84e5c
2024-04-22 16:15:53 -07:00
Phillip Pan 54c9748bb1 add privacy manifest to React-cxxreact
Summary:
Changelog: [Internal]

add this to the framework's resource bundle

reasons:
  - C617.1 (JSBigString)

current problem with this method is that the required reasons are not currently be aggregated during app store review, so those need to live in the app's. but go ahead and add it here for now, i think apple will try to fix it.

Reviewed By: sammy-SC

Differential Revision: D55624716

fbshipit-source-id: 400e9852a64e7f9fd9e32225b199f2664a069fc2
2024-04-22 16:15:53 -07:00
Phillip Pan 14c7794f1d add privacy manifest to React-Core
Summary:
Changelog: [Internal]

add this to the framework's resource bundle

reasons:
 - C617.1 (RCTJavaScriptLoader)
 - CA92.1 (RCTI18nUtil, RCTBundleURLProvider, RCTSettingsManager)

current problem with this method is that the required reasons are not currently be aggregated during app store review, so those need to live in the app's. but go ahead and add it here for now, i think apple will try to fix it.

Reviewed By: sammy-SC

Differential Revision: D55622471

fbshipit-source-id: f6ab864f51d4fa6e20f5de4fd56d8126d55dea8d
2024-04-22 16:15:53 -07:00
Riccardo Cipolleschi 224ac21568 Fix Symbol not found: (_JSGlobalContextSetInspectable) (#44185)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44185

This change will fix a symbol not found for JSC Runtime.

The `if` check was not a compile time check, therefore the symbol ended up in the binary even if it is not available.

Following this post on [Apple forum](https://forums.developer.apple.com/forums/thread/749534), this changes should do the trick.

## Changelog
[iOS][Fixed] - Fix Symbol not found: (_JSGlobalContextSetInspectable)

Reviewed By: hash3r

Differential Revision: D56425834

fbshipit-source-id: a37af51b078bd47a938e6b65d9d8e0f7506e746f
2024-04-22 13:59:16 -07:00
Nivaldo Bondança 876914be55 Update ktfmt component on FBS:master (#44184)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44184

Reviewed By: zertosh

Differential Revision: D56421174

fbshipit-source-id: 686e23775f53d67980c2e84a17d0a5c490dbec2a
2024-04-22 12:43:18 -07:00
Arushi Kesarwani 57663f7673 Refactor ReactHostImpl to simplify logging (#44170)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44170

Addressing following logging issues with ReactHostImpl
- replacing `ReactSoftExceptionLogger.logSoftException()` directly with private `raiseSoftException()` at all call-sites
- `raiseSoftException()` already has a call to `log()`, hence removing that.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D56335797

fbshipit-source-id: 41e094b5dc25f23fa19cd391a85ea101c3ff9058
2024-04-22 11:11:22 -07:00
Nizam 99f3c241ad fix array enum prop parsing for array enum types (#44123)
Summary:
codegen generates type alias for  array enum props with uint32_t which cause wrong overloaded fromRawValue to call at runtime eventually app to terminate
more detailed info at issue https://github.com/facebook/react-native/issues/43821

## Changelog:

[Internal] [Fixed] - Codegen for array enum props

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

Test Plan: TODO

Reviewed By: cipolleschi

Differential Revision: D56414554

Pulled By: dmytrorykun

fbshipit-source-id: 0ec1b65951bc16ff58dd2b119c97a4e3fac2b161
2024-04-22 10:55:36 -07:00
Alex Hunt c1f5504e3a Add changelog for 0.74.0
Summary: Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D56424487

fbshipit-source-id: 0be20582f38a4674afbd5113526612d1017500e2
2024-04-22 10:21:06 -07:00
Jan Kassens f453d7a254 Apply fixup patch to fbsource
Summary:
This is an automatically generated fixup patch to bring fbsource back into sync with
facebook/react-fbsource-import on GitHub. Please land this patch as soon as possible, as the difference
reflected on here is already on GitHub and future changes may depend on these
changes!

Changelog: [Internal]

<< DO NOT EDIT BELOW THIS LINE >>
diff-train-skip-merge
diff-train-source-id: 13710c68616cf643d3cdfd69e5f39b2dc5a801b4

Generated by: https://www.internalfb.com/intern/sandcastle/job/36028798276627863/

GitHub Repo: facebook/react-fbsource-import

Reviewed By: jackpope

Differential Revision: D56357596

fbshipit-source-id: 171ed7b816869348a1cc3c06a78b3803b86eb7c4
2024-04-22 09:27:24 -07:00
Moti Zilberman b1bb0bee41 Align debugger Chrome launch flags with Meta-internal version (#44180)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44180

Changelog: [General][Changed] Update Chrome launch flags for `--experimental-debugger` launch flow

Internally at Meta, we've been testing the experimental debugger launch flow with a different set of Chrome flags than are currently shipped in open source. This diff fixes those differences:

* Removes `--disable-backgrounding-occluded-windows`
* Adds `--guest`

Reviewed By: EdmondChuiHW

Differential Revision: D56418271

fbshipit-source-id: 884c5746e93cad89f17e4ef9e3ef193a2a454eb5
2024-04-22 08:37:32 -07:00
Moti Zilberman d7f28b3ff1 Update debugger-frontend from b6c974c...24b0c81 (#44181)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44181

Changelog: [Internal] - Update `react-native/debugger-frontend` from b6c974c...24b0c81

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/b6c974c203394400867d959480187a996f0dbadb...24b0c8192bcc50e7274cdd1aea4ef6f425b77f48).

Reviewed By: EdmondChuiHW

Differential Revision: D56419657

fbshipit-source-id: 6b87ffdb190f743926138e16b194abafd8a9508d
2024-04-22 08:12:09 -07:00
Rob Hogan b0f6a05650 Fix @react-native/oss-library-example package.json#exports (#44179)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44179

Fix `package.json#exports` main entry point in `react-native/oss-library-example` (which is actually at `packages/react-native-test-library`), to fix a Metro resolver warning on building RN-tester.

`"./": "./index.js"` is intended as an export map entry for the main export, whereas `".": "./index.js"` is correct (see [`PACKAGE_EXPORTS_RESOLVE`](https://nodejs.org/api/esm.html) spec).

Changelog: [Internal]

(This package is not published)

Reviewed By: cortinico, dmytrorykun

Differential Revision: D56414480

fbshipit-source-id: 01874cf11ae687aaf5aa5aa56075232f03d691b8
2024-04-22 05:23:04 -07:00
Jakub Piasecki b236e154a1 Fix font scaling when numberOfLines is not set on Android on the new arch (#44165)
Summary:
This is a follow-up to https://github.com/facebook/react-native/pull/44075. I've missed the fact that `ReactConstants.UNSET` is `-1` and the default value of `numberOfLines` prop is `0`. This resulted in font size being set to the minimal value when `adjustFontSizeToFit` was used without setting `numberOfLines` to a positive value.

## Changelog:

[ANDROID] [FIXED] - Fixed `adjustFontSizeToFit` when used without `numberOfLines`

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

Test Plan:
<details>
<summary>Tested on the following code</summary>

```jsx
import { Text, SafeAreaView, View, StyleSheet } from 'react-native';

export default function Test() {
  return (
    <SafeAreaView style={styles.container}>
      <View style={{margin: 4, borderWidth: 1, borderColor: 'black'}}>
        <Text style={{ fontSize: 16 }}>
          Some text that fits (no adjust, unlimited height)
        </Text>
      </View>

      <View style={{margin: 4, borderWidth: 1, borderColor: 'black'}}>
        <Text style={{ fontSize: 16 }} adjustsFontSizeToFit>
          Some text that fits (adjust, unlimited height)
        </Text>
      </View>

      <View style={{margin: 4, borderWidth: 1, borderColor: 'black'}}>
        <Text style={{ fontSize: 16 }} numberOfLines={1}>
          Some text that fits (no adjust, 1 line)
        </Text>
      </View>

      <View style={{margin: 4, borderWidth: 1, borderColor: 'black'}}>
        <Text style={{ fontSize: 16 }} adjustsFontSizeToFit numberOfLines={1}>
          Some text that fits (adjust, 1 line)
        </Text>
      </View>

      <View style={{margin: 4, borderWidth: 1, borderColor: 'black'}}>
        <Text style={{ fontSize: 16 }}>
          Some longer text that doesn't fit if displayed in one line (no adjust, unlimited height)
        </Text>
      </View>

      <View style={{margin: 4, borderWidth: 1, borderColor: 'black'}}>
        <Text style={{ fontSize: 16 }} adjustsFontSizeToFit>
          Some longer text that doesn't fit if displayed in one line (adjust, unlimited height)
        </Text>
      </View>

      <View style={{margin: 4, borderWidth: 1, borderColor: 'black'}}>
        <Text style={{ fontSize: 16 }} numberOfLines={1}>
          Some longer text that doesn't fit if displayed in one line (no adjust, 1 line)
        </Text>
      </View>

      <View style={{margin: 4, borderWidth: 1, borderColor: 'black'}}>
        <Text style={{ fontSize: 16 }} adjustsFontSizeToFit numberOfLines={1}>
        Some longer text that doesn't fit if displayed in one line (adjust, 1 line)
        </Text>
      </View>

      <View style={{margin: 4, borderWidth: 1, borderColor: 'black'}}>
        <Text style={{ fontSize: 16 }}>
          Even longer text that doesn't even fit if it has as much as two entire lines for itself, what a darn shame (no adjust, unlimited height)
        </Text>
      </View>

      <View style={{margin: 4, borderWidth: 1, borderColor: 'black'}}>
        <Text style={{ fontSize: 16 }} adjustsFontSizeToFit>
          Even longer text that doesn't even fit if it has as much as two entire lines for itself, what a darn shame (adjust, unlimited height)
        </Text>
      </View>

      <View style={{margin: 4, borderWidth: 1, borderColor: 'black'}}>
        <Text style={{ fontSize: 16 }} numberOfLines={2}>
          Even longer text that doesn't even fit if it has as much as two entire lines for itself, what a darn shame (no adjust, 2 lines)
        </Text>
      </View>

      <View style={{margin: 4, borderWidth: 1, borderColor: 'black'}}>
        <Text style={{ fontSize: 16 }} numberOfLines={2} adjustsFontSizeToFit>
          Even longer text that doesn't even fit if it has as much as two entire lines for itself, what a darn shame (adjust, 2 lines)
        </Text>
      </View>
    </SafeAreaView>
  );
}
```

</details>

|Old arch|New arch (without this PR)|New arch (with this PR)|
|-|-|-|
|<img width="447" alt="a_old" src="https://github.com/facebook/react-native/assets/21055725/4822f7f1-a19c-4225-9318-0eb2fec6f925">|<img width="447" alt="a_new_no_change" src="https://github.com/facebook/react-native/assets/21055725/ff594673-b362-4a81-8837-624cb1061d28">|<img width="447" alt="a_new_changed" src="https://github.com/facebook/react-native/assets/21055725/1f29c01c-1c91-4c9f-9edd-0950338b5d39">|

Reviewed By: NickGerleman

Differential Revision: D56362020

Pulled By: cortinico

fbshipit-source-id: 2aecbe66043870cf14536850ecbfb7c3890acd72
2024-04-22 04:13:36 -07:00
Moti Zilberman 03a51da727 Populate function descriptions in RemoteObject
Summary:
bypass-github-export-checks

Changelog: [Internal]

[`Runtime.RemoteObject`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#type-RemoteObject) 's `description` property is a string, but in
the case of functions, V8 populates it with the result of [toString][1]
and Chrome DevTools uses a [series of regexes][2] to extract structured
information about the function.

Here, we add similar behaviour to Hermes to enable the various Chrome
DevTools UI features that are powered by function descriptions, such as
showing function names on hover and in object previews.

[1]: https://source.chromium.org/chromium/chromium/src/+/main:v8/src/debug/debug-interface.cc;l=138-174;drc=42debe0b0e6bf90175dd0d121eb0e7dc11a6d29c
[2]: https://github.com/facebookexperimental/rn-chrome-devtools-frontend/blob/9a23d4c7c4c2d1a3d9e913af38d6965f474c4284/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts#L311-L391

Reviewed By: dannysu

Differential Revision: D56343190

fbshipit-source-id: a7ef5f09c98f34f486c4db2d4af192f10811d671
2024-04-19 15:00:16 -07:00
Arushi Kesarwani 73b4d67a78 Delete deprecated JSIModule methods (#42115)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42115

React Native Android had a concept called JSIModules, which iOS doesn't have. The JSIModule concept was introduced in the early stages of the Fabric project to represent modules that interact with JS through JSI and they are not NativeModules.

In the new architecture this concept is not really necessary and these interfaces were only used to initialize and destroy the Fabric renderer and TurboModule Manager in react native core. Bridgeless mode doesn’t use JSIModule anymore. Also, it has an explicit list of supported JSI module types, so is not open for extension.
In order to simplify RN concepts and reduce confusion with TurboModules, which also "use JSI", deleting everything related to JSIModule. This was already deprecated in 0.74.0.

Please use ReactInstanceEventListener to subscribe for react instance events instead of getJSIModule() and we recommend using TurboModules instead of JSIModules.

Changelog:
[General][Breaking] Delete JSIModule

Reviewed By: javache, cortinico

Differential Revision: D49597702

fbshipit-source-id: bc2bc190aafaf559336b341b50ffabf413474105
2024-04-19 11:54:36 -07:00
Arushi Kesarwani ac3261ff60 Add ReactSoftException in ReactHostImpl only when onActivityResult, onNewIntent and onWindowFocusChange do not have the context (#44155)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44155

Add ReactSoftException in ReactHostImpl only when `onActivityResult`, `onNewIntent`and `onWindowFocusChange` do not have the context

Changelog:
[Android][Fixed] ReactSoftExceptions in ReactHostImpl only when Context is null

Reviewed By: cortinico

Differential Revision: D56325407

fbshipit-source-id: a9f8fd5772fc05d39e72236fb8edfe5f8a9d6a43
2024-04-19 11:54:24 -07:00
Arushi Kesarwani efb073f46b NIT Changelog (#44156)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44156

Adding the correct account to changelog

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D56334873

fbshipit-source-id: 7e01f8ad7d19ba9708713d847f9ed1fcbecb4802
2024-04-19 11:37:37 -07:00
Samuel Susla cf75d032d0 disable event loop (#44169)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44169

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

# What is the problem
With event loop, specifically with `batchRenderingUpdatesInEventLoop`, prop change is not delivered to Android mounting layer if the prop change was initiated from state update inside of `useLayoutEffect`, `componentDidMount` or `componentDidUpdate`.  Note this has to be a prop change affecting mounting layer directly, not something consumed by Yoga, e.g. background colour or border colour.

This affects android only.

Minimal repro :
```
import React, {useLayoutEffect, useState} from 'react';
import {Button, SafeAreaView, View} from 'react-native';
function Foo() {
  const [bgColor, setBgColor] = React.useState('red');
  useLayoutEffect(() => {
    console.log('useLayoutEffect');
    setBgColor('blue');
  }, []);
  return (
    <View
      style={{
        backgroundColor: bgColor,
        width: '100%',
        height: '100%',
      }}
    />
  );
}
function RNTesterApp() {
  const [show, setShow] = useState(false);
  return (
    <SafeAreaView>
      <Button title="Toggle" onPress={() => setShow(!show)} />
      {show && <Foo />}
    </SafeAreaView>
  );
}
export default RNTesterApp;
```

# The underlaying problem
The problem is in batched rendering updates and how props are delivered to Android mounting layer.

Here is a step by step what happens in the repro above:
1. React issues asks Fabric to create new shadow node A with background colour **red**.
2. Fabric asks Android to allocate a view for shadow node A with background colour **red**.
3. React commits tree **T1** and calls layout effects. Meanwhile Fabric waits, without trying to mount the tree **T1**, to prevent painting state that is about to be updated and prevent flickering.
4. React clones node A, changing the background colour to **blue** and commits the new tree **T2**.
5. Fabric, will now go ahead and mount the latest tree **T2**. While creating mount instructions, it will drop prop updates because it believes prop updates where delivered already as part of step 2.

At first this might appear as a problem with view preallocation. But the underlaying trouble is that on Android, we currently have no way of knowing how to combine changesets from React into single folly::dynamic.

Reviewed By: javache, cortinico

Differential Revision: D56355863

fbshipit-source-id: f8616ee48e10fc10e129bb632c5d398842220d24
2024-04-19 11:02:54 -07:00