Summary:
CellRendererComponent can be given a more useful description, and more constrained type, to ensure it is used more correctly.
Changelog:
[General][Fixed] - Fix types + documentation for CellRendererComponent
Reviewed By: yungsters
Differential Revision: D43925572
fbshipit-source-id: 26aae6a2df989993c97709ffbf1544df7cbae036
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 change updates the offline mirrors and remove the need for destinations in Sandcastle jobs, to mitigate the problem with the oss jobs we are facing.
allow-large-files
## Changelog:
[internal] - update offline mirror and don't run tests on simulators
Reviewed By: robhogan, dmytrorykun
Differential Revision: D44056468
fbshipit-source-id: c4db37a715eb1307a01a33b1917573f67ed0e2a7
Summary:
The contract here is that `initialScrollIndex` only applies once, right after the components mount. There is other code still relying on live `initialScrollIndex`, which is allowed to become stale. E.g. after removing items.
I looked at a larger change of only ever using `initialScrollIndex` in the start, so we have a consistent value. We also ideally should fix up the logic relying on it for the scroll to top optimization.
That series of changes is more involved than I want to spend time on, so this just avoids the check once we have triggered a scroll, where the rest of the code is UT'd to be permissive if it drifts out of allowed.
Changelog:
[General][Fixed] - Allow out-of-range initialScrollIndex after first scroll
Reviewed By: yungsters
Differential Revision: D43926656
fbshipit-source-id: bd09bd9a9aa6b3b5f07209dac8652c9374a762c4
Summary:
After https://github.com/facebook/react-native/pull/36122 we have two of these. This change consolidates the two category methods to be part of the base RCTConvert class instead.
Changelog:
[iOS][Fixed] - Fix duplicate [RCTConvert UIUserInterfaceStyle:]
Reviewed By: cipolleschi
Differential Revision: D44050929
fbshipit-source-id: dd216545e6194446c593cd693072f3959d653d7f
Summary:
This adds a feature flag to enable all the new DOM traversal and layout APIs (in https://github.com/react-native-community/discussions-and-proposals/pull/607).
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D43981608
fbshipit-source-id: 77bb1ee4faaaf30cfc8bb2e493763b168702f498
Summary:
We shouldn't be accessing `nativeFabricUIManager` directly because it's untyped and makes it harder to mock the values.
This migrates all existing usages to the `FabricUIManager` module.
In the long term, we should refactor this global binding as a TurboModule.
Changelog: [internal]
Reviewed By: yungsters
Differential Revision: D44029301
fbshipit-source-id: d8300acb5dabe4ba27c7f0242230e203c0e8c674
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:
Pull Request resolved: https://github.com/facebook/react-native/pull/36461
This change breaks a dependency cycle between `ReactCommon` and `React-Core`.
`React-Core` depends on `ReactCommon` to have access to the various `TurboModule` native files.
`ReactCommon` depends on `React-Core` because the content of the `core/platform/ios` folder and the `samples` folder needs to access the `RCTBridge` and other files in Core.
To break the circular dependency, we introduced two new `podspecs`:
* `React-NativeModulesApple` for the content of `core/platform/ios`.
* `ReactCommon-Samples` for the content of the `samples` folder.
In this way, the new dependencies are linear as `React-NativeModulesApple` and `ReactCommon-Samples` depends on `React-Core` and `ReactCommon` and `React-Core` only depends on `ReactCommon`.
While doing this, we also make sure that all the include path are aligned, to limit the amount of breaking changes.
## Changelog:
[iOS][Breaking] - Split the `ReactCommon/react/nativemodule/core/platform/ios` and `ReactCommon/react/nativemodule/samples` in two separate pods to break circular dependencies.
Reviewed By: mdvacca
Differential Revision: D44023865
fbshipit-source-id: a97569506350db5735ac5534b1592471de196cbe
Summary:
Changelog: [Internal]
Implements a shim for the NativePerformance TurboModule, which can be used as a mock to unit test the JS side of WebPerformance functionality (in particular, the higher level API logic of `Performance` and `PerformanceObserver` implementations in JS) without need to have the native NativePerformance implementation available (which would otherwise require running some heavy weight e2e tests).
Reviewed By: rubennorte
Differential Revision: D43985454
fbshipit-source-id: da10387c1d70cb0300c077972d3925bc2fad4f5e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36438
This makes the `react-native` repository compatible with the next sync from react after the changes in https://github.com/facebook/react/pull/26321 land.
That PR is changing the format of the Fabric instance and we have a few instances where we assume the internal structure of that instance in the repository.
Changelog: [internal]
Reviewed By: yungsters
Differential Revision: D43980374
fbshipit-source-id: 718b504ff7c5bb6088c553e0256489b04d92b653
Summary:
## Rationale
JavaTurboModule holds the module object as a JTurboModule. With the TurboModule inteorp layer, JavaTurboModule will also need to hold NativeModule objects.
## Changes
So, this diff makes JavaTurboModule hold the module object as a jobject instead.
This shouldn't impact method dispatch, because method dispatch doesn't rely on the JTurboModule interface.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D43918939
fbshipit-source-id: 7cc43dfe2df7571e39bcf4d6f362dde0e500e2fe
Summary:
## Rationale
Better separation of concerns. Less confusion. All the logic around TurboModule HostFunction management is in TurboModule::get(). And TurboModule::createHostFunction() is only responsible for creating the HostFunction. Also, there aren't two TurboModule::get functions, each with different/unclear responsibilities.
## Motivation
The interop layer (i.e: D43918998) will have to override TurboModule::createHostFunction():
- TurboModule::createHostFunction() relies on static functions for method dispatch.
- The interop layer cannot use static functions for method dispatch: interop modules' methods are only be discoverable at runtime.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D43918940
fbshipit-source-id: f2ffd210329a10967e9b2f0c925f4990cb470083
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:
Pull Request resolved: https://github.com/facebook/react-native/pull/36402
## Changelog:
[Internal] -
Makes `GlobalPerformanceLogger` (`IPerformanceLogger` API), additionally use the native WebPerformance implementation (`Performance` and `PerformanceObserver` APIs) to log points/timespans as marks/measures correspondingly.
This will ultimately help to converge performance logging facilities across platforms and language boundaries.
In a shorter term, it can serve as a good case study of using the Web Performance API implementation.
Note that this implementation is disabled by default (controlled by the RN feature flag), and will be enabled separately via na experiment.
Reviewed By: rubennorte
Differential Revision: D43873560
fbshipit-source-id: 22e2d787c8f22d2f67556dfe4bf175743eca2caf
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:
Pull Request resolved: https://github.com/facebook/react-native/pull/36417
This changes adds an example to RNTester to verify that the Interop Layer can process constants in Fabric as it used to do in Paper.
## Changelog:
[iOS][Added] - Add example in the Interop Layer to use constants
Reviewed By: cortinico
Differential Revision: D43911916
fbshipit-source-id: 1d4b630d45d21904c53d85b97607ebb7fb8a62fc
Summary:
This changes adds an example to RNTester to verify that the Interop Layer can process bubbling events in Fabric as it used to do in Paper.
## Changelog:
[iOS][Added] - Add example in the Interop Layer to use events
Reviewed By: sammy-SC
Differential Revision: D43911390
fbshipit-source-id: ae75db25078669676e5a609e090f1e9674026391
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:
Pull Request resolved: https://github.com/facebook/react-native/pull/36421
Changelog: [Internal]
Adding an extra choice for commit question, user can now choose between three options:
1. Commit with generic message, no further actions needed
2. Commit with custom message, intercative VIM input will open
3. Not committing anything
Reviewed By: cortinico
Differential Revision: D43943526
fbshipit-source-id: 014215105d192961486b7d1c697f491697492812
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36419
After migrating to Xcode 14.2.0, some contributors were receiving CircleCI Machines that were not able to install Ruby 3.2.0.
This change should improve the robustness of the pipelines, ensuring that `ruby-build` can always find the version of Ruby it needs
## Changelog:
[internal] - Make sure CircleCI always find the right version of Ruby
Reviewed By: cortinico
Differential Revision: D43944878
fbshipit-source-id: 89d9fcc6ae346003e96c2a8f4103a83a7d2f3204
Summary:
Refactor the startup performance API so that we are not using a vector to store only a few startup metrics values. This makes the metrics more strictly typed and concise.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D43860049
fbshipit-source-id: 2c2102de2b64e2c5cda509ac26f0d1d072287083
Summary:
Adds changelog for new patch.
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - add changelog entry for 0.71.4
Pull Request resolved: https://github.com/facebook/react-native/pull/36405
Test Plan: N/A
Reviewed By: christophpurrer
Differential Revision: D43910075
Pulled By: cipolleschi
fbshipit-source-id: 4f0b7fb45c07895dbddedd08553b84460043c948
Summary:
VirtualizedList today will keep refs to cells around, long after they have been unmounted. This leaks memory, and is not needed.
Changelog:
[General][Fixed] - Delete refs to unmounted CellRenderers
Reviewed By: yungsters
Differential Revision: D43835135
fbshipit-source-id: 2104cae977a4e2e9e1a2738e1523ac1796293b4f
Summary:
This adds `librrc_legacyviewmanagerinterop.so` to the pickFirst block inside RNGP.
While testing the Fabric Interop layer, I realized that I forgot to add it here and now the build
fires a warning as follows:
```
> Task :app:mergeDebugNativeLibs
2 files found for path 'lib/arm64-v8a/librrc_legacyviewmanagerinterop.so'. This version of the Android Gradle Plugin chooses the file from the app or dynamic-feature module, but this can cause unexpected behavior or errors at runtime. Future versions of the Android Gradle Plugin may throw an error in this case.
Inputs:
- /private/tmp/RNNightly/android/app/build/intermediates/cxx/Debug/194810a4/obj/arm64-v8a/librrc_legacyviewmanagerinterop.so
- /Users/ncor/.gradle/caches/transforms-3/ba1c1d3560a64e70d8218910c5a43605/transformed/jetified-react-android-0.0.0-20230302-2110-caf80d442-SNAPSHOT-debug/jni/arm64-v8a/librrc_legacyviewmanagerinterop.so
```
Changelog:
[Internal] [Changed] - RNGP - Add librrc_legacyviewmanagerinterop to pickfirst config block
Reviewed By: cipolleschi
Differential Revision: D43772845
fbshipit-source-id: cf34bb128b76f18e802a94c41c773f7cb2b7ec4a
Summary:
Faacebook:
For both Paper and Fabric, at least on Android, RNTester TextInputs using the default style render as collapsed. This seems to be an interaction between the TextInputs being set as `flex: 1`, and being rooted in a ScrollView.
The issue still seems to happen when the outer container is large enough, but non-scrolling, which seems like a layout bug. But we can for now root the E2E container in a ScrollView (which we probably want to do anyway to allow long examples).
Changelog:
[Internal]
Reviewed By: mdvacca
Differential Revision: D43714494
fbshipit-source-id: ef1f8929ceeaef0d2c87262cf0446e0c6644cc9d
Summary:
changelog: [internal]
This diff introduces a mechanism to cache NSTextStorage on Paragraph's state. The old renderer already has caching for NSTextStorage: https://github.com/facebook/react-native/blob/main/Libraries/Text/Text/RCTTextShadowView.m#L21
Fabric will store `NSTextStorage` inside `ParagraphLayoutManager` which is owned by state.
There is one notable change which is not gated: Paragraph's state strongly owns `TextLayoutManager`, not `ParagraphShadowNode` like previously. This shouldn't change anything
Reviewed By: mdvacca
Differential Revision: D43692171
fbshipit-source-id: efe6077222a30ab6d89abd9916534b9a96e745d4
Summary:
This is a change upstreamed from our fork, React Native macOS: https://github.com/microsoft/react-native-macos/pull/1088
Original description:
>We hit some crashes where replacing the chars in the string in the description was happening at an invalid range. That caused investigation into what these description methods are doing. We shouldn't have code assuming super's description will return in a certain format. Instead, just append any additional info we want to add to the end of the description.
## Changelog
[IOS] [CHANGED] -Remove assumptions on super's description
Pull Request resolved: https://github.com/facebook/react-native/pull/36374
Test Plan: CI should pass
Reviewed By: cipolleschi
Differential Revision: D43906367
Pulled By: javache
fbshipit-source-id: f83a67c5890ad1f8a73bc644be1f0f8b22b1a371