Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43448
## Changelog:
[Internal] -
This adds a stub for `TextLayoutManager.measureCachedSpannableById`, as well as a missing explicit dependency to `jni/react/jni` from the `TextInput` implementation on the Android platform.
This is required in order for certain build configurations to compile.
Reviewed By: andrewdacenko
Differential Revision: D54807518
fbshipit-source-id: 206f0edb03a4ed328a962e57d1e791614eb7f851
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43450
Changelog: [Internal]
This is just to make sure that all instances of `LongLivedObjectCollection` map can be safely accessed by multiple threads.
Reviewed By: RSNara
Differential Revision: D54801015
fbshipit-source-id: e0b15bfbeac9ce3a1051f83a59c5513a90ba2a4b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43392
## Context
We are migrating to the new Hermes `CDPAgent` and `CDPDebugAPI` APIs in the modern CDP server (previously `HermesCDPHandler`).
## This diff
Wires up `previouslyExportedState` with `CDPAgent`, and re-enables the `ResolveBreakpointAfterReload` integration test.
Changelog: [Internal]
Reviewed By: motiz88
Differential Revision: D54369985
fbshipit-source-id: 5dcb4fe59b8b36b2db9f0385e8487097822e5704
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43437
## Changelog:
[iOS][Removed] - remove EventPriority class and always use the default EventPriority::AsynchronousBatched. This is potentially a breaking change if something in OSS sets a different priority. If a build fails because of this, simply remove the use of EventPriority.
EventPriority::AsynchronousBatched is the default and none of the other priorities are used anymore. This is the first step of removing this concept from the codebase.
Reviewed By: NickGerleman
Differential Revision: D54684311
fbshipit-source-id: 18240e5ee84f489f43b15fd9aab43f3b1b1b4963
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43398
Implement onWindowFocusChange in Bridgeless by adding it to the ReactHostImpl
Changelog:
[Android][Breaking] Implement onWindowFocusChange in Bridgeless
Reviewed By: javache
Differential Revision: D54670119
fbshipit-source-id: 71f560e5a3bf0e853ac06955e67b8035f1ec0468
Summary:
X-link: https://github.com/facebook/yoga/pull/1593
Pull Request resolved: https://github.com/facebook/react-native/pull/43417
There was a bug where we did not position absolute nodes correctly if the static node had a different main/cross axis from the containing node. This fixes that. The change is somewhat complicated unfortunately but I tried to add sufficient comments to explain what is happening
Reviewed By: NickGerleman
Differential Revision: D54703955
fbshipit-source-id: 096c643f61d4f9bb3ee6278d675ebd69b57350d7
Summary:
## Changelog:
[General][Fixed] - Fix broken native animation in Paper
In Native Animated Paper, `scheduleUpdate` must not be called. In Fabric, the synchronisation between Fiber and Shadow trees is a must but in Paper it sets undesired state.
Reviewed By: javache
Differential Revision: D54799237
fbshipit-source-id: f6b07dc377111ed2f8253ea0c7c7e312168166e8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43444
Re-enable a test now that D54649943 added correct handling of stale execution context IDs.
NOTE: There's a minor difference in returned error code. The test now allows either, though note that the old implementation is more consistent with Chrome itself which returns -32000 (server error). Semantically -32600 (invalid request) seems more appropriate.
Changelog: [Internal]
Reviewed By: huntie
Differential Revision: D54805777
fbshipit-source-id: eb2baadf6b35319f5331462425eaa38b4edfab28
Summary:
This is a proposal for the `react-native/dev-middleware` package, to allow implementers to extend the CDP capabilities of the `InspectorProxy`. It's unfortunately needed until we can move to the native Hermes CDP layer.
At Expo, we extend the CDP capabilities of this `InspectorProxy` by injecting functionality on the device level. This proposed API does the same, but without having to overwrite internal functions of both the `InspectorProxy` and `InspectorDevice`.
A good example of this is the network inspector's capabilities. This currently works through the inspection proxy, and roughly like:
- Handle any incoming `Expo(Network.receivedResponseBody)` from the _**device**_, store it, and stop event from propagating
- Handle the incoming `Network.getResponseBody` from the _**debugger**_, return the data, and stop event from propagating.
This API brings back that capability in a more structured way.
## API:
```ts
import { createDevMiddleware } from 'react-native/dev-middleware';
const { middleware, websocketEndpoints } = createDevMiddleware({
unstable_customInspectorMessageHandler: ({ page, deviceInfo, debuggerInfo }) => {
// Do not enable handler for page other than "SOMETHING", or for vscode debugging
// Can also include `page.capabilities` to determine if handler is required
if (page.title !== 'SOMETHING' || debuggerInfo.userAgent?.includes('vscode')) {
return null;
}
return {
handleDeviceMessage(message) {
if (message.type === 'CDP_MESSAGE') {
// Do something and stop message from propagating with return `true`
return true;
}
},
handleDebuggerMessage(message) {
if (message.type === 'CDP_MESSAGE') {
// Do something and stop message from propagating with return `true`
return true;
}
},
};
},
});
```
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[GENERAL] [ADDED] - Add inspector proxy device message middleware API
Pull Request resolved: https://github.com/facebook/react-native/pull/43291
Test Plan: See added tests and code above
Reviewed By: huntie
Differential Revision: D54804503
Pulled By: motiz88
fbshipit-source-id: ae918dcd5b7e76d3fb31db4c84717567ae60fa96
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43397
Changelog: [internal]
This migrates the Hermes-specific use of microtasks to an engine agnostic implementation based on the new JSI method to queue microtasks.
Reviewed By: sammy-SC
Differential Revision: D54687056
fbshipit-source-id: b077ba47b80f7b31c77b7e449def8a56061b0b69
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43395
Changelog: [internal]
This moves native module specs to `specs` directory to align with the general convention.
Reviewed By: cortinico
Differential Revision: D54680056
fbshipit-source-id: 8b6ae6187e2ffa9120159b7d1fa25957677e0f4f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43394
Changelog: [internal]
When we built the new feature flag system we added a constraint in the JS API to prevent calling `override` if any of the flags was already accessed from JS.
This is very restrictive because it doesn't allow us to access common flags (like `enableMicrotasks`) set up from native during the initialization of the framework because then applications wouldn't be able to set JS-only overrides.
This relaxes the constraint to disallow accessing JS-only flags before setting JS-only overrides, but accessing common (native) flags before that is ok.
Reviewed By: rshest
Differential Revision: D54687055
fbshipit-source-id: b0716f24baf7d12a5e4a61fba79e6b50ef0ad10a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43393
Changelog: [internal]
The generator doesn't create intermediate directories, which is causing issues now that we're moving the generated native module spec to a new directory.
This fixes that.
Reviewed By: rshest
Differential Revision: D54690126
fbshipit-source-id: 1ba0d821872da7bbe1f6120ef6d0c1f800326778
Summary:
At Expo, we use [Expo Tools](https://github.com/expo/vscode-expo/blob/main/src/expoDebuggers.ts) to connect the [built-in vscode-js-debug](https://github.com/microsoft/vscode-js-debug) to Hermes.
Since there are a few differences in vscode vs chrome devtools, we need to enable a couple of modifications through the [`customMessageHandler` API](https://github.com/facebook/react-native/pull/43291). Unfortunately, vscode itself doesn't set the `user-agent` header when connecting to the inspector proxy. Becuase of that, we'd need a fallback to "manually" mark the debugger as being vscode ([we use this query parameter here](https://github.com/expo/vscode-expo/blob/main/src/expoDebuggers.ts#L208)).
This PR supports setting the `user-agent` through `?userAgent=` when the header is not set.
## 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] [ADDED] - Fallback to query parameter based `user-agent` when header is unset
Pull Request resolved: https://github.com/facebook/react-native/pull/43364
Test Plan:
- Install [Expo Tools](https://marketplace.visualstudio.com/items?itemName=expo.vscode-expo-tools)
- Start Metro with this change.
- Connect a device.
- Run the vscode command `"Expo: Debug Expo app ..."`
- Debugger should connect, and have it's user-agent marked as:
`vscode/1.87.0 vscode-expo-tools/1.3.0`
Reviewed By: huntie
Differential Revision: D54804556
Pulled By: motiz88
fbshipit-source-id: 1ff558ba5350811ad042d08a713438e046759feb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43408
Changelog: [internal]
I think mount operations are taking longer than expected because of a debugging block (that we might remove). This adds some systrace sections to distinguish that from the overall time and confirm this only happens in debug builds.
Reviewed By: sammy-SC
Differential Revision: D54746491
fbshipit-source-id: 317b22b6dcd1ae117ed4a013180df8842bf712f0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43436
## Context
We are migrating to the new Hermes `CDPAgent` and `CDPDebugAPI` APIs in the modern CDP server (previously `HermesCDPHandler`).
## This diff
Expands test coverage for the Hermes `CDPAgent` implementation by enabling in `ReactInstanceIntegrationTest`.
Changelog: [Internal]
bypass-github-export-checks
Reviewed By: motiz88
Differential Revision: D54801168
fbshipit-source-id: 9b71f8e697c7ab24c1383100938b3f648774a106
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43429
changelog: [internal]
these experimental props have served their purpose and can be deleted.
Reviewed By: rubennorte
Differential Revision: D54682805
fbshipit-source-id: aee5072e2aa056c862f369426617d0d51c98997f
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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