Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47432
In this diff we are excluding the $$PropSetter classes from public API, we do this by adding the UnstableReactNativeAPI annotation on all $$PropSetter classes
changelog: [internal] internal
Reviewed By: cortinico
Differential Revision: D65488026
fbshipit-source-id: 9f1bbe7b25fa69c0a40f6cb0ff38a8ae6ee8d97d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47350
Changelog: [Internal]
we don't need any of these now since no one is calling `contextContainer_->at<std::shared_ptr>("ReactNativeConfig")` anymore
Reviewed By: NickGerleman
Differential Revision: D65304976
fbshipit-source-id: 5f835ab9ac429aa1942cc8d9669812c1ac994238
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46868
jsBuild prasing was done at the js level.
But, for the c++ pipeline, we have to parse the js build in native.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D63927093
fbshipit-source-id: ce7ee46714ee0e72e450003330dbca78acb264a3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47428
This changes the messages that the bot is printing.
I've moved from using a table to using GitHub's admonitions that
renders nicely are are more informative.
Changelog:
[Internal] [Changed] - Update messages for react-native-bot
Reviewed By: mdvacca
Differential Revision: D65485633
fbshipit-source-id: f43f7bd75280bfd0aceab48b2517306c1057b778
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47427
I've noticed that react-native-bot posts twice once we can't find a reproducer.
(see here: https://github.com/facebook/react-native/issues/47421)
This fixes it by letting it post only once.
Changelog:
[Internal] [Changed] - Prevent react-native-bot from double posting on missing reproducer
Reviewed By: mdvacca
Differential Revision: D65485634
fbshipit-source-id: dbe9b1311aef246dead6d9b922c1256363e894f7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47423
cipolleschi found out that we broke the `ReactViewGroup` constructor when making this class Nullsafe.
Specifically now users would need to pass a `Context` and not a `Context?` as libraries will break (and this will break a lot of them).
So I'm undoing this change by annotating this parameter as Nullable.
Changelog:
[Android] [Changed] - Undo a breaking change on ReactViewGroup constructor
Reviewed By: tdn120
Differential Revision: D65483379
fbshipit-source-id: 43f7bcab5f10b1b8b5601de1dab314d7bbb1eefe
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47385
BridgelessCatalystInstance class is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead.
changelog: [Android][Changed] Deprecate BridgelessCatalystInstance class
Reviewed By: cortinico
Differential Revision: D65430789
fbshipit-source-id: 011b372c93c39862d5821713aa8f673084b52c2a
Summary:
X-link: https://github.com/facebook/yoga/pull/1736
Pull Request resolved: https://github.com/facebook/react-native/pull/47358
`LayoutableChildren<yoga::Node>::Iterator` showed up to a surprising extent on a recent trace. Part of this was during pixel grid rounding, which does full tree traversal (we should fix that...), where the iterator is the first thing to read from the node.
I ran Yoga microbenchmark with Yoga compiled with `-O2`, where we saw a regression of synthetic performance by ~10%, but it turns out this build also had ASAN and some other heavy bits enabled, so the real impact was quite lower (~6%).
I was able to make some optimizations in the meantime against that, which still show some minor wins, reducing that overhead to ~4% in the properly optimized build (and a bit more before that). This is still measurable on the beefy server, and the code is a bit cleaner, so let's commit these!
Note that, in real scenarios, measure functions may dominate layout time, so display: contents does not mean end-to-end 4% regression, even after this change.
This change makes a few different optimizations
1. Removes redundant copies
2. Removes redundant index keeping
3. Mark which branches are likely vs unlikely
4. Shrink iterator size from 6 pointers to 3 pointers
5. Avoid usage in pixel grid rounding (so we don't need to have cache read for style)
In "Huge nested layout" example
| Before display: contents support | After display: contents support | After optimizations |
| 9.77ms | 10.39ms | 10.17ms |
Changelog: [Internal]
Reviewed By: rozele
Differential Revision: D65336148
fbshipit-source-id: 01c592771ed7accf2d87dddd5a3a9e0225098b56
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47417
Backing out this change as it was breaking an internal app. I'll reland this next week when I have more time.
## Changelog:
[iOS][Changed] - Revert fix that checks whether an image is present on disk.
## Facebook:
This is breaking twilight.
Differential Revision: D65479912
fbshipit-source-id: dcd5ac5f3d98ba2f10b9519f09d3eb1fd454da61
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47368
This class should be internal and has no meaningful usages outside of React Native.
See https://github.com/search?type=code&q=%22DevLoadingModule%3A%3Aclass%22
So technically breaking but I expect no impact for OSS at all.
Changelog:
[Android] [Breaking] - Make `DevLoadingModule` internal
Reviewed By: javache
Differential Revision: D64725164
fbshipit-source-id: 5f39e609c611662c71cc08bffa195f7bea5db5bd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47371
This interface should have not been exposed in the first place.
I'm converting it to Kotlin + making it `internal`.
I found no meaningful usage in OSS so I expect no breakages.
Changelog:
[Android] [Breaking] - Stable API - Convert to Kotlin and make internal `NotThreadSafeViewHierarchyUpdateDebugListener`
Reviewed By: javache
Differential Revision: D65420912
fbshipit-source-id: 5afdb013f588a5698b4e7467a7f1096c24d1733e
Summary:
Fixes https://github.com/facebook/react-native/issues/47352
This fixes a bug when the user is providing its own CMakeLists.txt file say because they want to compile more C++ code than we actually provide.
Previously the `*.cpp` will evalute file in the current directory, meaning that the app's default `OnLoad.cpp` file would be ignored.
## Changelog:
[ANDROID] [FIXED] - Use absolute path when compiling appmodules.so sources
Pull Request resolved: https://github.com/facebook/react-native/pull/47379
Test Plan:
Tested against the reproducer provided in:
- Use absolute path when compiling appmodules.so sources
Reviewed By: cipolleschi
Differential Revision: D65428676
Pulled By: cortinico
fbshipit-source-id: 7f3e4d470da0fffc5191c1a2c7e8fec517fee496
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47378
The RCTMD5Hash in RCTUtils is using CC_MD5 function which is deprecated. unfortunately we can't really change it or we will break many apps that use it in the AsyncStorage.
Those app wlll have to do a migration to use a different function. Meanwhile we are suppressing the warning
## Changelog
[Internal] - Suppress CC_MD5 warning
Reviewed By: cortinico
Differential Revision: D65424309
fbshipit-source-id: e0258ae68482f6c4a3a865bb52920f87bc5ada21
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47391
React Native can preload before the activity is available.
Preloading will execute the js bundle. If the js bundle throws an error, it'll try to render a redbox.
If the activity isn't available, and hasn't been set on the react instance yet, the redbox will just render nothing.
## Changes
In this diff, just re-try displaying the redbox after the application sets the activity on the react instance (i.e: calls onHostResume(activity)).
Changelog: [Android][Breaking] - Rename DevSupportManagerBase.getCurrentContext() -> getCurrentReactContext()
Reviewed By: mdvacca
Differential Revision: D65352596
fbshipit-source-id: 7750f6ca493fc50405119958e0f2908fc24f1cb4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47396
Migrate ReactUnimplementedViewManager to internal visibility
verified and there are usages on OSS
changelog: [Android][Breaking] Reduce visibility of ReactUnimplementedViewManager to internal
Reviewed By: cortinico
Differential Revision: D65444514
fbshipit-source-id: 11ff2acc96098bc4e53be7ef3059e4a5c112c43e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46939
X-link: https://github.com/facebook/yoga/pull/1722
tsia! opted for one function for each keyword just like auto. This is kinda annoying and not the most sustainable, so maybe it makes more sense to make a new enum here and just add one function
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D64002837
fbshipit-source-id: f15fae9fc0103175e1d85850fc9aa68579989fd3
Summary:
X-link: https://github.com/facebook/yoga/pull/1721
Pull Request resolved: https://github.com/facebook/react-native/pull/46938
The private internals of how we store styles needed to change a bit to support 3 new keyword values. Right now the only other keyword that can be stored is `auto`. As a result there isn't much fancy logic to support storing this and its just stored as a specific type inside of `StyleValueHandle`. There are only 3 bits for types (8 values), so it is not sustainable to just stuff every keyword in there. So the change writes the keyword as a value with a new `keyword` `Type`.
I chose not to put `auto` in there even though it is a keyword since it is a hot path, I did not want to regress perf when I did not need to.
I also make a new `StyleSizeValue` class to store size values - so values for `width`, `height`, etc. This way these new keywords are kept specific to sizes and we will not be able to create, for example, a margin: `max-content`.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D63927512
fbshipit-source-id: 7285469d37ac4b05226183b56275c77f0c06996c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47324
I need to reference this type somewhere else, but not an array of the type.
Generally we prefer that all exported types are the object itself, and it used as a member type of arrays when used.
Changelog: [Internal]
Reviewed By: makovkastar
Differential Revision: D65259014
fbshipit-source-id: 35fb5fe03a44bed61ad87337d0fc5c198744c0e9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47323
This change adds support for number literals as a type.
The codegen already has parsing support for these types
```
+passNumber: (arg: number) => void;
+passString: (arg: string) => void;
+passStringLiteral: (arg: 'A String Literal') => void;
```
This change now also supports
```
+passNumberLiteral: (arg: 4) => void;
```
On the native side this is treated the same as `number`. It could be strengthened in the future.
This is a pre-requisite for number literal unions and enums.
Changelog: [Added] Codegen: Added support for Number literals in native module specs
Reviewed By: makovkastar
Differential Revision: D65249334
fbshipit-source-id: 98b051d2a6bd1ad5cc6473ac88acfcbe82bd5c7d
Summary:
Those 2 classes are not supposed to be exposed externally, so I'm making them internal.
The were never part of the public API so I'm not marking this commit as [BREAKING]
Changelog:
[Android] [Changed] - Make ReactDebugOverlayTags, DebugOverlayTags, Printer, PrinterHolder, NoopPrinter internal
Reviewed By: fabriziocucci
Differential Revision: D65420257
fbshipit-source-id: b870274e84d9c3202b9f21360c29eeb995a8d52b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47374
I've converted this class to Kotlin + made it `internal` as it should not be exposed publicly.
This class is part of the iterop layer for the New Architecture.
Marked as breaking but I expect no meaningful breakages here.
Changelog:
[Android] [Breaking] - Stable API - Make InteropModuleRegistry internal
Reviewed By: javache
Differential Revision: D65421965
fbshipit-source-id: 207be5379ebe3a31530cfea75b4623787f5ae7cf
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:
I believe these two were the last items under `com.facebook.debug` that were still Java.
I thought about making DebugOverlayTag a Data class, but i will leave it up to the reviewer to decide if it would be needed or not.
## Changelog:
[INTERNAL] [FIXED] - Migrate DebugOverlayTag and ReactDebugOverlayTag to Kotlin
Pull Request resolved: https://github.com/facebook/react-native/pull/47362
Test Plan:
`./gradlew test`:
<img width="1265" alt="Screenshot 2024-11-02 at 18 45 45" src="https://github.com/user-attachments/assets/405e77bc-1287-4329-b230-9f46eadb3580">
Reviewed By: javache
Differential Revision: D65417984
Pulled By: cortinico
fbshipit-source-id: e39224e40bde281498fdbed1609a03b264967396
Summary:
While we (Margelo) were developing a new C++ 3D library for react-native, we noticed that Java often keeps a lot of dead instances in memory, making it hard to debug memory allocations (or actually _de_-allocations), especially since we use `jsi::HostObject` and `jni::HybridClass` in conjunction. Having two garbage-collected languages retain an object is a bit tricky, and making sure that we aren't doing anything wrong with our allocations and references was not easy - but manually calling `System.gc()` on app reloads helped us see that much better.
Before this, we needed to wait multiple minutes until some Java objects are actually freed from the GC. Our use-case was a `facebook::jni::HybridClass`, which was held strong in a `facebook::jsi::HostObject` (so again, two GC'd languages).
There _should_ be no change in behaviour with this PR, just two things to note:
1. Memory might be free'd more eagerly in full reloads (dev builds) - makes sense for library developers, especially when working with C++ modules.
2. `System.gc()` only _suggests_ garbage collection, it does not _force_ it. But when it runs, it might impact performance, although we haven't noticed any impact of that at all. The garbage collector runs anyways - better during a reload than later when exceuting the app normally.
## 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] [ADDED] - Trigger Java GC on app reload
Pull Request resolved: https://github.com/facebook/react-native/pull/43813
Test Plan:
Open an app, create a Java module that holds a few objects, add `finalize()` methods to those objects and log their deletion.
Reload the app to see the logs, compare before vs after.
Reviewed By: rshest
Differential Revision: D65418163
Pulled By: javache
fbshipit-source-id: 7597548790577dfc542b57f59578ae48df543b14
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47369
This just bumps the AGP patch version to the latest stable.
Changelog:
[Android] [Changed] - AGP to 8.7.2
Reviewed By: tdn120
Differential Revision: D65336357
fbshipit-source-id: 9a7464304ba29f6b752f41b252bde9cb0eca0e9a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47357
`MultiSourceHelper` should not yield an `ImageSource` that has its cache control policy set to `RELOAD`. This change skips such sources when computing the bestCached item (but not best item)
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D65337414
fbshipit-source-id: bdd0d55f4a65128b141a1c7a132dba085232fa11
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47356
Add utf16 method to JSI. This change will add the default implementation
for all VMs by calling UTF8 and manually convert it to UTF16. A later
change will be added for Hermes to use internal VM information to get
the UTF16 string.
Changelog: [Internal]
Reviewed By: neildhar
Differential Revision: D64918244
fbshipit-source-id: 6fc0c44fc397c2f8bb40a4262596b178ee4f1f29
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47333
Motivated by https://github.com/facebook/hermes/issues/1549. This was originally changed in https://github.com/facebook/react-native/pull/46696, as our internal Flow support had diverged from `babel/eslint-parser` (https://github.com/facebook/react-native/issues/46601).
We effectively have three flavours of JavaScript in support:
- Flow@latest for the `react-native` package, shipped as source — uses `hermes-parser`.
- TypeScript for product code (community template, Expo) — uses `babel/plugin-syntax-typescript`.
- Plain JavaScript or Flow in product code, *which may be extended with additional user Babel plugins and needs lenient parsing* — uses `babel/plugin-syntax-flow` via `babel/eslint-parser` (**this change**).
I'd love to simplify this 😅.
Switching to `hermes-eslint` for the RN monorepo codebase (D63541483) is unchanged.
Changelog: [Internal]
Reviewed By: robhogan, cipolleschi
Differential Revision: D65272156
fbshipit-source-id: 3a2bbe3fcf8ed6057f6d994a0be4985e6bf46fa9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47339
Fixing issue raised in https://github.com/facebook/react-native/issues/47307
This is a follow up from D62286026.
It appears there was a line that went missing while trying to refactor the code.
`fitsSystemWindows = true` is needeod for < API 30 to avoid content rendering under the system bars when Modal is shown with Activity that is edge-to-edge.
Changelog:
[Android][Fixed] Fix Regression - Modal content rendering below system bar on < API 30 when activity is edge-to-edge
Reviewed By: cortinico
Differential Revision: D65280014
fbshipit-source-id: 616ff739be55635f1295ef3bf8b997a27ef769ae