Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49726
The `InspectorProxy` debug logging became incredibly spammy making it almost unuseful unless the output is manipulated so this commit batches all these cdp messages and only desplays how many were received in the span of 5s. If no messages are received, the throttle is not triggered.
To get the actual CDP messages logged, we still log these to `Metro:InspectorProxyCDPMessages`.
Changelog:
[General][Internal] batch debug logging for cdp messages
Reviewed By: robhogan
Differential Revision: D70324724
fbshipit-source-id: a269302f52e18af6c4be651758c042596abdbad8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49753
Sonatype cannot sign folders. It needs a file to be signed.
To make it happen, we are compressing the xcframeworks and the dSYM with tar, and we are uploading those files instead of the folders
I also observed that the cache keys were not computed correctly, so I'm fixing them.
## Changelog:
[Internal] - use tar.gz instad of folders for dSYM and xcframeworks
Reviewed By: bvanderhoof, mofeiZ
Differential Revision: D70409314
fbshipit-source-id: 20a5ee4f24b644f4f087974ad6b0831d5769b1d9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49749
This change configures gradle and CI to properly publish the RNDependencies artifacts to Maven Central
## Changelog
[Internal] - Configure gradle to publish on Maven Central
Reviewed By: cortinico
Differential Revision: D70390191
fbshipit-source-id: fc1e1070325240584cb07fb17e58118c4c583fa9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49711
Changelog: [IOS][CHANGED] - Moved workaround for multiline text measurement with `maximumNumberOfLines` earlier in the pipeline
Reviewed By: huntie
Differential Revision: D70314397
fbshipit-source-id: ef7dbf0c4bb3d5053328d81b7d5b8208e92ee7f5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49680
changelog: [internal]
add an end to end test for AppState module.
Reviewed By: rshest
Differential Revision: D70184850
fbshipit-source-id: ead1388ceb1018e7615e50f846f3c95224be97d0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49643
## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.
## This diff
Aligns `useAnimatedValue.js` with its manual .d.ts types.
Changelog: [Internal]
Reviewed By: huntie
Differential Revision: D70096210
fbshipit-source-id: c3cd517eccf1cb68400772ddde6e5891861c927d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49741
While the test delay `PAGES_POLLING_DELAY` is usually enough to be equal to `PAGES_POLLING_INTERVAL`, in some cases we need extra time to sync that with the polling in `Devices.js`.
Changelog:
[General][Internal] - fix test
Reviewed By: huntie
Differential Revision: D70384823
fbshipit-source-id: ccb18884d32dc27636dbbb3a9786412056f90830
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49730
Changelog: [internal]
This removes all the types from "bom" that are actually not implemented in RN. For now, we're just stripping whole interfaces and not looking into specific methods/properties in interfaces that we do implement but not 100%.
`Performance`, `PerformanceObserver`, `MutationObserver` and `IntersectionObserver` are implemented but not stable yet, so they aren't exposed as globals in the types.
Reviewed By: huntie
Differential Revision: D70329185
fbshipit-source-id: 63bac619e100ca66b41df071df80dfa73d0f9651
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49737
Changelog: [internal]
Just a minor change to align with similar other option bags and TypeScript definitions.
Reviewed By: huntie
Differential Revision: D70355669
fbshipit-source-id: 37c44338c7b358eb2d25e8a14c75a78545b34bf1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49727
Changelog: [internal]
React Native doesn't define or use Service Workers, so this entire section for types is unnecessary.
Reviewed By: cortinico
Differential Revision: D70327703
fbshipit-source-id: b998eade21d19ed124824cb255a37cb9e805d151
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49724
Changelog: [internal]
This moves the type definitions for the globals defined by React Native from the repository root to the `react-native` package, in the same directory as the existing TypeScript definitions. This will make it easier for end users to configure the globals from RN using the right source of truth.
Reviewed By: huntie
Differential Revision: D70322032
fbshipit-source-id: 932df75ded0c254f2acb32e865cbbb9474c94159
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49685
## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.
## This diff
Renames `Animated.js` to `AnimatedExports.js`, and introduces an intermediate file that reexports `* as Animated` as a default. This should have equivalent runtime behavior, but allows for a common interface file: `Animated.js.flow` to reinterpret the module as having single exports. TypeScript treats this as a namespace.
Changelog: [Internal]
Reviewed By: huntie
Differential Revision: D70237239
fbshipit-source-id: f552490cb6bb721c6163272689ec9b6c68386574
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49738
**Context**
- D70012142 added TM module provider support
- This was causing RN MacOS to silently fail to load any platform modules since it didn't implement the delegate method
Changelog:
[iOS][Fixed] - Add guard for custom module provider lookup in TMManager
Reviewed By: sbuggay
Differential Revision: D70357542
fbshipit-source-id: 5b338616655ecb84cdb3c60e243fdb99444af657
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49735
I always get confused when I open this file. One of the main reasons is the order of contents is quite random, so I decided to reorder things. I tried to find a style guide on this but the [google ones](https://google.github.io/styleguide/javaguide.html#s3.4.2-ordering-class-contents) really just say do something that is logical so...
In general what I did was
* All instance variables, class variables, class constants, etc. are at the top of the class
* The constructor, `setDelegate`, `resetDelegate` methods are at the top of the class since these all deal with creating or destroying instances of this class
* Nested enums towards the bottom of the class so they are not in the way of people trying to reason about the methods and other contents (they are quite long)
* Delete random extra spaces / unneeded comments
* Move some private methods to be closer to the public methods that call them
Changelog: [Internal]
Reviewed By: mlord93
Differential Revision: D70345882
fbshipit-source-id: a8425c7b90c5d4fbea5ee5daa3c4ff9f7f189ce5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49649
- Added a new template to React Native's Feature Flag's script for Canary and Experimental prerelease stages
- Added a parameter to `DefaultNewArchitectureEntryPoint.kt` to select prerelease stage
Changelog: [Android] [Added] - On `DefaultNewArchitectureEntryPoint` class add property to specify the desired release level for an application
Reviewed By: rubennorte, mdvacca
Differential Revision: D69412971
fbshipit-source-id: 1a76ac723e1e06b40aad5910604e0384b208d3a5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49729
# Changelog: [Internal]
The only data source for non-bridgeless setup is JavaScript samples.
Chrome DevTools frontend is built around an assumption that thread should have at least single timeline or user timing event to be represented on a timeline view. They do it for filtering out unnecessary workers threads and other.
We will emit 2 synthetic Trace Events that should cover these requirements and recorded traces that contain only JavaScript samples should now be displayed correctly.
This is where trace bounds are calculated - https://github.com/facebookexperimental/rn-chrome-devtools-frontend/blob/3adf51aa915c2deb26f5d373751a15b4d0c8f259/front_end/models/trace/handlers/MetaHandler.ts#L169-L173
Reviewed By: huntie
Differential Revision: D70328681
fbshipit-source-id: 8eca0017d85de9ecbfb49074b439d5c4fee4aa56
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49624
This change improves the iOS infra so that there is no need to modify the Swift AppDelegate or to create a Bridging Header.
## Problem
As of today, it is not possible to create a pure C++ TM and to register it through a Swift AppDelegate
## Solution
We can create a pod that can be imported in a Swift AppDelegate and that offer some pure Objective-C classes.
These classes contains a provider that can be instantiated in Swift.
The TurboModule manager delegate will ask the AppDelegate about the presence of some provider that can instantiate a pure C++ turbomodule with a given name.
The provider has an empty interface, but the implementation contains a function that can actually instantiate the TM. The function is implemented in an Objective-C++ class that imports the pure C++ turbomodule and creates it.
The TMManager extends the provider through a category to attaach the signature of the function that is implemented by the provider.
The last diff in this stack contains an exaple on how to implement this.
## Changelog:
[iOS][Added] - Wire codegen to the new TM provider to automatically register CXX modules.
Reviewed By: javache
Differential Revision: D70082999
fbshipit-source-id: 11d829450e1d17984d6f22ee5b8907073c59d008
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49611
This Change connects the pod created previously to the `RCTTuboModuleManager` so that it can ask the delegate about the CxxTurboModuleProviders.
We had to introduce a `RCTFullTurboModuleManagerDelegate` that implements both the old `TurboModuleManagerDelegate` and the new Swift compatible one.
## Problem
As of today, it is not possible to create a pure C++ TM and to register it through a Swift AppDelegate
## Solution
We can create a pod that can be imported in a Swift AppDelegate and that offer some pure Objective-C classes.
These classes contains a provider that can be instantiated in Swift.
The TurboModule manager delegate will ask the AppDelegate about the presence of some provider that can instantiate a pure C++ turbomodule with a given name.
The provider has an empty interface, but the implementation contains a function that can actually instantiate the TM. The function is implemented in an Objective-C++ class that imports the pure C++ turbomodule and creates it.
The TMManager extends the provider through a category to attaach the signature of the function that is implemented by the provider.
The last diff in this stack contains an exaple on how to implement this.
## Changelog:
[iOS][Added] - Added the React-SwiftCompatibleNativeModules pod
Reviewed By: javache
Differential Revision: D70012142
fbshipit-source-id: db96c4cd3cdd1062b12f11131b7c6c51ecd74bc7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49712
Just keeping AGP up to date to the latest patch version
Changelog:
[Android] [Changed] - Bump AGP to 8.8.2
Reviewed By: cipolleschi
Differential Revision: D70316244
fbshipit-source-id: 6e447bd04841d09717a1c6153b7e5c977a10787c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48315
# Changelog: [Internal]
> NOTE: Some CI jobs are expected to fail, because changes in Hermes D67353585 should be landed first, and then grafted to Static Hermes.
Use newly added serializer and record Trace Events for profiles.
Reviewed By: huntie
Differential Revision: D67353586
fbshipit-source-id: f3738418ec1d47ef4435f00120823845ea5e2fe5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49191
# Changelog: [Internal]
In this diff we are adding another serializer, that will receive local sampling profile (in tracing domain), and will record corresponding Trace Events with `PerformanceTracer`.
It encapsulates the logic of transforming list of samples to `"Profile"` and `"ProfileChunk"` trace events, which will be parsed by Chrome DevTools later.
Reviewed By: huntie
Differential Revision: D68439735
fbshipit-source-id: 0b3f2b3aff5b79a921e0350759e93f5b05e34d8e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49084
# Changelog: [Internal]
> NOTE: Some CI jobs are expected to fail, because changes in Hermes D67353585 should be landed first, and then grafted to Static Hermes.
Added public methods to `PerformanceTracer` instance for registering `Profile` and `ProfileChunk` Trace Events.
Also created data structs in `TraceEvent.h` to simplify serialization process for objects like call frames / samples / etc.
Reviewed By: huntie
Differential Revision: D68558805
fbshipit-source-id: f5eca0435c56828909f99ec0b47841d24ee907b6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49082
# Changelog: [Internal]
> NOTE: Some CI jobs are expected to fail, because changes in Hermes D67353585 should be landed first, and then grafted to Static Hermes.
In this diff we will:
- Call newly added API in Hermes from `HermesRuntimeTargetDelegate.cpp`
- Define format for local Sampling Profile that will be used in Tracing domain
- Implement formatter for Hermes Profile -> Tracign Profile
Reviewed By: bgirard
Differential Revision: D68414421
fbshipit-source-id: 05d76e9bcff46f88a2338490a9d858cb121f72cc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49436
# Changelog: [Internal]
We will record event loop ticks and register corresponding `"RunTask"` Trace Event with our Trace Event engine.
Since this is hot path, I've added some gating under macros that are being used for Fusebox initialization.
There are also plans to add a public method to `PerformanceTracer` to get tracing status, so we could avoid cost of serialization / saving timestamps if trace is not being recorded. I believe rubennorte had plans on this, we will add it on top of that.
> Q: Why not add this to TraceSection?
Long-term, we will have a solution that will be one layer above TraceSection and this `EventLoopTaskReporterRAII`, it is risky now to modify existing `TraceSection` and rely on event names and attempt to map them to Trace Events.
Reviewed By: rubennorte
Differential Revision: D69399955
fbshipit-source-id: b26ac0c376e7dcb5755f36a27bf00dcca6cbff60
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49395
# Changelog: [Internal]
Adding a new method to `RuntimeTarget` that will register it for Tracing.
In our case, it will schedule a callback on JS executor that will register JavaScript thread with `PerformanceTracer`.
Reviewed By: huntie
Differential Revision: D69530984
fbshipit-source-id: 58cffe9e9c4482b494cfcfd3405f7bffa40cdc56
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48836
# Changelog: [Internal]
When `Tracing.start` CDP method is received, here is what happens next:
- `TracingAgent`, which intercepts the event will propagate this status to `Instance` by calling `startTracing()` on `InstanceAgent`.
- `InstanceAgent` will propagate it to `Runtime` entities. The only difference, there is no concept of tracing for Runtime, it will only have an API for starting sampling profiler.
When `Tracing.end` CDP method is received, it is propagated in the same order.
There is also `collect*()` methods for collecting profiles.
This has multiple benefits:
- We can control when `Runtime` or `Instance` are recreated and can ask them to start recording trace profiles right away. This may be required when we would add support for Reload and Profile from Performance panel.
- We might leverage this setup in the future, once we add instrumentation for Network panel. `InstanceAgent` will get notified when tracing started and will correspondingly notify other part of the infrastructure that will be responsible for recording network calls.
- We remain being fully agnostic to the actual `Runtime`, see corresponding `RuntimeTargetDelegate` for `V8`. We don't have the capacity for implementing and maintaining sampling profiler capabilities for it, but this approach unblocks it from technical perspective, if someone would want to invest into this.
`InstanceProfile` is a superset of `RuntimeSamplingProfile`. In the future, `InstanceProfile` may also include things like `NetworkProfile`, or similar stuff.
The definition for `RuntimeSamplingProfile` will be added in D68414421 and relies on the availability of new API for sampling profiler in Hermes.
Reviewed By: huntie
Differential Revision: D68327630
fbshipit-source-id: f8446057f88d87b4394fb692c28b89f1b8ce4eea
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49714
Changelog: [internal]
This package was only needed for testing but it's actually not used.
Reviewed By: hoxyq
Differential Revision: D70318040
fbshipit-source-id: b57ec74932029368117520646972bfee83706017
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49693
Allow setting the ReactNativeInternalFeatureFlags from a Fantom test using the `fantom_internal_flags` pragma.
Changelog: [Internal]
Reviewed By: rubennorte
Differential Revision: D70242739
fbshipit-source-id: 17a69edbd58b93f8b8060192b9881e62febf9635
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49697
Changelog: [internal]
These classes cannot be instantiated directly, but having access to them allows users to do `instanceof` checks, e.g.:
```
if (ref.current instanceof Element) {
ref.current.getBoundingClientRect();
}
```
Reviewed By: yungsters
Differential Revision: D70244966
fbshipit-source-id: 3c1e3698b8851ef9ce3c2865e7435b000984c8f0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49696
Changelog: [internal]
This is just a change for convenience, as Flow is currently typing `textContent` in `Node` as `string` instead of as `string | null` as we were doing.
Our behavior was more correct, as `Document` extends `Node` and it returns `null` in that case, but to ensure a smooth migration we'll adopt the existing definition.
Reviewed By: huntie
Differential Revision: D70244963
fbshipit-source-id: ad8325d6e00c221e858e4e2d45085666ff0a0ce7
Summary:
Solves the iOS part of https://github.com/facebook/react-native/issues/47186.
`onContentSizeChanged` event is sent inside the `updateLayoutMetrics` method every time it's invoked. A change in layout metrics doesn't mean that the content size also changes, like changing the position of the input.
This PR adds a condition that the content size must have changed before sending the event.
|Before this change|After this change|
|-|-|
|<video src="https://github.com/user-attachments/assets/743e1502-e13e-474e-b4a6-ef6873bf9619">|<video src="https://github.com/user-attachments/assets/fe3d3ef5-3951-4ba2-b9a1-c41439ab455c">|
In the reproducer from the issue, `SafeAreaView` is used, which at first renders its content without any insets until its state is updated with the correct insets. Both of these layouts change the layout metrics of the text input, resulting in two events before this change and a single one after.
## Changelog:
[IOS] [FIXED] - Fixed TextInput's `onContentSizeChange` event being dispatched multiple times with the same size
Pull Request resolved: https://github.com/facebook/react-native/pull/49695
Test Plan: Tested on the reproducer from the issue
Reviewed By: NickGerleman
Differential Revision: D70247460
Pulled By: j-piasecki
fbshipit-source-id: 8a1e0d0f55b6b3f8a6d0bb176ed50e47e3b51035
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49699
Changelog: [internal]
Just a minor optimization in `ReactNativeElement`, to stop creating an unnecessary object in the prototype chain for the `super()` removal optimization.
Reviewed By: huntie
Differential Revision: D70250804
fbshipit-source-id: 1f8104f8e17f12264326cd715e07877a371f9dc5
Summary:
This PR implements a C API to switch JS Engines that can be used from Swift.
Here is an example:
```swift
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
import UIKit
import RCTRuntime
class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
override func sourceURL(for bridge: RCTBridge) -> URL? {
self.bundleURL()
}
override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
}
override func createJSRuntimeFactory() -> JSRuntimeFactory {
jsrt_create_jsc_factory() // Easily switch engines here
}
}
```
## Changelog:
[IOS] [ADDED] - js runtime C API for Swift
Pull Request resolved: https://github.com/facebook/react-native/pull/49489
Test Plan: CI Green
Reviewed By: huntie
Differential Revision: D69976988
Pulled By: cipolleschi
fbshipit-source-id: 9333ec62ca99a28c3121f558bbff1ce0457779e3
Summary:
This change refactors the script to prebuild ios dependencies by:
- remove the manually maintained Package.swift
- add script to generate it starting from the configurations that we have
bypass-github-export-checks
## Changelog:
[INTERNAL] - Factor out script to generate Package.swift file
Reviewed By: cortinico
Differential Revision: D70175760
Pulled By: cipolleschi
fbshipit-source-id: a1b0fc6dcdc1860b04ab260697f259c297338f41
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49657
For some use-cases we still want to log using the internal fbsystrace API which allows backdating of events.
This feels a bit weird putting it in `ReactPerfettoLogger`, but maybe we should rename that to something like `TraceLogger` (like we have `TraceSection`).
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D70109680
fbshipit-source-id: 7757b81ec5032e3800446a88198c7da135afdd0e