Summary: Changelog: [Android][Fixed] Fixed text measurement issue related to hyphenation frequency
Reviewed By: makovkastar
Differential Revision: D44093758
fbshipit-source-id: 71b7b6cd862586b673a49f5e6efaf9aeeb25c6e1
Summary:
For the TurboModule interop layer, we'll pass in a second ModuleProvider. We'll default that second parameter to null, when the interop layer is disabled. This change will make that easier.
Changelog: [General][Changed] - Re-organize the parameters of TurboModuleBinding::install()
Reviewed By: javache, cortinico
Differential Revision: D43993199
fbshipit-source-id: 2d339cab1f9bfe481f4b72401caa203cd7536da1
Summary:
There is a rounding issue in layout calculation when using onTextLayout method in Text component on Android.
As you can see in the example below onTextLayout returns 3 lines, but in fact text is rendered in 2 lines:
<img width="775" alt="Screenshot 2023-02-19 at 23 48 53" src="https://user-images.githubusercontent.com/8476339/220177419-de183ccd-a250-4131-ad05-907fdb791c75.png">
This happens because `(int) width` casting works like `Math.floor`, but after changing it to `Math.round` we get correct result:
<img width="775" alt="Screenshot 2023-02-19 at 23 51 11" src="https://user-images.githubusercontent.com/8476339/220177859-93474c43-ed87-4c1b-986c-2817b29b78be.png">
## Changelog
[ANDROID] [FIXED] - Fix layout width calculation in onTextLayout
<!-- 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/36222
Test Plan:
This issue can be tricky to reproduce as width calculation depends on device width. I'm attaching code that I used to reproduce it. You need to tap on the screen to run through different sentences and sooner or later you will get the one with this rounding issue.
<details>
<summary>Code to reproduce</summary>
```js
import React, { useState, useEffect } from 'react'
import { SafeAreaView, Text, View } from 'react-native'
function App() {
const [state, setState] = useState({
index: 0,
lines: [],
sentences: [],
})
const onTextLayout = (event) => {
const lines = event.nativeEvent.lines
console.log(JSON.stringify(lines, null, 2))
setState(state => ({ ...state, lines }))
}
useEffect(() => {
fetch('https://content.duoreading.io/20-the-adventures-of-tom-sawyer/translations/english.json')
.then(response => response.text())
.then(response => {
setState(state => ({ ...state, sentences: JSON.parse(response) }))
})
}, [])
return (
<SafeAreaView style={{ flex: 1, padding: 30 }}>
<View style={{ flex: 1 }} onTouchStart={() => setState(state => ({ ...state, index: state.index + 1 }))}>
<Text style={{ fontSize: 22 }} onTextLayout={onTextLayout}>
{state.sentences[state.index]}
</Text>
{state.lines.map((line, index) => (
<View
key={index}
style={{
position: 'absolute',
top: line.y,
left: line.x,
width: line.width,
height: line.height,
opacity: 0.3,
backgroundColor: ['red', 'yellow', 'blue'][index % 3],
}}>
</View>
))}
</View>
</SafeAreaView>
)
}
export default App
```
</details>
Reviewed By: christophpurrer
Differential Revision: D43907184
Pulled By: javache
fbshipit-source-id: faef757e77e759b5d9ea26da21c9e2b396dc9ff1
Summary:
This diff is reverting PR https://github.com/facebook/react-native/pull/33468
Due to an increase of java.lang.IllegalStateException caused by the PR
Original commit changeset: cd80e9a1be8f
Original Phabricator Diff: D38410635
Changelog:
[Android][Fixed] - removed logic that calls the [AccessibilityNodeInfo#setError][10] and [#setContentInvalid][13] method to display the error message in the TextInput - Revert of PR https://github.com/facebook/react-native/pull/33468
Reviewed By: NickGerleman, makovkastar
Differential Revision: D44032331
fbshipit-source-id: 732ed0cf23e4f30ae00c51dace851a3fdfe65c01
Summary:
TurboModuleManager.getOrCreateModule() is responsible for creating TurboModules.
In the future, we'll need this method to create interop NativeModules (i.e: NativeModules that don't implement TurboModule). So, this diff changes the implementation of the method to create NativeModule objects.
In the future, we'll extend the TurboModule create algorithm to create legacy NativeModules, by integrating with TurboModuleManager.getLegacyModule(): D43751055
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D43801536
fbshipit-source-id: d86ef915248d40bea56c6103796a37dd7fb5992a
Summary:
In the future, we'll re-use this interface to create NativeModule objects as well.
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D43801529
fbshipit-source-id: 90376086744dc996274663792289e3eba7be56c1
Summary:
- Right now, in the TurboModuleManager, "module" refers to TurboModules.
- In the future, we'll use this cleanup lock for interop modules as well (i.e: NativeModules that don't conform to TurboModule).
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D43801535
fbshipit-source-id: cecccf8d0005ef11bb0c864515fd284292582e64
Summary:
- Right now, in the TurboModuleManager, "module" refers to TurboModules.
- In the future, we'll use this cleanup lock for interop modules as well (i.e: NativeModules that don't conform to TurboModule).
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D43801534
fbshipit-source-id: 1ece9faa1ed564b7024098406deaa60b8a904478
Summary:
- Right now, in the TurboModuleManager, "module" refers to TurboModules.
- In the future, we'll use this cleanup lock for interop modules as well (i.e: NativeModules that don't conform to TurboModule).
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D43784169
fbshipit-source-id: dca227374e8d7de319f4fd5556d200ba8b9ac77c
Summary:
The New Architecture Validation logging should output an error whenever ReactInstancePackages are used. These packages get access to the ReactInstanceManager, which isn't available in Bridgeless mode.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D43255702
fbshipit-source-id: 1df8c2941805bb773a127408fbf7871674b0cb7c
Summary:
Make the TurboModule system understand ReactPackages.
**Note:** The TurboModule system can only create TurboModules in LazyReactPackages.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D43255701
fbshipit-source-id: 74d034732d0a6fb32197b15bb54cac9161abc294
Summary:
Make the TurboModule system understand LazyReactPackages.
**Note:** The TurboModule system can only create TurboModules in LazyReactPackages.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D43254982
fbshipit-source-id: 4260cc7dc1d28b1ad6268087720c6e02cfc20d32
Summary:
## Problem
The TurboModule system can only create modules in TurboReactPackages. We want to change this. The TurboModule system should integrate with all of React Native's ReactPackages.
## Changes
ReactPackageTurboModuleManagerDelegate integrates the TurboModule system with React Native's ReactPackage infra.
This diff refactors ReactPackageTurboModuleManagerDelegate, so that it can eventually support many different types of ReactPackages.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D43066961
fbshipit-source-id: d793e14353382dc4cf9ea4af5a7ffe5c83e3baf6
Summary:
The TurboModule interop layer is a new mode for the TurboModule system.
Goal: Make the TurboModule system incrementally adoptable in **Bridgeless mode.**
What it does: Run all legacy modules through the TurboModule system in Bridgeless mode.
How to enable it:
1. Enable Bridgeless Mode: ReactFeatureFlags.enableBridgelessArchitecture = true.
2. Set ReactFeatureFlags.useTurboModuleInterop = true.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D43715758
fbshipit-source-id: 89470a28d1f37b9010beb84e43f62425473de8b5
Summary:
Fix circle CI failure, error:
```
stderr: : warning: unknown enum constant androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX
: warning: unknown enum constant kotlin.annotations.jvm.MigrationStatus.STRICT
reason: class file for kotlin.annotations.jvm.MigrationStatus not found
/root/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java:105: error: local variable launchOptions is accessed from within inner class; needs to be declared final
return ReactActivityDelegate.this.createRootView(launchOptions);
^
/root/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java👎 note: Some input files use or override a deprecated API.
/root/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java👎 note: Recompile with -Xlint:deprecation for details.
/root/react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java👎 note: Some input files use unchecked or unsafe operations.
/root/react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java👎 note: Recompile with -Xlint:unchecked for details.
Errors: 1. Warnings: 2.
```
https://app.circleci.com/pipelines/github/facebook/react-native/20239/workflows/31711cb5-6603-432e-a869-d76c9391536e/jobs/473257?invite=true#step-107-261
Changelog:
[Android][Changed] - Fix circle CI failure
Reviewed By: cipolleschi
Differential Revision: D43976548
fbshipit-source-id: 2d50d37bbc78cb1264af9d6fffbfe60f24326cec
Summary:
Make Venice available in Catalyst Android, to enable set ```ReactFeatureFlags.enableBridgelessArchitecture``` to true in CatalystApplication.java
**Note**: right now not every piece works with Venice enabled, but the main functionalities (Fabric components, playground) mostly work, the rest issues will be gradually fixed.
Changelog:
[Internal][Changed] - Enable Venice in Catalyst Android
Reviewed By: NickGerleman
Differential Revision: D43711737
fbshipit-source-id: 6ecb7e2b09c5b7feaa00b90076a2a894c08affc9
Summary:
The original diff D43711708 was reverted due to a problem caused on Ads Manager App Android. Re-land while make sure Ads Manager not broken.
Changelog:
[Android][Changed] - Re-land "Migrate packages to not eager initialize view managers"
Reviewed By: RSNara
Differential Revision: D43907600
fbshipit-source-id: 92f99fd3f9ba90d1798d4ec9c03feff00070a47c
Summary:
glog logging was being sent to adb logcat twice since `fbgloginit` uses `force_static = True` and was being linked as two separate copies.
Changelog: [Internal]
Reviewed By: sshic
Differential Revision: D43842295
fbshipit-source-id: da4233d29dbddc2b3cefdca979c873479672b11c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36385
This change moves the `graphics/conversions.h` files from `ReactCommon/react/renderer/graphics` to `ReactCommon/react/renderer/core`, renaming it to `graphicsConversions.h`.
This is required because React-Fabric imports graphics, but graphics imports React-Fabric due to this file.
The change would be breaking, but we don't want to break the ecosystem without even a warning. So, we put back the `conversions.h` file, which now just `include` the new one and outputs a warning when building. This actually maintain the dep cycle for the current version, but at least users are warned.
## Changelog:
[iOS][Deprecated] - Deprecate the `ReactCommon/react/renderer/graphics/conversions.h` in favor of `ReactCommon/react/core/graphicsConversions.h`
Reviewed By: cortinico, dmytrorykun
Differential Revision: D43836261
fbshipit-source-id: ffe53a8ce2b0ea2dd1e1e5aaf6b3d3c5b57ad46d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36395
NativeState is a lighter-weight alternative to HostObject, which may simplify some of our use-cases of interacting with JS in the renderer. The down-side is that this approach doesn't allow exposing custom props or functions.
This diffs adds new feature flags to enable experimenting with this functionality and measure any perf impact.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D41553421
fbshipit-source-id: 3065bd7b60f0fa7b63c390e92a785582eee7e613
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36202
This changes all of the in-built dependencies in react native app components upon hermes from HermesAPI to HermesAPIFullOrLean.
HermesAPI (full) includes the bytecode compiler and thus has support for eval().
HermesAPILean does not include the bytecode compiler. It throws at runtime if eval is called. The native dependencies are significantly smaller without the bytecode compiler.
The HermesAPIFullOrLean target toggles between full and lean modes based on the value of buckconfig field `hermes.lean_vm` (default is false). Therefore, without overriding this config option, this change is a no-op and should result in react native apps being built with exactly the same dependencies as before.
If you do specify it, you lose eval support at runtime and gain an apk size savings of a few hundred kB after compression.
This also removes the vestigial `hermes_api_dep()` build macro.
skip-frl-buck-targeting
Reviewed By: javache
Differential Revision: D43283200
fbshipit-source-id: 0157be4a9339f70e73d29d694c18b31805107000
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