Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48783
## Overview
This is the final boss of the new owner stacks feature. With owner stacks, we don't need to parse message strings to find the component stack for logbox. Instead, we can access the component stack directly with `captureOwnerStack`.
This means we don't need to install the LogBox console.error patch and can greatly simplify the process of handling errors and make it more reliable.
To do this, we rely only on adding LogBox to the ExceptionManager:
- `reactConsoleErrorHandler` -> `LogBox.addConsoleLog`
- `reportException` -> `LogBox.addException`
Changelog:
[General][Fixed] - Remove LogBox patch, de-duplicating errors
## Benefits
As a side effect, this removes a lot of duplicate errors. For example, currently if a component throws, you get 2 errors:
{F1974436906}
After this, there's just the one you expect:
{F1974436908}
## Followups
After this lands and doesn't need reverted for some reason, we can delete a ton of code from logbox for finding and detecting stacks from errors.
Reviewed By: javache
Differential Revision: D68380668
fbshipit-source-id: 68112f1e3992fada4d6aaffdf9bd618ce1834f7b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51843
Changelog: [Internal]
To avoid corrupting the React fiber tree when committing from multiple threads this diff only updates shadow node references within the fiber tree for commits originating from React.
This guarantees that during the update of the references no React render will start or is running, making the update of the shadow node reference safe to execute.
S527994
Reviewed By: sammy-SC
Differential Revision: D76043845
fbshipit-source-id: bfcbeaae7fc8b976a1c2db6682330cef9ca25ab8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51725
This change builds upon the focus/blur portion showcased in ViewExample but showcases several more components all in one spot. This can be shared with additional platforms or expanded to include more component examples like Image, but the goal is to target Android and not distract from the primary use cases.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D75747410
fbshipit-source-id: 7d53366d9f32192ca6b3da45dd127836fb6efdf6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51724
Moves focus change listener logic from `ReactViewManager` to `BaseViewManager` so all view managers that extend the class can get focus/blur event dispatching for free. This does so by applying event listeners where `addEventEmitters` is called, so any extending classes must try to call `super.addEventEmitters` or implement it themselves. In the case of TextInput, this logic is re-implemented because the component emits an additional event when the text input is blurred and I wanted to avoid duplicate calls to get the event emitter for the view instance.
In addition, I've added logic and a test case to ensure that any preexisting focus change listeners set on the view instance are called. There can only ever be one focus change listener tied to a view instance, so this ensures that ones created during view instantiation are retained. However, this does not guarantee that events are emitted for downstream users who overwrite the focus change listener later in the view's lifecycle (i.e. in response to a prop change or an extending view manager that doesn't call `super.addEventEmitters`). There is no clean way to enforce that the `BaseViewManager` focus change listener is always set without changing the generics and introducing a significant breaking change.
Changelog: [Android][Added] - Adds support for onFocus/onBlur event dispatching logic to all native views that implement `BaseViewManager`
Reviewed By: NickGerleman
Differential Revision: D75579321
fbshipit-source-id: 02e1e6d0e78e9d05e4ec5bb59789f3097b73b3f8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51791
On iOS the <Image> shadow node was expecting a layout call for every clone. With `passChildrenWhenCloningPersistedNodes` <Image> components may have the image source updated without layout being called on it due to the re-use of the previous layout data thanks to the improved handling of layout invalidation.
This diff triggers the image request as soon as possible if the cloned shadow node has a clean layout. The request will be made as soon as the image manager is set on the shadow node.
Changelog: [iOS][Fixed] - Fix RCTImageComponentView image loading after source props change with no layout invalidation
Reviewed By: NickGerleman, sammy-SC
Differential Revision: D75919671
fbshipit-source-id: 8b92a9c63b6ff4a62c7eb7b0dbe18dd2be989b81
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51827
TextLayoutManager has an optimization today, where it reuses a scratch TextPaint throughout layouts.
This is not safe in Facsimile, since the paint is included as part of `Layout`, and the `Layout` escapes the TextLayoutManager, to later be drawn. I.e. every `PreparedLayoutTextView` right now is sharing this same scratch Paint.
This change makes it so that we only ever use a scratch paint for the purpose of measurements, where the layout is short-lived.
A simpler approach could be to just abandon the scratch TextPaint, since they do not seem wildly expensive at a glance (though not trivial).
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D75987605
fbshipit-source-id: 3fe3519c6164828a25cb4e2b0ee6eded73695a95
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51853
While testing D75988059 with D76047973, I noticed a few opportunities to improve the script used by `yarn lint-ci`:
- The exit code does not currently propagate, meaning `lint-ci` will succeed when it shouldn't.
- The shell script uses some non-idiomatic practices, so this improves it.
Changelog:
[Internal]
Reviewed By: kassens, cipolleschi
Differential Revision: D76049502
fbshipit-source-id: ebefddf0909edc89cd97de756b93bfaaa3d7cdef
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51670
As the title suggests, forwards `onBlur`/`onFocus` props into the Pressability config that the component creates
Changelog: [Internal]
Reviewed By: rozele
Differential Revision: D75238328
fbshipit-source-id: ebc955ab603012362b6fd021333ab61c54ef3f72
Summary:
https://github.com/facebook/react-native/pull/49927 introduced a regression where a Ruby script would read compilation artifacts and fail, when the user has relative build directories set in XCode.
After successful compilation `build/` dir and `DerivedData/` dir have `.plist` files that aren't in UTF-8 encoding and shouldn't be read by the script. If the user tries to reinstall pods at this point, he gets the following error:

This is how you enable relative build directories in XCode.

## Changelog:
[IOS] [FIXED] - Ignore `build/` and `DerivedData/` directories when reading `.plist` files.
Pull Request resolved: https://github.com/facebook/react-native/pull/51833
Test Plan: After applying this patch the problem doesn't occur anymore on my machine.
Reviewed By: cortinico
Differential Revision: D76030133
Pulled By: cipolleschi
fbshipit-source-id: 7ae8c2d0ce28b6925245a9172154e3dcafee126f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51826
changelog: [internal]
To make this possible, we "fake" a UI tick whenever `flushMessageQueue` is called. This was, after every JavaScript task a UI tick happens.
Result:
- Animations are setup right after mounting automatically.
- Animation happens after Fantom.scrollTo is called.
Reviewed By: lenaic
Differential Revision: D75899915
fbshipit-source-id: 1ccb86df6741ff9124f16073c6d61ba716d7cfe6
Summary:
Migrate com.facebook.react.views.text.ReactTextViewManager to Kotlin.
In this diff, `ReactTextAnchorViewManager` is made public again as it's extended by `ReactTextViewManager`.
## Changelog:
[INTERNAL] - Migrate com.facebook.react.views.text.ReactTextViewManager to Kotlin
Pull Request resolved: https://github.com/facebook/react-native/pull/51721
Test Plan:
```bash
yarn test-android
yarn android
```
Reviewed By: mdvacca
Differential Revision: D75829457
Pulled By: NickGerleman
fbshipit-source-id: 425e9ec14f17de5470677b73d68873647bf28675
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51824
Configures ESLint to require `flow` (or `noflow`) annotations for JavaScript files in the React Native repository. This ensures that we uphold a high bar for type safety and correctness, or intentionally deviate when it makes sense.
Changelog:
[Internal]
Reviewed By: NickGerleman
Differential Revision: D75985490
fbshipit-source-id: 56f9fe7666a02c796ceb9cf076677e81b164b65e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51822
Adds `flow` to the remaining files without it, in React Native.
After this, every `*.{flow,js}` file in React Native will have either `flow` or `noflow`.
Changelog:
[Internal]
Reviewed By: NickGerleman
Differential Revision: D75980238
fbshipit-source-id: 84cd88e4eb0b0b1dc69df247de79a75c2119bf96
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51759
Builds upon the changes in the last diff, to let Facsimile support `ReactTextViewManagerCallback`. We use the same new mechanism, of using `RCTTextViewManager` as the callback, if present, instead of relying on view manager measure function.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D75830964
fbshipit-source-id: 435798e6be08f579579eb0f2d30a67d4b1fcaf10
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51758
ViewManager’s may implement a measure function (using MapBuffer, or ReadableMap). This isn’t used automatically, but may instead be used, by calling into FabricUIManager via JNI, and passing the component name of the view manager to use.
This is only ever called manually, through specific C++ ShadowNodes. Confusingly, for some cases, like `TextInput`, we use the measure function on `RCTText` instead, because this call to FabricUIManager is hidden behind `TextLayoutManager`. This ends up really breaking Facsimile, since we want to measure these in a different way, while still measuring `TextInput` without preparing a layout.
This mechanism is also used to inject `ReactTextViewManager` from the Text View Manager, into the measurement process, for both Text, and TextInput.
I think we would ideally remove and replace the current View Manager measurement mechanism entirely. The interface doesn’t do what it claims to, and requires calling private Java methods via JNI, which we shouldn’t be encouraging external libraries to do. Only a single 3p librar (react-native-picker) uses this, but we have a lot of internal usages, and the current facility is valuable, for translating surface ID into a context. Ie we could not deprecate it without a well thought out replacement.
Instead, this change:
1. Removes the "generalized" version of this for MapBuffer, only ever used by Text
2. Given ourselves a `measureText` function, that will use a spannable processor provided, but go through TextLayoutManager, instead of trying to use this generalized path
3. Documents some of the weirdness of the current setup, without yet deprecating it
This will let the Facsimile View Manager:
1. Provide a ReactTextViewManagerCallback, like the previous version allowed, that influences measurement of both Text, and TextInput (which is... strange, but... not trying to boil the ocean here)
2. TextInput can now measure text, even if Facsimile View Manager doesn't implement this traditional measure interface
Changelog:
[Android][Breaking] - Remove FabricUIManager.measureMapBuffer() and MapBuffer measure functions on ViewManager. Please use ReadableMap variant.
[Android][Breaking] - Remove FabricUIManager.measure overload which accepts attachment positions
Reviewed By: javache
Differential Revision: D75826792
fbshipit-source-id: 6739b1e2e214351b9b95ba782d73cf4278211ab8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51692
The original algorithm for accessibilityOrder on Android had unexpected bugs. For some reason `.traversalAfter()` and `traversalBefore()` have unexpected behaviors when dealing with ancestor/descendant relationships getting more and more unexpected the further apart they are.
So we are ditching that approach entirely.
Now we have the view with accessibilityOrder create a virtual view hierarchy. We create a virtual node for each child that is in the order, and set the virtual node's position to be the same as the View it is trying to represent.
We then also populate that node with the same stuff we populate regular ax nodes with the `populateAccessibilityNodeInfo()` function and the content description of the view it is backing so we get matching descriptions with what would otherwise be the normal announcement.
**We have no way to exhaustively check every accessibility use case so we'll have to fine tune this as bugs come up, I'm expecting there to not be many issues since we populate the node the exact same way we populate every other node but anything that happens before React Native handles the node might miss some things**
Changelog: [Internal]
Reviewed By: joevilches
Differential Revision: D74766296
fbshipit-source-id: 5e77c17bed1644bc5fbf5c1e19c3c6908cc1e3e9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51762
Apple requires Xcode 16 or later to submit to the app store. Let's bump the minimum checked for in build logic as well. https://developer.apple.com/news/upcoming-requirements/?id=02212025
GHA is already only testing against 16.2.0 as of D73924819
Changelog:
[iOS][Breaking] - Bump min Xcode to 16.1
Reviewed By: cipolleschi
Differential Revision: D75835304
fbshipit-source-id: a7ce22f958be3a5448a279439e27b615e9b20a2f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51794
Adds `flow` to the remaining mocks and tests that are lacking it in the `packages/react-native` directory.
This required adding numerous type annotations and suppressions.
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D75930095
fbshipit-source-id: ebb1280adc656680e00fd579701e31521826b55c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51792
Adds `flow` to the remaining files that are lacking it in the `packages/react-native/Libraries/Alert` directory.
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D75921478
fbshipit-source-id: e277cf8241b136da1409af2592fda6ec1f7e9502
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51790
Adds `flow` or `noflow` to the remaining files that are outside of `packages/react-native/{Library,src}`.
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D75904614
fbshipit-source-id: cb2c0969065cf443c3a6e74da0fa3708fda67d18
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51789
Adds `flow` or `noflow` to the remaining files that are lacking it in the `packages/helloworld` directory.
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D75899853
fbshipit-source-id: 43990adb0827f35a8ca8c49c1787140ff47b8abb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51788
Adds `flow` to the remaining files that are lacking it in the `packages/rn-tester` directory.
This also adds any necessary type annotations and fixes lint warnings.
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D75899307
fbshipit-source-id: 27a74ed0007b3b754446a45931c2c148312d5e3a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51785
Adds `flow` to the remaining files that are lacking it in the `packages/virtualized-lists` directory. In one of the Jest tests, there are so many failures that for now, I just added `noflow`.
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D75888514
fbshipit-source-id: 29d96292f3d59fd5cf2f5ba09b58fdfb9eabab2e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51784
Adds `flow` to the remaining files that are lacking it in the `packages/react-native-fantom` directory.
This also adds any necessary type annotations (using comment syntax).
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D75886119
fbshipit-source-id: 6045b4037da21791db2a8960fbdb83aa2fb5bbf2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51782
Adds `noflow` to a test in `packages/react-native-compatibility-check`.
In the future, this file should be migrated to use `flow strict-local` or `flow strict`. However, it currently has way too many type errors. Adding `noflow` makes it explicit that this is known to not be typechecked.
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D75885038
fbshipit-source-id: d0eccda52d39e7cb1938d395c44e4441918f7fcb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51781
Adds `flow` to the remaining files that are lacking it in the `packages/react-native-codegen` directory.
This also adds any necessary type annotations (using comment syntax).
Changelog:
[Internal]
Reviewed By: huntie
Differential Revision: D75884727
fbshipit-source-id: 69e880b2dc63c3d6430f841652506e57436544a8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51780
Adds `flow` to the remaining files that are lacking it (or `noflow`) in the `scripts` directory.
This also fixes what I believe to be a typo in one of the files.
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D75883851
fbshipit-source-id: 928b7a12a08269b6643379d46de888f2c61dcb29
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51779
Adds `noflow` to a bunch of Node.js script files.
In the future, these files could be migrated to use `flow strict-local` or `flow strict` using comment syntax for type annotations. But for now, adding `noflow` makes it explicit that these are known to not be typechecked.
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D75883703
fbshipit-source-id: a8fed3aaa9c55ecda919a705940f8b34504cb07c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51778
Adds `noflow` to a bunch of ESLint and Babel files that are expected to be evaluated using Node.js without Babel. Additioanlly, these files tend to depend on ESLint and Babel type definitions that are not currently readily available.
In the future, these files could be migrated to use `flow strict-local` or `flow strict` using comment syntax for type annotations. But for now, adding `noflow` makes it explicit that these are known to not be typechecked.
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D75883642
fbshipit-source-id: 54236d123ca8773de42bce81189dfb5c0671563e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51777
Just adding `flow` to these two libdefs that aren't sourced directly from `flow-typed/flow-typed`.
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D75877692
fbshipit-source-id: 0ee0ec08e2046fdba38480cddca3686109e8ca45
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51814
changelog: [internal]
introduce Fantom.unstable_getDirectManipulationProps to make it possible to inspect what is changed by C++ Animated module before animation finishes.
Reviewed By: zeyap, rubennorte
Differential Revision: D75816105
fbshipit-source-id: 681829ca9d3f77e57213e9f88f4f24b340a982ed
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51680
Right now there are 2 flavors of vertical text alignment: `verticalAlign` and `textVerticalAlign`. Both do the same thing currently. For Facsimile, we actually want to "properly" implement `verticalAlign` so that it matches the web version, while leaving `textVerticalAlign` the same. That will take some time, however, so for now we are just going to implement the way it currently works, while fixing some issues with inline View's
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D75475915
fbshipit-source-id: ba6ff7c831bf769e9e60831ed215ab64faf143a4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51712
This prop only works on top level text components, yet it is stored as a TextAttribute. It should be a ParagraphAttribute, so I moved it there.
Changelog: [Android] [Breaking] - Move textAlignVertical to paragraph attributes instead of text attributes
Reviewed By: NickGerleman
Differential Revision: D75684576
fbshipit-source-id: 8ad2496f8a043a6a64924a6c43c7bad4593cf1db
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51711
This is needed to support textVerticalAlign as we are storing that offset in the prepared layout and need to read it from the new text view
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D75643360
fbshipit-source-id: 03620ecf09f525c45d0a60daad1dc1d9a5937362
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51810
Tweaking the visiblity of some of the fields `NativeModuleRegistry` after the Kotlin migration
of that class.
Changelog:
[Internal] [Changed] -
Reviewed By: javache
Differential Revision: D75959962
fbshipit-source-id: b3d53fc29af3b0fe32a7bd6a61898814acf90123
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51807
Remove unneeded deps from the build graph. Especially `//xplat/folly:logging_logging` ends up adding 418KB in development which is unused here.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D71316272
fbshipit-source-id: 39a73e26728cee23d4ffbdd5e4760de2029e671b
Summary:
There is an edge case in the codegen `findRCTComponentViewProtocolClass` function where the parsing of the Component Class will fail if there is another `.class` call in the same file after the `Class<RCTComponentViewProtocol>` function. This ends up resulting in a `RCTThirdPartyComponentsProvider.mm` file that looks like the image bellow
<img width="1052" alt="image" src="https://github.com/user-attachments/assets/26ce93be-0370-4852-a949-9da21762ff7f" />
You can reproduce this with the following
```
Class<RCTComponentViewProtocol> XYZCls(void)
{
return XYZ.class;
}
// this comment breaks codegen .class
```
## Changelog:
[IOS] [FIXED] - Fix codegen extracting `.class` from complex component classes
Pull Request resolved: https://github.com/facebook/react-native/pull/51813
Test Plan: Run codegen locally, use this patch in the expo/expo repo and CI should be green
Reviewed By: cipolleschi
Differential Revision: D75964424
Pulled By: cortinico
fbshipit-source-id: 50e45aa2ac6e43c75ee6fdd76791c591d81d4df7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51811
changelog: [internal]
after a bit of discussion it was clear the name of this method was confusing. Let's rename it to `produceFramesForDuration` to make it more obvious what happens under the hood.
Reviewed By: rubennorte
Differential Revision: D75953355
fbshipit-source-id: a62933894f9d42fbb3692134d117c05208c62699
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51800
Changelog: [internal]
This adds support for printing the cause of errors thrown in tests in Fantom, if available.
Reviewed By: lenaic
Differential Revision: D75946044
fbshipit-source-id: 579a2fc547cae92d2a65a4023ba1fb2e34a1f735
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51805
changelog: [internal]
this overload of transferRuntimeShadowNodeReference is only used within ShadowNode, let's make it private.
Reviewed By: lenaic
Differential Revision: D75903646
fbshipit-source-id: 1ea86b6d0771cdffaff2d425d591f1e58da330ca
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51803
The `flow strict` annotation was accidently removed in D74574293. This diff brings it back and fixes flow errors caused by this change. This makes generated TS types for `composeStyles` more relaxed but the main idea of inferring inputs base on output type annotation is preserved.
Changelog:
[Internal]
Reviewed By: huntie
Differential Revision: D75945388
fbshipit-source-id: c24ff8ad5d286e16bca3522e82f02e14f660c0dd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51802
changelog: [internal]
avoid conversions when dealing with time in C++ Animated. This makes tests more predictable.
Reviewed By: christophpurrer
Differential Revision: D75813200
fbshipit-source-id: b8934848237e5ea7c350d9a5f0175ac0f9202ffd
Summary:
Migrate com.facebook.react.bridge.NativeModuleRegistry to Kotlin.
In this diff, `JavaModuleWrapper` and some of its functions/properties had to be made public again as they are exposed by the migrated class – and if the functions are kept internal, there are crashes in legacy arch due to the C++ usages.
## Changelog:
[INTERNAL] - Migrate com.facebook.react.bridge.NativeModuleRegistry to Kotlin
Pull Request resolved: https://github.com/facebook/react-native/pull/51734
Test Plan:
```bash
yarn test-android
yarn android
```
Reviewed By: rshest
Differential Revision: D75938404
Pulled By: cortinico
fbshipit-source-id: 088286d4b100d1013cff43b81db39c6aec10f4e1