Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36346
1. Remove Paper native assertions for converting DimensionValue string to Yoga unit, and fix a case where Fabric could throw on invalid value.
2. Move DimensionValue types in TypeScript to use template literal types, to show malformed strings in-editor, during typechecking. Update min TS version to allow this (in conformance with the min TS version used by DefinitelyTyped).
Changelog:
[General][Added] - Improve handling of invalid DimensionValue usage
Reviewed By: javache
Differential Revision: D43153075
fbshipit-source-id: db4e813df6e81cbd3158edad7c07c7a90c009803
Summary:
This diff adds the `performance.reactNativeStartupTiming` API to the performance global object for RN. This property does not exist in web, and we are free to make up our own list of properties in the startup metrics to track RN app startup process. In our case, we have the following six properties to begin with (we may extend and add more to this list in the future):
```
- `(start|end)Time`: The time ‘zero’ for the startup timing and the end of app startup. RN has no knowledge of app start time, which will be provided by the platform. The `endTime` will be the time when the first JS bundle finishes executing (Note that RN supports multiple JS bundles, which can be loaded async)
- `executeJavaScriptBundleEntryPoint(Start|End)`: The time for RN to execute the JS entry point (and finish all sync job)
```
Changelog:
[General][Added] - Add new JS performance API to support getting RN app startup timings
Reviewed By: rshest
Differential Revision: D43326564
fbshipit-source-id: 7b4c7cae70ff64ba1714a1630cd5e183df6c06b0
Summary:
This adds the `UnstableReactLegacyComponentDescriptor`, part of the Fabric Interop Layer for Android.
Summary of the changes are:
* Expose a new `rrc_legacyviewmanagerinterop` native module via prefab
* Extend default App Cmake setup so `rrc_legacyviewmanagerinterop` is exposed by default
* Add a sample legacy component inside RN Tester
Changelog:
[Internal] [Changed] - Expose UnstableReactLegacyComponentDescriptor inside react/renderer/core
Reviewed By: cipolleschi
Differential Revision: D43731219
fbshipit-source-id: ee26d7e9d7eff5ef6a3e22853f8ea363b9198567
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36344
This adds the `UnstableReactLegacyComponentDescriptor`, part of the Fabric Interop Layer,
inside the `react/renderer/components/legacyviewmanagerinterop` module so that it can be included by the user externally.
If we wish to place it somewhere else, I'm more than happy to move it around.
Changelog:
[Internal] [Changed] - Expose UnstableReactLegacyComponentDescriptor inside react/renderer/components/legacyviewmanagerinterop
Reviewed By: mdvacca, cipolleschi
Differential Revision: D43500868
fbshipit-source-id: acfcd89efc42ff7a4ee6cb0a1cbd71d69f79721f
Summary:
Found that we may do multiple allocations of the same ViewManager instance since ViewManagers are both accessed from the UI thread (mounting views) and from the Fabric background thread (for measuring Text), which could lead to multiple instances of the same ViewManager to be created.
As far as I can tell, this issue was harmless since our ViewManager constructors don't have side-effects, but not ideal.
Changelog: [Internall]
Reviewed By: rshest
Differential Revision: D43661306
fbshipit-source-id: 37ef82d41d43c334fdc6cfbeffb225bba87c668e
Summary:
Looked at the top soft exceptions firing from this codepath. Most of these should use `getReactApplicationContext` instead of `getReactApplicationContextIfActiveOrWarn` to do their cleanup on invalidation.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D43661307
fbshipit-source-id: 27094a6e8dfcf4748eb916531c4998f1c9ee8713
Summary:
Pre-initializing ViewManagers is not as valuable now that we've rolled out StaticViewConfigs on the new architecture. This was primarily used to pre-allocate constants and the `preInitializeViewManagers` was already deprecated.
Changelog: [Android][Removed] UIManager.preInitializeViewManagers
Reviewed By: rshest
Differential Revision: D43661304
fbshipit-source-id: 391c5207ec876a70ddd4bda30a58267090da3ff1
Summary:
Min Android API level is 21, this diff is removing code for Android API level < 21
changelog: [RN][Android] removing code for Android API level < 21
Reviewed By: cortinico, RSNara
Differential Revision: D43544497
fbshipit-source-id: 1ece1143a37a038826361b55ff08a8160f03108d
Summary:
This is just a minor bump before 0.72 and it brings AGP up to date
with the latest stable.
allow-large-files
Changelog:
[Internal] [Changed] - AGP to 7.4.2
Reviewed By: cipolleschi
Differential Revision: D43659180
fbshipit-source-id: d57ea8fb6ae902412b542e0125d3b15168d0e123
Summary:
Both Android and iOS allow you to set application specific user interface style, which is useful for applications that support both light and dark mode.
With the newly added `Appearance.setColorScheme`, you can natively manage the application's user interface style rather than keeping that preference in JavaScript. The benefit is that native dialogs like alert, keyboard, action sheets and more will also be affected by this change.
Implemented using Android X [AppCompatDelegate.setDefaultNightMode](https://developer.android.com/reference/androidx/appcompat/app/AppCompatDelegate#setDefaultNightMode(int)) and iOS 13+ [overrideUserInterfaceStyle](https://developer.apple.com/documentation/uikit/uiview/3238086-overrideuserinterfacestyle?language=objc)
```tsx
// Lets assume a given device is set to **dark** mode.
Appearance.getColorScheme(); // `dark`
// Set the app's user interface to `light`
Appearance.setColorScheme('light');
Appearance.getColorScheme(); // `light`
// Set the app's user interface to `unspecified`
Appearance.setColorScheme(null);
Appearance.getColorScheme() // `dark`
```
## Changelog
[GENERAL] [ADDED] - Added `setColorScheme` to `Appearance` module
Pull Request resolved: https://github.com/facebook/react-native/pull/36122
Test Plan:
Added a RNTester for the feature in the Appearance section.
Three buttons for toggling all set of modes.
Reviewed By: lunaleaps
Differential Revision: D43331405
Pulled By: NickGerleman
fbshipit-source-id: 3b15f1ed0626d1ad7a8266ec026e903cd3ec46aa
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36269
This bumps our project to build on Gradle 8.x
All the necessary issues have already been resolved so everything should be green.
Gradle version has been bumped also inside the template and RNGP.
Changelog:
[Android] [Changed] - Bump Gradle to 8.x
allow-large-files
Reviewed By: cipolleschi
Differential Revision: D43534184
fbshipit-source-id: ca1fd6799ff6d776743de2b2d809fc54bc533440
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36310
As part of the preparation for 0.72, this reduces the amount of breaking changes we expose in the template for the user.
Specifically it re-introduces the 4 param ctor for `DefaultReactActivityDelegate` and marking it with Deprecated,
so the build log and the IDE will instruct the user to move away from it (if they forgot to follow the upgrade helper).
Changelog:
[Internal] [Changed] - Reduce breaking changes with DefaultReactActivityDelegate
Reviewed By: cipolleschi
Differential Revision: D43619184
fbshipit-source-id: a98f7c67201a2860e7c2221e646f45f1ebec4678
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36282
RN Tester is currently red as `TraceUpdateOverlay` is not registered in the Fabric Core Component Registry.
Changelog:
[Internal] [Changed] - Add TraceUpdateOverlayComponentDescriptor to CoreComponentsRegistry
Reviewed By: cipolleschi
Differential Revision: D43567915
fbshipit-source-id: ceb4b9b674a969f260caf810eade30ae23ce2ce8
Summary:
We don't support Lambda in OSS yet, Lambdas were introduced as root of a stack of diffs, so we need to revert the whole stack
## Changelog:
[internal] - revert changes that broke CircleCI
Reviewed By: GijsWeterings
Differential Revision: D43566129
fbshipit-source-id: feae3c3065ed83463c9d887d7ff488c29993e0ae
Summary:
We don't support Lambda in OSS yet, Lambdas were introduced as root of a stack of diffs, so we need to revert the whole stack
## Changelog:
[internal] - revert changes that broke CircleCI
Reviewed By: GijsWeterings
Differential Revision: D43566121
fbshipit-source-id: 5c4fe8272ca220d8914eb64b3ab395589c007198
Summary:
We don't support Lambda in OSS yet, Lambdas were introduced as root of a stack of diffs, so we need to revert the whole stack
## Changelog:
[internal] - revert changes that broke CircleCI
Reviewed By: GijsWeterings
Differential Revision: D43566086
fbshipit-source-id: 95b8ed404edd6f711fbbb5ae3913010c653a2c28
Summary:
While looking into android code i noticed a bug removing the incorrect key from a map.
changelog: [internal] internal
Reviewed By: RSNara
Differential Revision: D43544499
fbshipit-source-id: 15224e90cc46af358fb822e85accfae9aa9f7d11
Summary:
We can now use Java 8, this diff i'm replacing old callbacks by lambdas
changelog: [internal] internal
Reviewed By: RSNara
Differential Revision: D43544498
fbshipit-source-id: 4c5ab8473b3d9d512853c02e81652fdce1838a48
Summary:
Changelog:
[Android][Internal] - Fix EventAnimationDriverMatchSpec to match against the view that generated the event for non-bubbling pointer events. This should have no effect if you are not using PointerEvents
Reviewed By: mdvacca
Differential Revision: D43413771
fbshipit-source-id: 31ac751b3d3d55eb44d3a9ab54e5fb387dcaa9b3
Summary:
I've just tested the nightly and the build from source is broken as the `repositories{}` block is missing.
Normally RNGP will take care of setting repositories for everyone, but this is triggered by the app-module.
When building from source, the app module of the user is isolated from the included build of React Native,
therefore the repositories{} definitions are not passed over.
Without this, the build fails with:
```
Cannot resolve external dependency ... because no repositories are defined
```
Changelog:
[Internal] [Changed] - Re-add repositories{} block to allow for build-from-source
Reviewed By: cipolleschi
Differential Revision: D43501011
fbshipit-source-id: b41c56c62839163ad210e7e303940dec0a9001da
Summary: Changelog: [Android][Fixed] Resolved bug with Text components in new arch losing text alignment state.
Reviewed By: mdvacca
Differential Revision: D34108943
fbshipit-source-id: 3992e9406345be919b5e3595fc1f9e61cf67a699
Summary:
Simple optimization to exit before iterating through the hit path if the event name doesn't match.
Changelog:
[Android][Internal] - Optimization for natively-driven Animated PointerEvents to early exit during matching in EventAnimationDriverMatchSpec. This should have no effect if you are not using PointerEvents
Reviewed By: lunaleaps
Differential Revision: D43400457
fbshipit-source-id: fe8d811d371c78622cd4f3f9cd469cff9ccce585
Summary:
Callling `getReactApplicationContextIfActiveOrWarn` from `invalidate` will always warn because the context is deactivated, which is preventing us from cleaning up these listeners.
Changelog: [Internal]
Reviewed By: jehartzog
Differential Revision: D43352929
fbshipit-source-id: f29564a290a6c93b2304865d445829f5e486d84f
Summary:
[Changelog][Internal]
A follow-up, based on javache comments on D43398416 (https://github.com/facebook/react-native/commit/9aac13d4dc95925b57f03e7964fc7add6834e518) (post-land) - just some minor potential improvements for locking efficiency.
Reviewed By: javache
Differential Revision: D43438414
fbshipit-source-id: 0cf807a045a1f132d5481d3f6115a97869e93d65
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36201
[Changelog][Internal]
Guard call to the C++ ReadableNAtiveMap.importValues with a lock.
Note that all the occurrences in this class (together with importTypes) already were protected by a lock, except of this one, which with the very high chance caused crashes in T145271136.
My corresponding comment from the task, for justification:
> If callstack to be trusted, the crash happens on the C++ side, in ReadableNativeMap::importValues().
It throws ArrayIndexOutOfBoundsException, which, looking at the code, seems to be only possible due to a corrupted data or race conditions.
> Now, looking at the Java side of ReadableNativeMap, and the particular call site... it's very dodgy, since all other occurrences of calling to native importTypes/importValues are guarded by locks, but the one crashing isn't.
NOTE: A couple of `importKeys()` instances appears to suffer from the same problem as well.
Reviewed By: javache
Differential Revision: D43398416
fbshipit-source-id: 0402de5dc723a2fba7d0247c8ad4aeff150d8340
Summary:
changelog: [internal]
C++17 has implementation of shared_mutex in standard library. Let's use it instead of folly.
Reviewed By: cipolleschi
Differential Revision: D43275493
fbshipit-source-id: d766251226aa230110011aca94b4e697fe0d31a1
Summary:
Before this change, the only way to update the offline mirror was to run it on a devmachine
(OD won't work either due to network restriction).
Developer's laptop also won't work as they would download AAPT2 for MacOS.
In the offline mirror instead we need AAPT2 for Linux as that's Sandcastle runner type.
This relaxes this requirement so the next time a developer has to update the offline
mirror they will see the message on the diff with the command to execute, and they should
be able to run the command locally (or on their devbox).
Changelog:
[Internal] [Changed] - Allow for Android offline mirrors to be executed on developer's laptops
allow-large-files
Reviewed By: cipolleschi
Differential Revision: D43344651
fbshipit-source-id: 3e91adb2db45cf94d3f947aaab501d98580dc43d
Summary:
This util class was introduced in D42978852 (https://github.com/facebook/react-native/commit/611f9c615ebad7d53c1eb1274fe82e36d915165e), but the Long type was not ported over. Not sure if this was intentional or not, but this is used from return values from DeviceConfig, where number values are encoded as Long types.
Changelog:
[Internal] - internal
Differential Revision: D43323851
fbshipit-source-id: 6a8a27b75b1738f2f87dd56ee814316af323c258
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36160
Changelog:
[Android][Fixed] - Invalid prop values no longer trigger Java exceptions in the legacy renderer
## Context
We are changing React Native to behave more like a browser in the sense that **bad style values are not runtime errors**. (See e.g. D43159284 (https://github.com/facebook/react-native/commit/d6e9891577c81503407adaa85db8f5bf97557db0), D43184380.) The recommended way for developers to ensure they are passing correct style values is to use a typechecker (TypeScript or Flow) in conjunction with E2E tests and manual spot checks.
## This diff
This change is similar to D43184380, but here we target the legacy renderer on Android by (1) replacing exceptions with logging calls, (2) adding fallback values (equivalent to resetting the respective props to `null`) where needed, and (3) replacing `null` checks in `ReactProp` converters with `instanceof` checks.
Leaving the logging call sites in place (as opposed to deleting them) will be helpful if we decide that we want to repurpose these checks for a new, more visible diagnostic (though we would likely only build such a diagnostic in Fabric at this point).
Reviewed By: javache
Differential Revision: D43274525
fbshipit-source-id: 9d1e7ca3b6299dd827e8667e3d542433ec896c0e
Summary:
The `rrc_root` was not exposed via prefab. I'm adding it to make possible for Reanimated to integrate on top of React Native via prefab. Based on https://github.com/facebook/react-native/issues/35643.
## Changelog
[ANDROID] [CHANGED] - Expose `rrc_root` via prefab.
Pull Request resolved: https://github.com/facebook/react-native/pull/36166
Reviewed By: cipolleschi
Differential Revision: D43304302
Pulled By: cortinico
fbshipit-source-id: 1c4a7013a33b48a8a7a445a78430630542420f4d
Summary:
There are two different ways of getting the ReactModuleInfoProvider from LazyReactPackage:
1. static LazyReactPackage.getReactModuleInfoProviderViaReflection(LazyReactPackage)
2. LazyReactPackage.getReactModuleInfoProvider()
The first way calls into codegen that only works within Meta's infra. This code-path is *now* dead. Therefore, this diff deprecates the first path, to make LazyReactPackage less confusing.
This diff simplifies the implementation to return an empty ReactModuleInfoProvider for the v0.72 cut.
In the v0.73 cut, we'll just outright delete this method.
Changelog: [Android][Changed] - Deprecate LazyReactPackage.getReactModuleInfoProviderViaReflection()
Reviewed By: sshic
Differential Revision: D43066800
fbshipit-source-id: 2145c3265ff2bd24e6828b193577ba1f500bce49
Summary:
This diff pays the duty in T126215968 where we should move the util methods to a shareable place. ~~I cannot find a good util namespace so I created on under `com.facebook.react.panelapp`.~~ This lives under `com.facebook.react.bridge` next to the `Arguments` class.
- Create ~~`ReadableDataParser.java`~~ `JSONArguments.java`
- Reuse in multiple places within `react-panellib`
Changelog:
[Internal] - Code refactor on JSON and ReadableMap conversion
Reviewed By: javache
Differential Revision: D42978852
fbshipit-source-id: e00a5c4cefcf6114d9a5d947cb00e3ff7f0dccaa
Summary:
This diff adds `TraceUpdateOverlay` native component to render highlights when trace update is detected from React JS. This allows a highlight border to be rendered outside of the component with re-renders.
- Created `TraceUpdateOverlay` native component and added to the `DebugCorePackage`
- Added to C++ registry so it's compatible with Fabric
- Added to `AppContainer` for all RN apps when global devtools hook is available
Changelog:
[Android][Internal] - Add trace update overlay to show re-render highlights
Reviewed By: javache
Differential Revision: D42831719
fbshipit-source-id: 30c2e24859a316c27700270087a0d7779d7ad8ed
Summary: Changelog: [Internal] - Ensure pointer move tracking is applied to movement while the pointer is pressed
Reviewed By: javache
Differential Revision: D42977052
fbshipit-source-id: 2d48c35a908449d0b2338c33273fb75a430bc393
Summary:
Hi 👋
I'm one of the Expo contributors. When upgrading the Stripe dependency in Expo for SDK48 release on Android, we noticed the following error:
```java.lang.ClassCastException: android.view.ContextThemeWrapper cannot be cast to android.app.Activity```
With Kudo we narrowed it down to an underlying issue in the following cast in `ReactRootView` done during checking for keyboard events:
```((Activity) getContext())```
The `getContext()` is actually a `ContextThemeWrapper` for `ExperienceActivity`, so we should not cast it to an `Activity` directly - instead, we unwrap it using `getBaseContext()`.
Implementing the following fix into the Expo fork fixed the crash for us:
https://github.com/expo/react-native/commit/0e2c9cada120a3709e8285ab4bcdaa1c5c446732
## Changelog
[ANDROID] [FIXED] - Fixed crash occurring in certain native views when handling keyboard events.
<!-- 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
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/36121
Test Plan:
Tested manually by comparing two builds before and after this change. The main branch build crashes when the [Stripe 0.23.1](https://github.com/stripe/stripe-react-native) Card Element from the example app is mounted on screen. Applying the change fixed the issue.
Happy to make a more isolated reproduction if necessary.
---
Full stack trace:
```
AndroidRuntime D Shutting down VM
E FATAL EXCEPTION: main
E Process: host.exp.exponent, PID: 8849
E java.lang.ClassCastException: android.view.ContextThemeWrapper cannot be cast to android.app.Activity
E at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.checkForKeyboardEvents(ReactRootView.java:937)
E at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.onGlobalLayout(ReactRootView.java:913)
E at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:1061)
E at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3352)
E at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2286)
E at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8948)
E at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1231)
E at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239)
E at android.view.Choreographer.doCallbacks(Choreographer.java:899)
E at android.view.Choreographer.doFrame(Choreographer.java:832)
E at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214)
E at android.os.Handler.handleCallback(Handler.java:942)
E at android.os.Handler.dispatchMessage(Handler.java:99)
E at android.os.Looper.loopOnce(Looper.java:201)
E at android.os.Looper.loop(Looper.java:288)
E at android.app.ActivityThread.main(ActivityThread.java:7898)
E at java.lang.reflect.Method.invoke(Native Method)
E at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
```
Reviewed By: cortinico
Differential Revision: D43186530
Pulled By: javache
fbshipit-source-id: 2143495f6b0c71f342eba6d5abb2bfa4a529fbdd
Summary:
This annotation is missing it's retention policy which should be `SOURCE` as it's an IntDef and not used at runtime.
Changelog:
[Internal] [Changed] - Add missing retention policy on EventCategoryDef annotation
Created from CodeHub with https://fburl.com/edit-in-codehub
Reviewed By: cipolleschi
Differential Revision: D43187398
fbshipit-source-id: d00bc3a5cf74d2eb983fa7369905e2260db80142
Summary:
Our first party modules are still using `namespace`. This cleans this up.
The Manifest file for ReactAndroid is also not needed anymore. The one
from hermes-engine can also be removed from facebook/hermes in a separate diff.
Changelog:
[Internal] [Changed] - Use namespace for ReactAndroid and hermes-engine
Reviewed By: cipolleschi
Differential Revision: D43198514
fbshipit-source-id: d988cfa81ecc4484b6b2add4ae2c1d9376febc3e