Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46806
This fixes the CI which is currently red due to wrong C++ imports.
Changelog:
[Internal] [Changed] - Unbreak build_android
Reviewed By: javache, cipolleschi
Differential Revision: D63826953
fbshipit-source-id: 4d9e407331af666a420cf56178420df40e598ef4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46794
Original commit changeset: f57e9a51236c
Original Phabricator Diff: D63430964
Seeing some issues with this so gonna turn it off for the meantime.
Changelog: [Internal]
Differential Revision: D63777437
fbshipit-source-id: fe8abd0110b2cf7296911c5b1e95ada40d30994c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46795
Original commit changeset: d7bb6f115bca
Original Phabricator Diff: D63471840
See previous diff, there were some problems
Changelog: [Internal]
Differential Revision: D63777438
fbshipit-source-id: ea9f370eade10282fcee84d07d709b549dde1b6d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46736
Copying the comment in code:
> We only call `onEndReached` after we render the last cell, but when getItemLayout is present, we can scroll past the last rendered cell, and never trigger a new layout or bounds change, so we need to check again after rendering more cells.
Changelog:
[General][Fixed] - Fix onEndReached not being called when getItemLayout is present and we scroll past render window
Reviewed By: yungsters
Differential Revision: D63643856
fbshipit-source-id: 9c53789cb15b225ceac353c37cbb67f7beeaf4fb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46793
Currently performance logging has several problems:
- We have widly different APIs. It's hard to know which to use for what.
- Most of these APIs don't allow retroactive timestamp which is important for hero logging and react flame graphs
- These APIs aren't accessible from JS/C++/Java/Koltin (this part will be fixed in another diff)
- Logging doesn't go to the right place. It either only goes to Systrace, or Perfetto but with broken async timeline etc...
This diff start addressing the problem by refactoring. Currently performance.measure/performance.mark are the best APIs. Let's start with refactoring them so that we can call them directly without the otherwise PerformanceEntry side effects.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D63560473
fbshipit-source-id: 86755b3e8491a7cf6919173a07ba9421cd30e663
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46788
Changelog: [internal]
This fixes the reported keys for C++ TurboModules:
```
import MyNativeCppModule from 'MyNativeCppModule';
Object.keys(MyNativeCppModule); // [] - expected
Object.keys(Object.getPrototypeOf(MyNativeCppModule)); // [] - NOT expected
```
Before, we were trying to read the properties from the method map in the public `TurboModule`, but in this implementation all the logic is actually in its delegate (also a `TurboModule` instance, yeah, confusing).
This fixes the issue by forwarding the call to the delegate that has the right information.
Reviewed By: javache
Differential Revision: D63761381
fbshipit-source-id: 90bd216efa0f60352c5ca341d210d83239c80dba
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46785
changelog: [internal]
Make sure logs match the class name
Reviewed By: rubennorte
Differential Revision: D63757693
fbshipit-source-id: 815e70e8ae38d99b1908d3aa2a9cfffdd9dc9851
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46780
This is primarily a debugger server change to better-align the `title` and `description` fields (visible in via the CDP `/json/list` endpoint), reporting them directly from the device.
For React Native users, the net effect of this change is to improve/align the display name for each debugger target in the CLI multi-select menu (`j` to debug). This change may also be useful for discovery in non-Fusebox frontends such as VS Code (`vscode-expo` extension).
Changes:
- Rename `title` prop on `InspectorPageDescription`/`IInspector::addPage` to `description` (no call site changes).
- Add `deviceName` param to `InspectorPackagerConnection`.
- Move the page `description` to the `description` JSON field.
- Update `InspectorPackagerConnection::Impl::pages()` to return new `title` and `description` fields.
- Align `OpenDebuggerKeyboardHandler` to display `title` field.
- Deprecate the nonstandard `deviceName` field.
**Before**
```
[
{
"id": "3c9f24bedab0e73fca6a1b295030e7af9346a8c0-1",
"title": "React Native Bridgeless [C++ connection]",
"description": "com.facebook.RNTester",
...
}
```
The `description` field was previously the closest thing we had to a target identifier. Today, this is not needed, since we have the stable `reactNative.logicalDeviceId` field.
**After**
```
[
{
"id": "3c9f24bedab0e73fca6a1b295030e7af9346a8c0-1",
"title": "com.facebook.RNTester (iPhone 16 Pro)",
"description": "React Native Bridgeless [C++ connection]",
...
}
```
The `title` field is now more human readable and aligned with what we render in the window title of React Native DevTools. The `description` field describes the type of debugger target (the specific React Native implementation).
Changelog: [Internal]
Reviewed By: vzaidman
Differential Revision: D63329456
fbshipit-source-id: cfe98f77e31c729431005925cfc66e2780ef8c72
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46782
changelog: [internal]
Avoid setting C++ state for the same contentOffset. This is redundant work and can be safely avoided.
Reviewed By: NickGerleman
Differential Revision: D63700308
fbshipit-source-id: d6ea8cf6a1da47a13787b49abd66a87e3da57d34
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46778
This has been rolled out internally already and is a good cleanup for OSS too. We no longer use this config externally (BRIDGE+FABRIC) so this shouldn't actually affect the new arch rollout.
Changelog: [Internal]
Reviewed By: fabriziocucci
Differential Revision: D63752084
fbshipit-source-id: da3025f7b072dc7b82f8de22ff247b3979ae64d0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46776
All other paths that touch `mAttachedReactRoots` uses this lock. We expect this to address a crash we're seeing in production where `startSurface` is invoked multiple times.
Changelog: [Internal]
Reviewed By: fabriziocucci
Differential Revision: D63752083
fbshipit-source-id: f06d07aa70719945f6956fbf6e0cde3e9c8e8ed0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46751
rubennorte noticed that some turbo module methods were not getting cached on the jsRepresentation as expected. This is caused by the react-native-codegen wrappers we generate overriding the `get` method and bypassing this caching layer. Instead they should be overriding `create` to lazily allocate new properties. To prevent this from re-occuring, I've made `get` final so no other overrides can happen.
## Changelog:
[General][Fixed] Properties for C++ TurboModules using codegen were not correctly cached
[General][Breaking] TurboModule::get is now a final method, override `create` to customize property lookup
Reviewed By: rubennorte
Differential Revision: D63665966
fbshipit-source-id: c614901c2f0d698147ec9ba36a4b592ed3d37652
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46697
Changelog: [internal]
This is already the case in `PerformanceMeasure` but for some reason we didn't apply it here as well.
Reviewed By: rshest
Differential Revision: D63541134
fbshipit-source-id: 262d504ed153e07e89492945f761887729bad9e0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46698
Changelog: [internal]
Small optimization to use readers/writers for locking in `PerformanceEntryReporter`.
Reviewed By: rshest
Differential Revision: D63540236
fbshipit-source-id: 80b3fd313453ad8da4f0af2deaab61a86064b4b7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46693
Changelog: [internal]
This unifies the native modules for `Performance` and `PerformanceObserver` in the same module. Keeping them separate is artificial and introduces unnecessary duplication. These APIs are very closely related so it makes sense to unify
Reviewed By: javache
Differential Revision: D63471855
fbshipit-source-id: fa8c5dc7b7c68954fc11867f68909d2c6c2ee85c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46760
Changelog: [internal]
Relying on the singleton was causing issues in iOS tests for RuntimeScheduler. This fixes those issues.
Reviewed By: rshest
Differential Revision: D63702251
fbshipit-source-id: 42b98e673ffba6f45b52510cdb3eea410e55b894
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46688
Changelog: [internal]
Just aligns on `report*` as the public API in `PerformanceEntryReporter` (e.g.: `measure` -> `reportMeasure`, `logEventEntry` -> `reportEvent`, etc.).
Reviewed By: rshest
Differential Revision: D63471856
fbshipit-source-id: 59617160c238aaefaefe8b6fc27de4481ef32ada
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46714
Sets up a feature flag to experiment with scheduling `Animation` completion callbacks in a microtask instead of executing them synchronously. (The completion callback is the callback passed into `animation.start(<callback>)`).
There are currently 4 potential scheduling behaviors of the animation completion callback:
- Synchronously when `start()` is invoked, for spring and timing animations that immediately complete (e.g. no delays and not native driver).
- Synchronously when `stop()` is invoked, if the animation has not yet completed.
- Synchronously during the layout effect phase, or commit phase (if the `useInsertionEffectsForAnimations` feature flag is enabled), if the animation has not yet completed.
- Asynchronously when the animation completes (e.g. non-zero delay or when the native driver is employed).
The wide number of variables and the timing-dependent nature of these variables means that the behavior of the completion callback is very non-deterministic.
Imperically, we have also found that most codebases using `useNativeDriver` mostly have completion callbacks executed asynchronously. However, this leads to surprising problems where the callback causes unpredictable behavior when it is called synchronously (e.g. when the animating component is unmounted *during* the animation).
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D63573322
fbshipit-source-id: 16c48be78c9ac65a64021249fad10f7265737c44
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46718
Simple rename of a protected method that should not be called by anyone outside of the `Animation` class and its subclasses, just to make it more intuitive.
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D63572363
fbshipit-source-id: cf68f63a9b361767b9dbfcd73124bcdae7a1806e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46717
Reduces redundancy and cleans up the layers of abstraction between the `Animation` class and its subclasses, by hoisting common and duplicated logic into the parent class.
I also cleaned up the Flow types in these files while I was at it.
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D63572064
fbshipit-source-id: ab6bf7265b67ab38cc5a9d5c94f8cd1456c93f23
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46720
Refactors the `Animation` subclasses (from Animated) such that using `useNativeDriver` with a non-native `AnimatedValue` will consistently fail when calling `start()`.
The current behavior is inconsistent because if a timing or spring animation has a non-zero delay, the error will be thrown in asynchronously in a timeout.
Changelog:
[General][Changed] - Animations started with incompatible `useNativeDriver` and `AnimatedValue` configurations will now synchronously fail. Previously, spring and timing animations with non-zero delays would throw the error asynchronously.
Reviewed By: javache
Differential Revision: D63572062
fbshipit-source-id: 2619e2867fe7754695e3347c838ad6fe136a6614
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46719
Implements a minor refactor of `TimingAnimation#start` so that we standardize how the `_useNativeDriver` case is handled.
There is no behavior change from this besides more consistently assigning to `this._startTime`. (Previously, we would not set it if the duration were 0 and `!useNativeDriver`.)
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D63572066
fbshipit-source-id: 9cbd05c5ca5e00227be69441b9d7d8a502690246
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46716
Changes `_nativeId` to be a private property in the `Animation` class (from Animated).
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D63572065
fbshipit-source-id: 24facca0ccb1256f602ec4406bf8c0b22c4bbf96
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46721
Currently, the `Animation` class (from Animated) defines an unofficially protected `__onEnd` property that subclasses are expected to populate. However, subclasses are expected to *not* invoke `__onEnd`, but instead call `__debouncedOnEnd`.
In order to make this code less fragile, this commit refactors the `Animation` class and its subclasses so that `onEnd` is stored in a private property and initialized by the `start` method in the `Animation` parent class. Now, the only way to invoke the `onEnd` callback is by calling `__debouncedOnEnd`.
The subclasses have been adjusted to call the `start` superclass method to initialize this.
Changelog:
[General][Changed] - The `Animation` superclass no longer exposes `__onEnd` as a property. Subclasses must instead invoke `super.start(…)` in their `start()` implementation.
Reviewed By: javache
Differential Revision: D63572063
fbshipit-source-id: 221153ca890c67c59713d607032536f57d7a5b0a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46715
Properly mocks `NativeAnimatedModule` in Jest so that we can cleanup the `process.env.NODE_ENV` checks in Animated.
Changelog:
[General][Added] - Added Jest mocks for `NativeAnimatedModule`
Reviewed By: javache
Differential Revision: D63572067
fbshipit-source-id: a4fcedeebbaaa47a34bb356305652a3ed6358855
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46742
Migrates type definitions in React Native to use the newly created `HostInstance` type instead of `NativeMethods` and `React.ElementRef<HostComponent<T>>`.
Changelog:
[General][Changed] - Simplified Flow types to use `HostInstance` (which changing nominal types).
Reviewed By: NickGerleman
Differential Revision: D63646763
fbshipit-source-id: 904894dc40da4d2e70bcb6df47018fc6248ea972
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46743
Creates a new `HostInstance` type for React Native, to more accurately capture the intent most developers have when using the `NativeMethods` type or `React.ElementRef<HostComponent<T>>`.
Since `React.ElementRef<HostComponent<T>>` is typed as `React.AbstractComponent<T, NativeMethods>`, that means `React.ElementRef<HostComponent<T>>` is equivalent to `NativeMethods` which is equivalent to `HostInstance`.
Changelog:
[General][Added] - Added `HostInstance` type to represent the instance of a `HostComponent<T>`.
Test Plan:
Ran the following successfully:
```
$ cd ~/fbsource
$ js1 flow
```
Reviewed By: NickGerleman
Differential Revision: D63646555
Pulled By: yungsters
fbshipit-source-id: 075859e6b0217521ba9ab2b92843ae7e47db5be0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46746
This change adds `isHighTextContrastEnabled()` to `AccessibilityInfo` to enable access to Android OS's "High contrast text" setting option. It also adds a new event, `highContrastTextChanged`, to enable listeners to subscribe to changes on this setting.
## Changelog
[Android][Added] - Added `isHighTextContrastEnabled()` to `AccessibilityInfo` to read `ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED` setting value
Reviewed By: NickGerleman
Differential Revision: D63155444
fbshipit-source-id: 9829b40e6c183f6beba732190dc318894e9d9a3f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46762
changelog: [internal]
Typealias NonOwningList obscures the underlaying type and provides limited benefit. Using std::vector<ShadowViewNodePair*> is more readable.
Reviewed By: NickGerleman
Differential Revision: D63396285
fbshipit-source-id: 70cda3f33a7649cabbf5888fbefe0610d2c002b3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46770
Small updates to the `react-native start` command CLI output:
- Change "Welcome..." text to blue.
- Display server base URL instead of port only.
- Embolden key command letters.
- "Ctrl+C to exit" prompt.
- Extra newlines for balance.
Changelog: [Internal]
Reviewed By: cortinico, cipolleschi
Differential Revision: D63328267
fbshipit-source-id: 119ddb2ba68c99df532840285c3c1f922e727e8b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46769
(Further refactors to logging after D63255296.)
Fully decouples `community-cli-plugin` from the unlisted optional dependency on `react-native-community/cli-tools'`. This is motivated by changes in https://github.com/facebook/react-native/pull/46627 which switch to using Metro's `TerminalReporter` API for emitting logs safely.
- Swaps out logs in the dev server for the `unstable_server_log` Metro reporter event.
- Swaps out `logger.debug()` calls for the `debug` package, currently used by Metro and `dev-middleware`.
- Swaps out other logs in the `bundle` command for `console`.
- (Also specify missing `semver` dep.)
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D63328268
fbshipit-source-id: f552748ecc3456bd5fb8870c3a51d744a6bf3e70
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46741
X-link: https://github.com/facebook/yoga/pull/1711
box sizing is really just a reinterpretation of what length properties (like `width`, `height`, `max-width`, etc) mean. So to implement this I just add the border and padding if we are in content box when we ask for any of these properties. All the math that gets done by the algorithm is still in border box land, and the layout we return is to be interpreted as the border box (this is actually the expected behavior per https://drafts.csswg.org/css-sizing/#box-sizing). This makes this implementation pretty simple actually.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D63416833
fbshipit-source-id: fd76132cf51e8a5092129802c3a12ab24023018b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46649
X-link: https://github.com/facebook/yoga/pull/1705
To get the height and width we call a function currently named `getResolvedDimension`. This returns a `Style::Length`, which in most cases we "resolve" immediately by calling `resolve`. This is a bit confusing that you need to `resolve` something that is already `resolved`.
I plan on adding a new function soon for `contentBox` which would resolve the length for you, so I think this should be renamed.
Also deleted unused `getResolvedDimensions`
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D63407730
fbshipit-source-id: e855c17d9c99817be308b7263fcb5d43559ede14
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46761
The legacy paths for this is all gone and non functional. We can clean thes up fully now.
Changelog: [Internal]
Reviewed By: rshest, Abbondanzo
Differential Revision: D63652264
fbshipit-source-id: cabc1af0098553c64f834e6bc30000ef7a942a4c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46627
IMPORTANT: Requires a Metro bump, CI will fail until updated.
Introduces a target selection API for launching React Native DevTools when more than one device is connected.
Credit to robhogan for the initial internal implementation of `OpenDebuggerKeyboardHandler`!
(This leverages recent additions to Metro's reporter API — which we should follow up on to use for the rest of `community-cli-plugin`. Notably, using `TerminalReporter` ensures server output won't conflict with Metro's own event and progress logs.)
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D63255295
fbshipit-source-id: da93500358791eabe4cab433cad31b82d518fb5f
Summary:
The previous scripts to trigger the react-native-communty/template
release workflow has not been working. This is a rewrite is js, along
with some testing to make this more robust.
I've have a PR to combine the publish and tag steps in the template publication: https://github.com/react-native-community/template/pull/65, this takes advantage of that change.
Changelog: [Internal]
Pull Request resolved: https://github.com/facebook/react-native/pull/46363
Test Plan:
1. Unit tests
2. Once the infrastructure lands in the `react-native-community/template` workflow, we can trigger a dry run.
## TODO:
- ~~Still needs to be used in the GH release workflow.~~
- ~~Template release workflow needs to land the dry_run input change.~~
## Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D62296008
Pulled By: blakef
fbshipit-source-id: 217326c44b1d820e36a1d847cf9ad24d228087c1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46759
Changelog: [internal]
This improves the example in RNTester for `performance.mark` and `performance.measure` by only listing the marks/measures explicitly emitted from the example. This removes noise if other parts of the app are logging marks/measures as well.
Reviewed By: rshest
Differential Revision: D63695731
fbshipit-source-id: f65cf59363da0e6c9e0b3ffadf05abd2eb5a214c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46758
There are some occurrencies where the Modal results not attached to the Window, perhaps when the app is backgrounded.
This trigger an exception `java.lang.IllegalArgumentException: View=DecorView@b9f88af[AdsManagerActivity] not attached to window manager`.\
This was fixed already but the conversion from Java to Kotlin missed a condition in the `||` clause. We are adding it back.
## Changelog
[Android][Fixed] - Fix crash for Modal not attached to window manager
## Facebook
The original fix is in this diff D22264672 by mdvacca
Also see this post: https://fb.workplace.com/groups/rn.support/permalink/27047414764880449/
Reviewed By: cortinico
Differential Revision: D63700769
fbshipit-source-id: bc8a44868d5cacb8822e1646c2b7643682f45e1b