Summary:
This PR provides a fix for the long existing issue of missing check for invert color in accessibility options on Android.
Reference Issue : https://github.com/facebook/react-native/issues/30870
## Changelog:
- Added native module code to check for invert color settings value
- Updated js module to return a proper promise instead of default false for isInvertColorsEnabled()
Pick one each for the category and type tags:
[ANDROID] [FIXED] - Missing isInvertColorsEnabled implementation for Android
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
Pull Request resolved: https://github.com/facebook/react-native/pull/47341
Test Plan: Tested on OnePlus 12 with Android 14 and Pixel 6 with Android 15. The try catch exists because in some cases if the switch hasn't been toggled before the android system raises the missing settings exception.
Reviewed By: cortinico, fabriziocucci
Differential Revision: D65419632
Pulled By: javache
fbshipit-source-id: ddb103445a9d0f318e52ba9d23750140ce5a7ed0
Summary:
Following up from https://github.com/facebook/react-native/issues/47182, as basic caching control is already in place in Android, it can be extended to include the `only-if-cached` option.
We check whether the image is in the cache. If it is, we proceed to load it. Otherwise, we do nothing.
## Changelog:
[ANDROID] [ADDED] - Image `only-if-cached` cache control option
Pull Request resolved: https://github.com/facebook/react-native/pull/47348
Test Plan:
In the `rn-tester`, I added a third example for Android where the third image will never be loaded as the cache policy is set to `only-if-cached` and the image has not been loaded before.
<details>
<summary>Video demonstrating how the `only-if-cached` options behaves</summary>
https://github.com/user-attachments/assets/45669e81-5414-4103-8931-138bffa81447
</details>
<details>
<summary>Error from image not found in cache example</summary>
<img width="807" alt="image" src="https://github.com/user-attachments/assets/6b79d811-1809-437c-b2fe-c86d3da7c58d">
</details>
Reviewed By: rshest
Differential Revision: D65384639
Pulled By: Abbondanzo
fbshipit-source-id: f4a72694f45eb3d7097c350f4a4008a0abf0a1ab
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47340
This diff cleans up some problematic `React.ElementRef<T>` when T is generic type.
Changelog: [Internal]
Reviewed By: alexmckenley
Differential Revision: D65280467
fbshipit-source-id: 71172b16320a10cbc7a8b46dae5d3dd0eb00ba0c
Summary:
Fixes https://github.com/facebook/react-native/issues/12606
Previously, `Image` cache control options were not functional on Android, even though they were being passed to the native component via the `source` prop. This PR addresses that by implementing logic to manage cache behaviour on Android.
When the `reload` option is explicitly set, the image is now evicted from both memory and disk caches before a new request is made. This ensures the image is always fetched from the source, aligning the caching behaviour between Android and iOS for the `default` and `reload` options.
## Changelog:
[ANDROID][ADDED] - Enabling basic `Image` cache control for Android
Pull Request resolved: https://github.com/facebook/react-native/pull/47182
Test Plan:
Added a new example to the `rn-tester`, where we can notice that the image on the right is reloaded if rendered or re-rendered as the cache policy is set to `reload`. The image on the left has the cache policy set to `default` and won't be re-rendered as the image is already in the cache. See the video below:
https://github.com/user-attachments/assets/88bc1d2d-0239-4deb-bcde-fe0ce521ff4d
Also tested on both old and new architecture.
Reviewed By: NickGerleman
Differential Revision: D64915440
Pulled By: Abbondanzo
fbshipit-source-id: 32e1c55dd20bf96ab0f69ef900d821c3c2552ef7
Summary:
This pr is part of issue https://github.com/facebook/react-native/issues/46757 solving a task - [ME2E0008] [ME2E0009]
- Set up a test
- Starts the app
- Scrolls until flatlist is visilbe and clicks on flatlist
- Click basic button
- Scroll down until item 600 is visible
## Changelog:
[Internal] [Added] - Add e2e-test logic that click button & scroll down until specific item is visible
Pull Request resolved: https://github.com/facebook/react-native/pull/46804
Test Plan:
### Test Locally
- iOS
```bash
yarn install
cd packages/rn-tester
yarn e2e-build-ios
```
- Android
```bash
yarn install
cd packages/rn-tester
yarn e2e-build-android
```
### Start Maestro
- iOS
```bash
cd packages/rn-tester
yarn e2e-test-ios
```
- Android
```
cd packages/rn-tester
yarn e2e-test-android
```
### Test in CI
To test in CI, just add a comment on your PR with the text:
```
/test-e2e
```
Reviewed By: cortinico
Differential Revision: D63829274
Pulled By: cipolleschi
fbshipit-source-id: f7b4342ed353a48123f87dcfd8d503009f65637c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47270
Lets add some screenshot tests, along with one more example, and fixing some silly typos in test IDs.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D65094482
fbshipit-source-id: a5f3e06c4737158bf6419364d05668c3feb1bd5e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47280
Noticed in the screenshots of https://github.com/facebook/react-native/pull/47230 that Android's logic of setting scroll content origin to zero, then right aligning scroll offset, won't correctly handle case where content is smaller than scrolling container. We can fix that by only resetting the origin when content overflows container, since we otherwise are not scrollable, and scroll adjustment will not translate.
Changelog:
[Android][Fixed] - Fix RTL ScrollView position when content smaller than container
Reviewed By: rshest
Differential Revision: D65136654
fbshipit-source-id: 2818ff6360cbfac64d7e57bdcbbe8c0a9b4bbb97
Summary:
Fixes https://github.com/facebook/react-native/issues/46908
The `justificationMode` is not set for multiline text without unicode characters with known width on both architectures. This caused the issue of drawing additional empty line at the end of `TextView` because Yoga thought that text takes 5 lines and falsely calculated it's height.
Currently, on the old architecture, the `justificationMode` is set only on text that is not boring (contains unicode characters) with unknown width. I am not sure why is that, so I am opening this as a draft for now as I am still checking if it doesn't break anything.
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[ANDROID] [FIXED] - fix generating empty line at the end of multiline text view when `textAlign` is set to `justify`
Pull Request resolved: https://github.com/facebook/react-native/pull/47122
Test Plan: I've tested on both architectures on repro provided in the issue.
Reviewed By: javache
Differential Revision: D65002386
Pulled By: NickGerleman
fbshipit-source-id: 0187956c88e6eb1e637c24e82b3052cc82581a64
Summary:
This PR adds an example showcasing a TextInput whose width gets resized dynamically based on the text content width.
This example was added for this PR, which tries to address a flickering bug with dynamic sized TextInputs:
- https://github.com/facebook/react-native/pull/46973
## 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
-->
[INTERNAL] [ADDED] Added dynamic content width TextInput example
Pull Request resolved: https://github.com/facebook/react-native/pull/46976
Test Plan:
Test in RNTester app:
https://github.com/user-attachments/assets/7571b80b-7035-47df-b840-4218ab0802b5
Reviewed By: NickGerleman
Differential Revision: D64271454
Pulled By: arushikesarwani94
fbshipit-source-id: 28fe7bd93891ffe5284340d73e9ee947654f1788
Summary:
The `XMLHttpRequest` example with a single file download doesn't seem to be working anymore. The test case is quite old so it seems like something changed in between with the example URLs.
- Changing the URL for the example. Using another file from `filesamples.com` as it's already being used in the chunk file download example as well.
- Adding an `onerror` callback as it was loading infinitely when something went wrong.
## Changelog:
[INTERNAL] [FIXED] - fixing `XMLHttpRequest` file download example
Pull Request resolved: https://github.com/facebook/react-native/pull/47152
Test Plan:
Using the `rn-tester`, see the before and after for comparison
<details>
<summary>Before and after videos</summary>
**Before**:
https://github.com/user-attachments/assets/01f89cd9-0f5e-4ddb-9ff2-c3e053be5413
**After**:
https://github.com/user-attachments/assets/59ef161c-d5ba-43e3-827e-e250cc663276
</details>
Reviewed By: cipolleschi
Differential Revision: D65126952
Pulled By: NickGerleman
fbshipit-source-id: 7a4b2187570fd85d4444bfe63ae7bc77b09af261
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47163
In order to adopt react 19's ref-as-prop model, we need to eliminate all the places where they are treated differently. `React.AbstractComponent` is the worst example of this, and we need to eliminate it.
This diff replaces final few in libdefs.
Changelog: [internal]
Reviewed By: alexmckenley
Differential Revision: D64776942
fbshipit-source-id: 5e96c6d4fecb1b6cf539a00aecb10b9b35fc140b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47143
In order to adopt react 19's ref-as-prop model, we need to eliminate all the places where they are treated differently. `React.AbstractComponent` is the worst example of this, and we need to eliminate it.
This diff replaces most of the remaining `React.AbstractComponent` in react-native.
Changelog: [Internal]
Reviewed By: alexmckenley
Differential Revision: D64701145
fbshipit-source-id: c765674fdf59812895c4fae43df97cf8b9d24f05
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47126
This will be used to validate the fix to `maintainVisibleContentPosition` for the two major use cases when the FlatList resizes:
* when the items have fixed size
* when the items scale with the size of the list
Changelog: [Internal]
Reviewed By: Abbondanzo
Differential Revision: D64339251
fbshipit-source-id: d0ee8d73cd9e6527a7ce0950e8f3941337b70474
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47109
Fixes the `lint/sort-imports` errors that are now surfaced after fixing the lint configuration.
For a couple files, I added lint suppressions instead because the unsorted import ordering is important due to interleaved calls with side effects.
Changelog:
[Internal]
Reviewed By: GijsWeterings
Differential Revision: D64569485
fbshipit-source-id: 26415d792e2b9efe08c05d1436f723faae549882
Summary:
During testing for 0.76-RC6, I came across the following behavior in RNTester.
Components > FlatList > Basic > Toggle `Empty` switch
You'll notice there are activity indicators in the header/footer (see video) for some time and things appear to be somewhat janky. I think the expectations would be to see only the `ListEmptyComponent` that is defined for this to look more correct. This will help not give any false indication that something has gone wrong with the latest picks when testing newer versions.
## Changelog:
[INTERNAL] [FIXED] - Fixed FlatList Empty behavior in RNTester
Pull Request resolved: https://github.com/facebook/react-native/pull/47094
Test Plan: https://github.com/user-attachments/assets/6e116641-5b24-473c-a654-7d32a081b83f
Reviewed By: yungsters
Differential Revision: D64541905
Pulled By: cipolleschi
fbshipit-source-id: 0447d99588d85f9e1a46c6da169a0838e94994bc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46982
E2E test setup for each of the `resizeMethod` methods for Image on Android
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D64136839
fbshipit-source-id: 876939a50243836030401c6456410f119abe01b5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46964
Graceful degradation is better than outright crashing. When rendering images that exceed Android's memory limits, React Native applications will fatally crash. This change intervenes by swallowing the exception that Android raises and forwards it to the `onError` handler. As a result, no image will be rendered instead of fatally crashing.
Fresco already intervenes by default. It will raise a `PoolSizeViolationException` if the bitmap size exceeds memory limits set by the OS and applies a 2048 pixel maximum dimension to JPEG images, but it's still possible for these configuration limits to be removed and for images to fall just short of Fresco's memory limit. The exception is raised when we attempt to draw the bitmap, not when the bitmap is allocated in memory, so we must handle the exception here and not in Fresco.
## Changelog
[Android][Fixed] - Apps will no longer fatally crash when trying to draw large images
Reviewed By: tdn120
Differential Revision: D64144596
fbshipit-source-id: 32b69ad4ecef0564c2cad7a287a31b56688f38b8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46898
Replaces *many* `Text` component usages with `RNTesterText`: a thin wrapper around `Text` that applies color based on the color scheme chosen by the user. It makes text legible for dark mode across 41 different example files. This changes intentionally do not touch a few larger component sites that expand beyond RNTester, like `Animated` and `NewAppScreen`
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D64053464
fbshipit-source-id: 9516fef2afe1b364eb38e85e3a2dbb5c434e44db
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46873
## Summary
Adds a small showcase for the different `resizeMethod` options and how downsampling is applied
## Changelog
[Android][Added] - Added showcase for Android `resizeMethod` options when applied to a large image
Reviewed By: rshest
Differential Revision: D62393212
fbshipit-source-id: 46e7ff6310617acb9eb288e3831c0b5e6b1751c8
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:
- ME2E0017
- ME2E0018
## 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
-->
[ Internal ] [ Added ] - Add e2e test for button
Pull Request resolved: https://github.com/facebook/react-native/pull/46829
Test Plan:
yarn e2e-test-ios
yarn e2e-test-android
Reviewed By: rshest
Differential Revision: D63889079
Pulled By: cipolleschi
fbshipit-source-id: ca2ede3142d77170fcb4121b025eab56818ffb07
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/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/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:
Changelog: [internal]
(this functionality hasn't been enabled in OSS yet, so no changelog necessary).
Fix https://github.com/facebook/react-native/issues/45122.
performance.mark is currently O(1) but performance.clearMark is O(n) (being n the number of entries in the buffer), which makes this operation very slow.
### Changes overview
- Created new `PerformanceEntryBuffer` abstraction with the following subtypes, that differ on how entries are stored:
- `PerformanceEntryCircularBuffer` - stores them in a ring buffer that was already implemented, removed key lookup cache (`BoundedConsumableBuffer`)
- `PerformanceEntryKeyedBuffer` - stores them in a `unordered_map`, allowing for faster retrieval by type
- `PerformanceEntryLinearBuffer` - a simple infinite buffer based on `std::vector`, currently used in a `PerformanceObserver`
- Created `PerformanceObserver` abstraction on native side.
- Created `PerformanceObserverRegistry` that collects active observers and forwards entries to observers that should retrieve them
- Moved some method implementations to `.cpp` files to reduce potential compilation time slowdown. As the `PerformanceEntryReporter` can be included from anywhere in the code, it will be beneficial to make header files as light as possible.
- Add comments to methods that note which standard is the method from/for.
- Added some `[[nodiscard]]` attributes
- Since the logic of routing entries to observers is moved to native side, JS side of the code got much simplified
- If ever needed, `PerformanceObserver` can be created from native-side
Standards covered:
- https://www.w3.org/TR/performance-timeline
- https://www.w3.org/TR/event-timing/
- https://w3c.github.io/timing-entrytypes-registry
- https://w3c.github.io/user-timing/
Pull Request resolved: https://github.com/facebook/react-native/pull/45206
Test Plan:
I've tested this e2e on IGVR and in the RNTester playground for the performance APIs. Everything works as expected.
There are also new unit tests for this.
C++ test results: https://www.internalfb.com/intern/testinfra/testconsole/testrun/8725724513169247/
Reviewed By: rshest
Differential Revision: D63101520
Pulled By: rubennorte
fbshipit-source-id: 5970b5c14692ff33ffda44a9f09067f6a758bdbe
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46632
Changelog: [General][Added] Add Playground to RNTester for testing out features & submitting reproducers.
**Context**
- Adding the Playground from Catalyst to RNTester
- This should help folks test React Native features for a particular version
**Change**
- Add a new playground component to RNTester
- Add a new reducer action for opening an example from navbar press
- Fixed typing issues
- Add icon from this fb asset pack: https://www.internalfb.com/assets/set/facebook_icons/nucleus-beaker/variant_outline-size_24?q=beaker
- Matched background color using this imagemagick script
**dark**
```
convert input.png -fill 'rgb(178,180,186)' -colorize 100% output.png
```
**light**
```
convert input.png -fill 'rgb(81,82,84)' -colorize 100% output.png
```
Reviewed By: NickGerleman
Differential Revision: D61972594
fbshipit-source-id: 4a5523a84a6ef09d3266d5f56825907bd3fbe4b5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46634
The PointerEventPointerOverOut.js test case is broken due to a changed assumption about the name of the native tag property (`_nativeTag` vs. `__nativeTag`). This fixes the broken assumption.
## Changelog
[General][Fixed] Fixed issue with W3C PointerEvents tests
Reviewed By: NickGerleman
Differential Revision: D63336621
fbshipit-source-id: b54270f1c1232de6845ef73cac52f06b9a85539c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46617
This changes fixes the Increment/Decrement accessibility actions on iOS with the New Architecture.
## Changelog
[iOS][Fixed] - Make sure that the Increment and Decrement accessibility actions works on iOS
Reviewed By: javache
Differential Revision: D63263830
fbshipit-source-id: 99dca14a002e098db2d3b0e268af32cdab6ce786
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46603
Was debugging this test for the mounting instruction changes, and found some opportunities to clean this up.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D63258342
fbshipit-source-id: f7e6be58474f112993232ce5859ccb160f050ae8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46551
We crash if we pass a shadow color with 0 alpha due to some divide by 0 logic. This fixes that for inset and outset shadows and adds a test for that case.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D62899047
fbshipit-source-id: 2aff1d016dd97bed024df1c3f89bcc62e49f0306
Summary:
Fix platform color on android with linear gradient.
## Changelog:
[ANDROID] [FIXED] - Linear gradient with platform colors
<!-- 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
Pull Request resolved: https://github.com/facebook/react-native/pull/46290
Test Plan: Added example and testcases
Reviewed By: mdvacca
Differential Revision: D62277253
Pulled By: NickGerleman
fbshipit-source-id: 376ee5ebde61f3cb1ed32e82f71ad5479ebc50a5
Summary:
Solves these issues:
- https://github.com/facebook/react-native/issues/18398
- https://github.com/facebook/react-native/issues/12478
Solves this proposal: https://github.com/react-native-community/discussions-and-proposals/discussions/774
## 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] - added overlayColor prop to modal component for customisable background overlay
**Motivation:**
Currently, the React Native Modal component only allows the background to be set to either `transparent` or `white`. This limits the ability to dim the background or apply custom colors, which is essential for creating a more polished and user-friendly interface.
**Change Log:**
Modal Component Enhancements:
- Introduced a new optional prop `overlayColor` to the Modal component.
- Updated the background color logic to prioritize `overlayColor` when transparent is `false`.
- Ensured backward compatibility by defaulting to `white` when `overlayColor` is not provided.
Pull Request resolved: https://github.com/facebook/react-native/pull/46322
Test Plan:
- Test the changes on both iOS and Android devices/emulators to ensure consistent behavior.
- Added example in **rn-tester** app
**Sample screenshot with custom overlayColor passed as 'red'.**

Reviewed By: cipolleschi
Differential Revision: D62201559
Pulled By: alanleedev
fbshipit-source-id: e990d7f18f5edf61f0107026ea899c5f22d47bfd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46406
As title
Second attempt at landing the new name. There were 2 issues previously which led us to revert.
1. **Error on workrooms tests.** This ended up not being caused by us but rather by D61896776. After renaming the error changed which might've caused the renaming to be blamed for the issue. It has since been resolved
2. **FB crash** FB was crashing when using drop-shadow after renaming. For some reason after renaming `filter` an invalid stylex property was making FB crash. We don't know why renaming uncovered the issue but the the code was using unsupported features on RN (`calc` & `stylex`) which then led to passing a raw unsupported value for `filter` and crashing on the `processFilter` function.
FB was fixed here D62407454 to prevent crashing after landing this diff
Changelog: [General] [Changed] - Add official `filter` CSSProperty.
Reviewed By: NickGerleman
Differential Revision: D62401985
fbshipit-source-id: 14422603c40b7ddf8300029165a85655354075c3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46404
As title
Second attempt to rename the prop. BoxShadow caused no issues after renaming but it was batched with `filter` which we reverted.
Changelog: [General] [Changed] - Add official `boxShadow` CSSProperty.
Reviewed By: NickGerleman, cyan33
Differential Revision: D62400814
fbshipit-source-id: ad721f6d11d614e987048e55556b05ff74a4747d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46170
This PR expose to JS a few missing text content types on iOS (available from iOS 15)
- dateTime
- flightNumber
- shipmentTrackingNumber
## Changelog
[General][Added] - Expose missing text content type to JS
Reviewed By: blakef
Differential Revision: D61657788
fbshipit-source-id: 1a0ea0e76efaf715d88bcbf249f7cb20b5f3607b