Commit Graph

30841 Commits

Author SHA1 Message Date
Pieter De Baets 9e2bb4efc3 Fix TimingModuleTest in OSS (#43422)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43422

After my changes in D54496604, this test now requires the main looper to progress as well, to dispatch the right callback.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D54776392

fbshipit-source-id: ba272a08d4b88d1c3301618eed1a03253e615b84
2024-03-12 04:25:17 -07:00
Arushi Kesarwani bdca260679 Fix Bridgeless React Context test in OSS (#43424)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43424

https://github.com/facebook/react-native/pull/43400/ caused a `getCatalystInstanceTest` to fail in OSS due to `bridgelessReactContext` not being a Mock object.

Reviewed By: fkgozali

Differential Revision: D54781539

fbshipit-source-id: 1c784804c31d4b57fe438d49f3ee3eb7034dd7a6
2024-03-11 23:21:05 -07:00
Phillip Pan 5522d522bb support jsCallInvoker in RCTBridgeProxy (#43314)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43314

Changelog: [Internal]

making call invoker a breaking change to runtime executor in 0.74 seems to be causing a lot of discourse. let's simplify things and first add the callinvoker to the backwards compat layer

Reviewed By: cipolleschi

Differential Revision: D54404845

fbshipit-source-id: 983e86829030557033b95625dab9068492739417
2024-03-11 21:55:42 -07:00
Phillip Pan 620459a07e change import to RCTBridgeProxy to forward declaration (#43313)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43313

Changelog: [Internal]

we can simplify the build graph here

Reviewed By: cipolleschi

Differential Revision: D54404844

fbshipit-source-id: 52dfbd05106e72687b969357e274d2c4cdd9ca34
2024-03-11 21:55:42 -07:00
Fabrizio Cucci 86a52cc2dc Scope LongLivedObjectCollection per runtime [3/n] (#43410)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43410

Changelog:
[General] [Breaking] - Make `LongLivedObjectCollection::get` accept a Runtime reference as parameter.

# Context

Approach 1 as described in [RFC post](https://fb.workplace.com/groups/615693552291894/permalink/1693347124526526/).

# This diff

* Replace the `LongLivedObjectCollection` singleton with a map from `Runtime -> LongLivedObjectCollection` so that each RN instance has its own collection.
* Update MSFT fork accordingly

Reviewed By: javache, RSNara

Differential Revision: D54649209

fbshipit-source-id: ecd2ab3917843ca82388b7b9cce06c05679f2d60
2024-03-11 15:55:45 -07:00
Pieter De Baets da21799ca3 Fix stack overflow in createRootView (#43420)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43420

Calling `mReactDelegate.createRootView` just ends up calling the overridden method in the anonymous inner class. Instead have the base implementation return null, and call super.

Changelog: [Internal]

Reviewed By: jessebwr, janeli-100005636499545

Differential Revision: D54772205

fbshipit-source-id: fc90e6718f9c287e8b86e5768cf7f74d0db06c49
2024-03-11 14:49:52 -07:00
Fabrizio Cucci 3706bf077e Scope LongLivedObjectCollection per runtime [2/n] (#43409)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43409

Changelog:
[General] [Breaking] - Make `LongLivedObject` constructor accept a `Runtime` reference.

# Context

Approach 1 as described in [RFC post](https://fb.workplace.com/groups/615693552291894/permalink/1693347124526526/).

# This diff

* Embed `Runtime` reference in `LongLivedObject` to keep supporting `allowRelease` method (and update extending classes accordingly)
* Update MSFT fork accordingly

Reviewed By: RSNara

Differential Revision: D54638813

fbshipit-source-id: 0d58d1c32b3689bdd1223c13f5d5ee2f2e15f223
2024-03-11 13:01:09 -07:00
Arushi Kesarwani c6076bca97 Implement getJSCallInvokerHolder for BridgelessCatalystInstance (#43400)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43400

Implement `getJSCallInvokerHolder()` for BridgelessCatalystInstance

Changelog:
[Android][Breaking] Implement `getJSCallInvokerHolder()` for Bridgeless Catalyst Instance

Reviewed By: cortinico

Differential Revision: D54650305

fbshipit-source-id: effac3daaad5173c2fd78ab11bbe3f3156a9c07b
2024-03-11 12:19:49 -07:00
Alex Hunt a7fde7c885 Enable JSI integration tests for Hermes CDPAgent (#43391)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43391

## Context

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

## This diff

Bootstraps `HermesRuntimeAgentDelegateNew` within `JsiIntegrationTest.cpp`.

Test cases which currently do not pass with `HermesRuntimeAgentDelegateNew` are selectively matched against a new alias to exclude them: `JsiIntegrationHermesLegacyTest`.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D53810357

fbshipit-source-id: 2d7d7446038530d19d93add71361b4bf581cff18
2024-03-11 11:03:58 -07:00
Alex Hunt c6ca7d61af Add changelog for 0.74.0-rc3
Summary: Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D54755786

fbshipit-source-id: 76dfac43143d95a8765d67c93a2d8a30edec4259
2024-03-11 10:39:52 -07:00
Nick Gerleman b696a7dc5e Reduce warning level of distributed Yoga builds (#43405)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43405
X-link: https://github.com/facebook/yoga/pull/1592

Fixes https://github.com/facebook/yoga/issues/1590

Yoga may be built with a high warning level. This is helpful in letting Yoga be used in more places, and finding defects. We currently set these in the internal BUCK build, the CMake reference build, and the Yoga Standalone (not RN) CocoaPods build.

Yoga's reference CMake build and spec are consumed today by users of Yoga, instead of just Yoga developers. Here, it makes more sense to avoid anything that could break compiler-to-compiler compatibility.

We default these to a less intense (`-Wall -Werror`). I kept `/W4`, for pragmatic reasons, and since it is relatively standard for MSVC.

We continue to build with strict flags on Buck build on Clang.

Reviewed By: cortinico

Differential Revision: D54735661

fbshipit-source-id: 130e35ac9dcffa2f7e70e48d18770f1275864e2a
2024-03-11 10:38:55 -07:00
Rick Hanlon e9e668f0ec Symbolicate component stacks (#43166)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43166

# Overview
This diff adds support for symbolicating component stacks that provide the new stack frame formatting. It currently switches between a `componentStackType` value to enable stack frame parsing, but once the feature flag lands we can clean this up so that the type of `ComponentStack` is always just `Array<StackFrame>`

## Screen

### With stack frame component stacks
{F1459181398}

## Legacy version
 {F1463451637}

Changelog:
[General][Fixed] - Support component stacks without source info.

Reviewed By: yungsters

Differential Revision: D53984570

fbshipit-source-id: 68afbe70b65c7a8861d049bebe0659dbe1db146f
2024-03-11 10:29:06 -07:00
hurali97 d66b9a5b28 Changelog: 0.73.6 (#43412)
Summary:
## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

Changelog: [Internal] Generated changelog

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

Reviewed By: cortinico

Differential Revision: D54753626

Pulled By: huntie

fbshipit-source-id: c0a2348601b3d78b08ccaab570f346716d3793e6
2024-03-11 10:18:36 -07:00
Pieter De Baets 3283202248 Remove createRootView(initialProps) from ReactDelegate (#43365)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43365

Changelog: [Android][Changed] Simplified ReactActivityDelegate to expose a single createRootView method.

Reviewed By: cortinico

Differential Revision: D54434648

fbshipit-source-id: 305c54910a1eac25664507972879c7c6bd633466
2024-03-11 09:40:33 -07:00
Moti Zilberman aeb250430d Make FallbackRuntimeAgentDelegate private (#43348)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43348

Changelog: [Internal]

Followup from D54585658. Moves the branching on `HERMES_DEBUGGER_ENABLED` into `HermesRuntimeTargetDelegate`, and correspondingly makes `FallbackRuntimeAgentDelegate` private (not exposed directly to integrators).

Reviewed By: huntie

Differential Revision: D54587558

fbshipit-source-id: 554b41356c1421a508c1a788d7c27f53445ecb6b
2024-03-11 09:30:53 -07:00
Pieter De Baets 641a9c468f Move lifecycle listener inside JavaTimerManager (#43338)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43338

Reafactor JavaTimerManager so more code is shared between bridge and bridgeless.

Note that HeadlessJSTaskContext is not currently configured when using bridgeless.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D54496604

fbshipit-source-id: 2a61294267df372e69f8316dd8f8059625d0a2bd
2024-03-11 09:09:52 -07:00
Moti Zilberman 7c5a014c0d Pass whole RuntimeTargetDelegate from RN instead of aggregating its methods (#43346)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43346

Changelog: [Internal]

(Continuing the theme of reducing integration boilerplate from D54537844.)

This diff changes both `JSExecutor` (Bridge) and `JSRuntime` (Bridgeless) to no longer implement `RuntimeTargetDelegate`. Instead, each of them exposes a `getRuntimeTargetDelegate()` method that returns a stable reference to a target delegate that it *owns*.

To facilitate this, we create a new `FallbackRuntimeTargetDelegate` for use in non-Hermes cases. This replaces *almost* all direct uses of `FallbackRuntimeAgentDelegate` outside of `jsinspector`. I'll follow up in a separate diff to deal with the last case and make the fallback agent delegate fully private.

As a result, changing the `RuntimeTargetDelegate` interface (which we'll need to do for console support) becomes much easier: we only have unit test mocks + two concrete `RuntimeTargetDelegate` implementations (one fallback, one Hermes) to update for each API change.

Reviewed By: huntie

Differential Revision: D54585658

fbshipit-source-id: 08b61c74008ddc36c2b134a40755ef8e43ab21ed
2024-03-11 06:29:32 -07:00
D N 1ea269f42c fix: [TypeScript] Allow to pass empty string as style (#43404)
Summary:
```tsx
import {Text} from 'react-native'

interface Props {
  foregroundColor?: string | undefined | null
}

function Test({foregroundColor}: Props){
  return <Text style=[styles.icon, foregroundColor && { color: foregroundColor }] />
  // ^^^ Error: Type "" is not assignable to type TextStyle | Falsy | RegisteredStyle<TextStyle> | RecursiveArray<TextStyle...
}
```

## Changelog:

[GENERAL] [ADDED] - [TypeScript] Allow to pass empty string as style

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

Test Plan:
Change `Falsy` type locally and test it on the next code

```tsx
const styles = StyleSheet.create({
  text: {
    color: 'red',
  },
});
export const a = <Text style={[styles.text, null, '', undefined, false]} />;
```

Reviewed By: rshest

Differential Revision: D54744517

Pulled By: javache

fbshipit-source-id: c5b934616cc0501c2b6a7907e6be522187a2cc20
2024-03-11 06:00:36 -07:00
Alex Hunt 80891468d2 Update InspectorFlags to lazily pull upstream values (#43390)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43390

Refactor after D54639775. This avoids the unfortunate side effect where `InspectorFlags::dangerouslyResetFlags()` would immediately reread `ReactNativeFeatureFlags `. This call is now relocated in our test util.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D54684692

fbshipit-source-id: 962c7d78bbf71b1d81af412081d3ef5cfe443fa1
2024-03-11 05:29:07 -07:00
Cedric van Putten 3dee6d31b9 fix(dev-middleware): allow inspector proxy to fetch sourcemaps on lan connections (#43307)
Summary:
The inspector proxy is inlining source maps on `Debugger.scriptParsed` CDP events. The inlining prevents Chrome DevTools from downloading this remotely, as that's not supported in newer versions anymore.

The current implementation locks this inlining mechanism to just `localhost` and/or `127.0.0.1` addresses, making it incompatible with LAN or tunnel device connections.

This PR removes that limitation to allow source map inlining on these LAN and tunnel connections.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[GENERAL][FIXED] Allow Inspector proxy to inline source maps on LAN connections

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

Test Plan:
- See added test
- Start Metro and connect a device over LAN, open the chrome devtools

Reviewed By: huntie

Differential Revision: D54485247

Pulled By: robhogan

fbshipit-source-id: 6fcb0c6dd762d2f0a013497ba0a1126095b9130b
2024-03-11 03:48:49 -07:00
Ruslan Lesiutin e2157f063a bump react-devtools-* packages to ^5.0.2 (#43384)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43384

Changelog: [Internal]

via `js1 upgrade react-devtools -v ^5.0.2`

5.0.1 and 5.0.2 mostly include fixes, biggest change is the way how we find source location of the element and the symbolication.

Backend from `react-devtools-core` 5.0.2 is required for symbolication.

allow-large-files

Reviewed By: huntie

Differential Revision: D54679238

fbshipit-source-id: 13656b2d9bad106246c019e1627b87ffbc2735fe
2024-03-08 13:07:49 -08:00
Ruslan Shestopalyuk 6c28c87c4d TurboModule::emitDeviceEvent doesn't require jsi::Runtime argument anymore (#43376)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43376

## Changelog:
[Internal] -

Make it possible to call `emitDeviceEvent` from C++ TurboModules without the need to explicitly provide the reference to `jsi::Runtime`, as in some contexts (when we call e.g. not from the JS thread itself) it may be hard to get hold of.

Reviewed By: rubennorte

Differential Revision: D54643903

fbshipit-source-id: 25cea413e66c6e76c958395879db1169899e3bc9
2024-03-08 10:28:45 -08:00
Ruslan Shestopalyuk 76ce789014 Pass jsi::Runtime reference into CallInvoker::invoke* callbacks (#43375)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43375

## Changelog:
[Internal] -

As discussed with the team, it makes more sense to pass the reference to the correct `jsi::Runtime` object as an argument to the ` CallInvoker::invoke*` callbacks, that are provided by the user.

There are various use cases when user would like to get a hold of the `jsi::Runtime` in the callback, and it makes sense, since it is guaranteed to run on the JS thread.

So far people have been coming up with all kinds of workarounds for that, none of them safe enough.

Reviewed By: rubennorte

Differential Revision: D54643171

fbshipit-source-id: 2f6015426a9e29cb9fcf5a9a3e2f6f33ff692538
2024-03-08 10:28:45 -08:00
Luna Wei 208be50000 Try renaming build_npm_package for nightly job (#43379)
Summary:
Changelog: [Internal] Try renaming nightly job so we can automate if there are failures
See https://circleci.com/docs/configuration-reference/#name

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

Reviewed By: cortinico

Differential Revision: D54670307

Pulled By: lunaleaps

fbshipit-source-id: 85a26f92d7789f6195c9cf07909dd12850010a4b
2024-03-08 09:46:48 -08:00
Alexey Litvinov eadcebbb3e add support for text highlighting (#43386)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43386

Changes:
- fixes `RCTAttributedTextUtils` to set `RCTAttributedStringIsHighlightedAttributeName` attribute according to `isHighlighted` textAttribute value.
- adds block to `drawAttributedString` and passed highlighted bezier curve to it.
- updates `drawRect` to visually highlight selected text.

## Changelog:
[iOS][Fixed] - Fixed text highlighting in the New Architecture

Reviewed By: sammy-SC

Differential Revision: D54594472

fbshipit-source-id: ed454e3a1660fa76d96cb131e33fba1c05f47776
2024-03-08 09:24:45 -08:00
Rick Hanlon 7bb204a160 Fix public-api-test "expected parse error" assertion (#43378)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43378

## Overview
I noticed while running this test, that there's an existing `console.error` to remove a file from the `FILES_WITH_KNOWN_ERRORS` list, but the tests pass despite the error. This happens because the `console.error` throws to fail the test, but this `console.error` is inside a try/catch, so the error is swallowed.

This diff moves the check to a finally, which fails the test.

I also fixed the `FILES_WITH_KNOWN_ERRORS` list.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D54587062

fbshipit-source-id: c46e98326ef6654452871337364d7e66ff204e2c
2024-03-08 08:53:49 -08:00
Alex Hunt cfa39c0a69 Integrate CDPAgent into HermesRuntimeTargetDelegate behind flag (#43353)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43353

## Context

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

## This diff

Integrates `HermesRuntimeAgentDelegateNew` (using the new Hermes `CDPAgent` setup) into `HermesRuntimeTargetDelegate` behind a new feature flag, `inspectorEnableHermesCDPAgent`. This completes the initial integration for all platforms.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D54586162

fbshipit-source-id: 5f26c28af4414d961b1c8c9cb4cd7135bd00b410
2024-03-08 07:29:22 -08:00
Alex Hunt 166fdc5125 Create wrapper class for Hermes CDPAgent + CDPDebugAPI (#43352)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43352

## Context

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

## This diff

Adds the `HermesRuntimeAgentDelegateNew` class to provide a swap-in replacement for the existing `HermesRuntimeAgentDelegate` when we enable this via an incoming feature flag.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D53810356

fbshipit-source-id: c63684252230a747ecf0bd8cbb6f4e22052ed9bf
2024-03-08 07:29:22 -08:00
Alex Hunt 52bd8418d8 Create InspectorFlagOverridesGuard util, substitute in tests (#43372)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43372

Create a shared `InspectorFlagOverridesGuard` util for our `jsinspector-modern` tests, update `ReactInstanceIntegrationTestWithFlags` to reuse this.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D54639775

fbshipit-source-id: 9b23e4c05bcdbb8ebc2a02a6e69326eb749d1cfd
2024-03-08 07:29:22 -08:00
Pieter De Baets 5ed3057822 Make ReactActivityDelegate methods public (#43367)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43367

Enable `ReactActivityDelegate` to be used outside of `ReactActivity` as well.

Changelog: [Internal]

Reviewed By: arushikesarwani94

Differential Revision: D54634339

fbshipit-source-id: 977e0da689d5a827feca89a5dcc9416ad5178334
2024-03-08 07:04:12 -08:00
Samuel Susla da913236ab add missing synchronisation call for native animated (#43374)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43374

changelog: [internal]

when animation that uses native driver finishes, it must synchronise the end state with shadow tree.

`onUpdateRef` for native animated is only called when the animation finishes.

Reviewed By: javache, yungsters

Differential Revision: D54582987

fbshipit-source-id: 4320ed172b8bb4b22f82c6e24b47f88f1603e4fb
2024-03-08 06:48:58 -08:00
Oskar Kwaśniewski 4adef35e97 fix(iOS) [0.74]: RCTRedBox not appearing in Bridgeless when metro is not running (#43147)
Summary:
When testing out `0.74.0-rc0` I found that when the metro is not running we are not displaying RedBox which bumps users to start the packager and reload the app. It also fixes the case where users try to reload by clicking the "Reload" button on RedBox.

## Before

https://github.com/facebook/react-native/assets/52801365/086c557f-ea1f-4a97-b4c7-df8a945cc7a0

## After

https://github.com/facebook/react-native/assets/52801365/9f8421b3-5e83-466f-8cdb-38f97981275d

## Changelog:

[IOS] [FIXED] - RCTRedBox not appearing in Bridgeless when metro is not running

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

Test Plan: Build the app without metro running check if RedBox is shown

Reviewed By: javache

Differential Revision: D54632056

Pulled By: dmytrorykun

fbshipit-source-id: fb6742898d3bd82545bfffd9175208e1a5984cb6
2024-03-08 04:53:42 -08:00
Tomek Zawadzki 642b4e5c2c Expose react_render_textlayoutmanager via prefab (#43381)
Summary:
The `react_render_textlayoutmanager` was not exposed via prefab. I'm adding it to make possible for react-native-live-markdown to integrate on top of React Native via prefab. Based on https://github.com/facebook/react-native/issues/36166.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[ANDROID] [CHANGED] - Expose `react_render_textlayoutmanager` via prefab.

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

Reviewed By: javache

Differential Revision: D54676207

Pulled By: cortinico

fbshipit-source-id: 90e3b90ff842250bf1e3abcc0c54f057b68a82fd
2024-03-08 04:32:44 -08:00
Kudo Chien 6bc95b2074 Add registerCallableModule types (#43366)
Summary:
`registerCallableModule()` was added from 7f549ec7be but no typescript types there. this pr tries to add the corresponding types.

## Changelog:

[GENERAL] [FIXED] - Add missing `registerCallableModule` TypeScript definitions

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

Test Plan: patch locally and try to `import { registerCallableModule } from 'react-native';` in a 0.74.0-rc.2 project

Reviewed By: fabriziocucci

Differential Revision: D54676151

Pulled By: cortinico

fbshipit-source-id: cd01f2ebe2d2516b458fae5b2e83cba3d3794455
2024-03-08 02:30:17 -08:00
Rick Hanlon 5126bace65 Fix VirtualizedList-test.js (#43377)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43377

Fixes `VirtualizedList-test.js`, which assumes fake timers (e.g. using `jest.runAllTimers()` and `jest.runOnlyPendingTimers()`) but did not actually use fake timers.

Changelog:
[Internal]

Reviewed By: yungsters

Differential Revision: D54668281

fbshipit-source-id: b14757744bb7a21a4e5573053549c36178826021
2024-03-07 23:19:27 -08:00
Rick Hanlon ed32b4ba0a Organize component stack regexes better (#43371)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43371

This file has a lot of regexes, let's organize and comment them all.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D54638520

fbshipit-source-id: eed61133758ccefd2a640f121c4da214bcad4880
2024-03-07 23:15:55 -08:00
Rick Hanlon adaf5eba3e Fix component stacks for tsx, ts, and jsx files (#43370)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43370

Component stacks with files ending in .ts, .tsx, or .jsx were skipped in LogBox reporting. This diff fixes the regex.

Changelog:
[General][Fixed] - Support .tsx, .ts, and .jsx in component stacks

Reviewed By: yungsters

Differential Revision: D54638526

fbshipit-source-id: a5271daaa7b687e8e075be3f94ab9b9c03f79b66
2024-03-07 23:15:55 -08:00
Vojtech Novak 2d547a3252 feat: RCTConvert to support UIModalPresentationStyle (#43297)
Summary:
Currently, the ability to convert JS values to `UIModalPresentationStyle` is not present directly on `RCTConvert`.

In the RN code base itself, there's not a lot of need to do this type of conversion, but in community modules, presenting ViewControllers can be a fairly common scenario and it'd be nice to be able to use this conversion directly from `RCTConvert`, rather than from `RCTModalHostViewManager`, as it'd improve its "discoverability" and consistency.

If someone relied on this, then it's technically speaking a breaking change but I'd say it's for the better, and searching `#import <React/RCTModalHostViewManager.h>` on github doesn't reveal a lot of results.

## Changelog:

[IOS] [ADDED] - RCTConvert to support UIModalPresentationStyle

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

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

Test Plan:
Tested using RN Tester

https://github.com/facebook/react-native/assets/1566403/6e62df86-dde3-47b0-b2e9-bb6b483cadf6

Reviewed By: fkgozali

Differential Revision: D54635896

Pulled By: dmytrorykun

fbshipit-source-id: c6747857830762cd0333c31c287954f3f10d4954
2024-03-07 18:05:34 -08:00
Alex Taylor (alta) 9b1c486e40 Deploy 0.230.0 to xplat (#43373)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43373

Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D54640661

fbshipit-source-id: 6d09ec126ea55bbe0d7a6b3a2823b1a0ffef7d21
2024-03-07 15:27:50 -08:00
Dmitry Rykun ff03b149e7 Use fs.cpSync instead of execSync('cp ... (#43368)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43368

This diff replaces direct invocation of the `cp` command with the platform agnostic `fs.cpSync`.
Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D54634108

fbshipit-source-id: 41fe7b44b6534026ef1b930da85725bf3eb1e7bb
2024-03-07 09:19:09 -08:00
Adam Ernst f7bbaffdc3 Apply RN_EXPORT to ReactNativeFeatureFlags functions (#43356)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43356

To make it accessible across different dylib/bundle.

Changelog: [Internal]

Reviewed By: d16r

Differential Revision: D54601288

fbshipit-source-id: e65b724b228a680784e81b8c51ecd3f4df3fd668
2024-03-06 20:09:49 -08:00
Arushi Kesarwani c771011fed Support onActivityResult in Bridgeless (#43351)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43351

Implement `onActivityResult` on Bridgeless

Changelog:
[Internal] internal

Reviewed By: cortinico

Differential Revision: D54574139

fbshipit-source-id: f2369077199186ac6ef0187b5dfe7ed95f3b87fc
2024-03-06 13:19:55 -08:00
Rubén Norte c645646a20 Create new flag to disable the last part of the notifications for mount hooks on Android (#43349)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43349

Changelog: [internal]

We still haven't found the root cause of some of the crashes we're seeing in the experiments to enable mount hooks on Android.

This adds a new feature flag to skip part of the mount hooks pipeline to see if we can scope the investigation to that specific part (where we query the root tree in the base revision from the mounting coordinator).

Reviewed By: sammy-SC

Differential Revision: D54587739

fbshipit-source-id: 792aa8b06808e96638d1bba072bf4060ec492bd2
2024-03-06 12:41:49 -08:00
Rubén Norte fafd64e9c3 Migrate mount hooks flag to new system (#43350)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43350

Changelog: [internal]

Mount hooks have been shipped on iOS, so this removes the flag for them.

On Android, we're still testing them so it's worth moving them to the new system and scoping them to that platform.

Reviewed By: sammy-SC

Differential Revision: D54587740

fbshipit-source-id: d074927fee1a967bd3928970c31975d07cd393bb
2024-03-06 12:41:49 -08:00
Rubén Norte a66f4450e5 Improve logic to report mounted surfaces (#43337)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43337

Changelog: [internal]

Mount instructions and listeners are only called from the UI thread, so there's no need to have synchronization mechanisms for concurrency.

We're also scheduling mount hooks notifications once, but subsequent calls are ignored instead of accumulated to be notified together. This also changes that to collect all the surface IDs in the array that is read on notification.

Reviewed By: sammy-SC

Differential Revision: D54547194

fbshipit-source-id: a861e3b0113914aae5325c1486bcf8acd50eef79
2024-03-06 12:41:49 -08:00
D N 028615180b Add missing Headers methods (#43279)
Summary:
```tsx
// Hermes runtime (RN 73.x)
console.log({...Headers.prototype})
// result:
{
  "append": [Function anonymous],
  "delete": [Function anonymous],
  "entries": [Function anonymous],
  "forEach": [Function anonymous],
  "get": [Function anonymous],
  "has": [Function anonymous],
  "keys": [Function anonymous],
  "set": [Function anonymous],
  "values": [Function anonymous],
  Symbol(Symbol.iterator): [Function anonymous]
}
```

But in typescript

```tsx
new Headers().entries()
// ^^^ Error: Property entries does not exist on type Headers
Object.fromEntries(new Headers())
// ^^^ Error: Property [Symbol.iterator] is missing in type Headers but required in type Iterable<readonly any[]>
```

## Changelog:

[GENERAL] [ADDED] - [TypeScript] Add missing `Header` methods

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

Test Plan: Use code above in your RN project and run `yarn tsc --noEmit`

Reviewed By: rshest

Differential Revision: D54554523

Pulled By: arushikesarwani94

fbshipit-source-id: ae7f05f9526771ff003aaf22f786b5503661c739
2024-03-06 11:07:48 -08:00
Rob Hogan 3ed0ff34b3 Add helpers for formatting JSON CDP responses (#43340)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43340

Adds convenience methods `jsonResult`, `jsonError` and `jsonNotification` for more ergonomic construction of CDP JSON responses. Note that CDP is *loosely* based on [JSON-RPC 2.0](https://www.jsonrpc.org/specification), but differs for example in the  omission of `"jsonrpc": "2.0"`.

Before:
```
frontendChannel_(folly::toJson(folly::dynamic::object("id", req.id)(
            "error",
            folly::dynamic::object("code", -32602)(
                "message",
                "executionContextName is mutually exclusive with executionContextId"))));
```

After:
```
frontendChannel_(cdp::jsonError(
            req.id,
            cdp::ErrorCode::InvalidParams,
            "executionContextName is mutually exclusive with executionContextId"));
```

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D54202854

fbshipit-source-id: 76a407ae39ff9c2ec79bcaddb6cd4d494afb7693
2024-03-06 09:27:50 -08:00
Samuel Susla 9426d249cb delete butter module (#43300)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43300

changelog: [internal]

not used, let's delete

Reviewed By: fkgozali

Differential Revision: D54462125

fbshipit-source-id: f6cb5199e00e139c0340ad5c7b338acfb99f0d15
2024-03-06 08:38:55 -08:00
Rick Hanlon 82db330360 Fix parseLogBoxLog test that test hermes component stacks (#43281)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43281

## Overview
This diff fixes a bug in the hermes component stack location parser, and fixes the hermes component stack tests which were not using hermes stack parsing, which is why the bug wasn't caught.

The bug fix is that React component stacks may not all have stack frame locations. For example, this stack:

```
at MyComponent (/path/to/filename.js:1:2)
at MyOtherComponent                         <-- no location
at MyAppComponent (/path/to/app.js:100:20)
```

This can happen when we're unable to make a component throw (e.g. it doesn't use a hook or access props). We have plans to fix these frames, but currently they can exist.

The bug was when `parseHermesStack` finds a frame without an `entry`, it would reset the `entries`. But if entries is already non-null, or if the current frame is a frame without a source, we should continue.

### Caveats

The handling here fixes the behavior to go back to skipping these frames. I'm not sure what the best way to handle these cases are, since these frames do not have source location and should skip symbolication. We should follow up with handling for these frames.

## Why it wasn't caught

In D18627930 we changed the hermes component stack parsing to check `global.HermesInternal`, but the tests for the hermes component stacks were still using the `stacktrace-parser`. I updated the tests to set/reset the global, which caught the bug.

Changelog:
[General][Fixed] - Support hermes component stacks with missing source info.

Reviewed By: yungsters

Differential Revision: D54423252

fbshipit-source-id: 80ded8b99eab919e60f847369dcb1f3afa72b6be
2024-03-06 07:44:01 -08:00
Oskar Kwaśniewski b2fba371df feat: optimize RCTKeyWindow() for iOS 15+ (#43066)
Summary:
This PR further optimizes RCTKeyWindow() for iOS 15+ removing the need for additional loop
bypass-github-export-checks
## Changelog:

[IOS] [ADDED] - optimize RCTKeyWindow() for iOS 15+

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

Test Plan: Launch RNTester, check if proper keyWindow is returned for iOS 15+

Reviewed By: javache

Differential Revision: D54541838

Pulled By: cipolleschi

fbshipit-source-id: be79ff48f825d10c8fd71efc18629377aadc29fd
2024-03-06 07:07:53 -08:00