Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52679
Changelog: [internal]
Reverting to make the fix easier to pick. Will land again on top.
Original commit changeset: c18e967488de
Original Phabricator Diff: D78480136
Reviewed By: cortinico
Differential Revision: D78497510
fbshipit-source-id: 8037276cb70d27ff695c76cd9575b525568c4489
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52592
Changelog: [Internal] - Expose VirtualViewExperimental in JS, use in a test surface
Reviewed By: yungsters
Differential Revision: D78027899
fbshipit-source-id: d3d9808b8ba8e36c5fdb0c831c0855ed318d0a30
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52590
Changelog: [Internal] - Fix a couple of bugs with VirtualViewExperimental
1. `also` side-effect bug where we were accessing `scrollView` before it was assigned
2. Handling empty `rect`. Now, we don't add the virtualView until it has a non-empty rect layout
Reviewed By: yungsters
Differential Revision: D78287690
fbshipit-source-id: 1806b748a0117e51c7a201191396d79db3a8d205
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52673
We should be incrementing the `attempts` variable as otherwise this loop with never stop.
Created from CodeHub with https://fburl.com/edit-in-codehub
Changelog:
[Internal] -
Reviewed By: rubennorte
Differential Revision: D78487202
fbshipit-source-id: 91d7f5d88a90bdfa806195fd35897f2f51c1deb9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52633
Changelog: [internal]
Now that we have the correct type definition for `console.timeStamp` we can remove the unnecessary `$FlowFixMe` annotations we had to add to use the new arguments.
Reviewed By: hoxyq
Differential Revision: D78405312
fbshipit-source-id: 29378ee6fa5986e22d0dfdfb85b7e25375361dc9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52632
Changelog: [internal]
This improves the type definitions for methods in the global `console` object, most importantly:
- Removes use of `any`.
- Defines correct typing for `console.timeStamp`, including new parameters for the Chrome Extensibility API.
Reviewed By: hoxyq
Differential Revision: D78405314
fbshipit-source-id: 6f31cc3005ff708ef6aa155bcd150d53a845e66c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52631
Changelog: [internal]
Just a small improvement in the type definitions to serve as documentation for the expected arguments for custom tracks in RNDT.
Reviewed By: hoxyq
Differential Revision: D78405313
fbshipit-source-id: 75d250ea27f2e55e172aaf6e72399b85cecd43f4
Summary:
This PR fixes logging of rejections, which stopped working with the transition from using `LogBox` for warnings to directing users to use React Native Debugger, where warnings can be viewed in the `Console` tab.
Rejected promises before this PR used `LogBox.addLog` with the `level: warn` directly without `console.warn`, which notified users to open debugger to view a warning (after rejected promise) without actually printing any warnings to the console.
This PR uses `ExceptionsManager.handleException(error, false /* isFatal */);` for promise rejections that correctly raising an error to the console if needed.
### Rejected Promise in Chrome
Displaying the error as long as it's uncaught in the form:
`Uncaught (in promise) Error`
and if there's a message in that error:
`Uncaught (in promise) Error: ${message}`
once the error is handled, this error disappears:
{F1978806409}
This is done with `Runtime.exceptionThrown`, and `Runtime.exceptionRevoked`:
{F1979815326}
## Changelog:
[General][Breaking] unhandled promises are now handled by ExceptionsManager.handleException, instead of being swallowed as Logbox Warnings.
----
This is a breaking change because we changed the wording for these errors and because some systems (like Sentry) might start monitoring a new set of errors when this code is adopted.
Pull Request resolved: https://github.com/facebook/react-native/pull/51594
Test Plan:
Use `Promise.reject` and observe that the rejection is now shown symbolicated in LogBox and also printed in React Native Debugger Console.
```
<Button
title="Uncaught Promise Rejection"
onPress={() => {
const err = new Error('test error');
err.cause = new Error('cause');
const promise = Promise.resolve().then(() => {
throw err;
// also test with throwing a string / object:
// throw 'aa';
// throw {test: 'object'};
// return Promise.reject();
});
setTimeout(() => {
promise.catch(e => {
console.log('promise error caught', e);
});
}, 4000);
}}
/>
```
### Before
There's no indication whatsoever there's an uncaught promise.
### After
An error is logged:
Error-
{F1979749366}
Text-
{F1979749350}
Object-
{F1979749351}
Promise.reject() or undefined-
{F1979749826}
Reviewed By: hoxyq
Differential Revision: D75442651
Pulled By: vzaidman
fbshipit-source-id: bf6c56e643f03997f5a604b85c543aad62648a29
Summary:
When switching between debug/release we run a small script to make sure to copy the correct version of the RNDeps xcframework.
This script was missing a resolve function that fixed up some path issues that we do when installing in the podspec.
## Changelog:
[IOS] [FIXED] - Fixed issue with RNDeps release/debug switch failing
Pull Request resolved: https://github.com/facebook/react-native/pull/52664
Test Plan:
- Create new RN App
- Install pod with prebuilt deps
- Build (success)
- Switch to release
- Build (success)
Reviewed By: cortinico
Differential Revision: D78481590
Pulled By: cipolleschi
fbshipit-source-id: 2d02b0bc55e8aef6f3fafb4f7aa193c4cf00414e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52662
Changelog: [internal]
In the original change I made in D78418504 / https://github.com/facebook/react-native/pull/52645 I made a mistake and used a lock that would try to re-lock on itself without it being recursive (which would cause a deadlock). I didn't see that because when testing I didn't hit the case where we'd exhaust the options.
This propagates a flag to `tryCommit` to indicate we've already locked on the `commitMutex_` so we don't need to lock again in that case, fixing the issue.
Reviewed By: sammy-SC
Differential Revision: D78480136
fbshipit-source-id: c18e967488de14e73e6abf6f6e82c16bc42a12c6
Summary:
When switching between release/debug we're running a script to copy the correct xcframework. This script for the React-Core prebuilts was not part of the package.json file.
This caused the build to fail after trying to switch from debug -> release.
## Changelog:
[IOS] [FIXED] - Fixed missing script for resolving prebuilt xcframework when switching between release/debug
Pull Request resolved: https://github.com/facebook/react-native/pull/52663
Test Plan:
- Create new RN App
- Install pod with prebuilt deps and core
- Build (success)
- Switch to release
- Build (success)
Reviewed By: cortinico
Differential Revision: D78481302
Pulled By: cipolleschi
fbshipit-source-id: 1c7181e63219098ae140d77ff1cb2c0c9b9642e5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52661
The CI is currently red on main due to a missing dependency on `rrc_view`
from the recent TransformHelper.cpp addition.
This fixes it.
Changelog:
[Internal] [Changed] -
Reviewed By: cipolleschi
Differential Revision: D78479785
fbshipit-source-id: 3d2b698d9ce46cf22c15ad43005f621526590145
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52660
The documentation for those methods mention that users should override them to
provide their own implementation.
However those vals are not `open` so users cannot really override them.
This fixes it.
See more context on https://github.com/facebook/react-native/pull/48800#issuecomment-3082665024
So this was practically a breaking change, that I'm attempting to mitigate.
Changelog:
[Android] [Fixed] - Make accessors inside HeadlessJsTaskService open again
Reviewed By: cipolleschi
Differential Revision: D78479162
fbshipit-source-id: eefc7332e2004198cd6bd64b60a66215f137ad4a
Summary:
Changelog: [Internal]
Adds a basic `--version` command line flag to the RNDT shell. This will be used in code paths (including tests) that need to verify that the shell is executable, but do not need to actually display a window or hand over control to the main shell instance.
bypass-github-export-checks
Reviewed By: huntie
Differential Revision: D78351936
fbshipit-source-id: e8982cfea6435da0ac9ea5f50d57c7642a8e2edb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52640
Not having `TransformHelper.cpp` included in CMake is causing the C++ code to fail compiling.
This diff fixes it.
Changelog:
[Internal] [Changed] -
Reviewed By: cipolleschi, javache
Differential Revision: D78414015
fbshipit-source-id: 4900427a86eb38bfec10e5e385296d89c73e9051
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52639
Add feature flag in the attempt to address the pile of tasks reporting the following error in panelapps:
> Error: android_crash:java.lang.AssertionError:com.facebook.react.runtime.ReactHostImpl.onHostPause
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D78339196
fbshipit-source-id: 9ef748e7ea85f179d8f8c418a978bd5c99f70601
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52612
changelog: [internal]
View Culling is purely performance optimisation but it must work correctly with accessibility features like VoiceOver and Switch Control.
In this diff, View Culling is lazily disabled whenever use of an accessibility feature is detected to make sure all views are present in the view hierarchy.
Reviewed By: NickGerleman, philIip
Differential Revision: D78336010
fbshipit-source-id: 7a201afc8e2ffd8b586d75ed4de2c03d7966750c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52604
changelog: [internal]
For Fabric View Culling to work correctly, content offset changes must be applied synchronously to avoid UI flicker.
The flicker happens because content offset update happens asynchronously and the OS paints scroll position update before React Native has a chance to adjust view hierarchy for the new scroll position.
Reviewed By: lenaic
Differential Revision: D78334322
fbshipit-source-id: dc1f1b3f9db9f9547e5a588dc184fcf21cca2727
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52603
Processing transforms is expensive in Java, as it requires bridging the entire ReadableNativeArray/Map. Instead, we can use the existing parser logic `resolveTransform` logic to perform this operation in C++.
Ideally, we actually re-use the existing parsed transform from Props, that could be something we revisit after Props 2.0.
As a follow-up, we should consider also moving the matrix decomposition logic from MatrixMathHelper here, and make that the only information we send back to Java.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D78298588
fbshipit-source-id: a698ac8587ccfb2be04665747082398ccdde9294
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52611
We compare the current transform (represented as a ReadableArray) with the incoming one to know whether to invalidate. This can be expensive as it requires to materialize the entire transform data structure over JNI. Instead, we can delegate this comparison to native code, which can compare the underlying folly::dynamic directly.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D78340288
fbshipit-source-id: f44a054e234694c316fb080fe2dbc2017780123a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52613
Changelog: [internal]
This adds first-class support for the `detail` field in `performance.mark` and `performance.measure`.
Now that we have access the JS entry in native, we can access the `detail` field to propagate it to DevTools (and use it to extract track names for Perfetto).
In order to avoid the performance overhead of always having to extract the `detail` field from the entry, this is done lazily only if we're actively profiling with DevTools or Perfetto.
Reviewed By: sbuggay
Differential Revision: D78340911
fbshipit-source-id: 383dd1cb6fcc8a04be9e65038503986f196e23c9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52614
Changelog: [internal]
We're adding first-class support for custom tracks, so we can remove the legacy mechanism to specify tracks with the "Tracks:" prefix in the event names.
Reviewed By: sbuggay
Differential Revision: D78340910
fbshipit-source-id: cbbadd519baf7bb50072cb97d8cd1ccc87a8a35c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52588
Changelog: [internal]
This adds tests to show how `performance.measure` isn't spec compliant when `end` and `duration` are used. This will be fixed in the following diff.
Reviewed By: javache
Differential Revision: D78193069
fbshipit-source-id: 30ba4874c4d2b4adb20608fc8d5ed61bfd6d92d8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52587
Changelog: [internal]
This just re-organizes the tests for the `Performance` API and `PerformanceObserver` as the previous organization didn't make much sense. Now it's a test for `PerformanceObserver` and another for the User Timing API.
Reviewed By: huntie
Differential Revision: D78193070
fbshipit-source-id: f15524bf07d2dc9edc155214279ce3af705cde67
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52621
In D77261958, I made a typo when implementing the cleanup of window focus detection in `onDetachedFromWindow`. This fixes it.
Changelog:
[Internal]
Reviewed By: mdvacca
Differential Revision: D78366506
fbshipit-source-id: 2a377cd7e8ec08f0c899dbd9cb3757bec580d30f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52583
Changelog: [Internal]
OSS build is broken atm as there is rn-tester dep in Fantom, needed for Meta only purposes.
Platformizing code to allow for Meta only implementation here and also for OSS only. Using this approach over ifdef.
Reviewed By: christophpurrer
Differential Revision: D78275698
fbshipit-source-id: c3234bb61b4591c0a5045fdb84aa0316f6382ecc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52607
changelog: [internal]
The current design of enableSynchronousStateUpdates is not correct and breaks <Modal /> on Android. let's delete it.
Reviewed By: philIip
Differential Revision: D78332201
fbshipit-source-id: 109909ebc706168372c565e8ff6e0c95d7565b10
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52584
The method `_initializeUIRefreshControl` creates a new instance of `UIRefreshControl` which has the default values for things like tint color.
However the props that we are keeping in the component are the `_props` before recycling. The actual state of the newly created UIRefreshControl is out of sync w.r.t the props the component thinks to have.
By introducing a `_recycled` state variable, we can force the first `updateProp` call to apply all the props to the newly created component.
## Changelog:
[iOS][Fixed] - Make sure that the recycled refresh control have the right props setup.
Reviewed By: sammy-SC
Differential Revision: D78278207
fbshipit-source-id: 4be20aa43f96eb87828b44a4deedd33a23d1d17f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52615
The refresh control has some issues that this change addresses.
- Issue with zIndex not propagating to RefreshControl.
- Issue when RefreshControl being mounted as refreshing.
- Issue with color props not applied
## Changelog:
[iOS][Fixed] - Correctly propagate props to RefreshControl
Reviewed By: sammy-SC
Differential Revision: D76668478
fbshipit-source-id: c3a5ff04b1b2654d25c9053973c5cff0002a804a
Summary:
This PR adds the basic `ktfmt` setup in OSS to lint Kotlin files before they're imported into the Meta codebase, making collaboration with external contributors smoother for Android related PRs.
I tried to put together certain rules that mimic the current code style and it seems to work well as I get no errors for properly formatted files but this still might need some input to have the correct configuration.
Added two scripts to the main package.json:
- To check the files format you can run: `yarn lint-kotlin-check`
- To apply formatting fixes, run: `yarn lint-kotlin`
## Changelog:
[INTERNAL] - Kotlin: Set up ktfmt in OSS
Pull Request resolved: https://github.com/facebook/react-native/pull/52064
Test Plan:
Unformat any random Kotlin file inside ReactAndroid and then run:
```sh
yarn lint-kotlin-check
yarn lint-kotlin
```
Reviewed By: cipolleschi
Differential Revision: D78272876
Pulled By: cortinico
fbshipit-source-id: 0cf6b976968dfc5c6c478e88d17eb21c18961a34
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52602
changelog: [internal]
fixes RTL issue in View Culling where scroll view offset was not correctly adjusted for RTL. The example failing case is described in a test.
Reviewed By: lenaic
Differential Revision: D78322759
fbshipit-source-id: d60d98aa45d4d9b576b133990f64ef941e6618e8
Summary:
for IOS and React native windows we can observe that the macro conversion is incorrect in ParagraphProps particularly for selectable prop.
current conversion
```
case ([]() constexpr -> RawPropsPropNameHash { return facebook::react::fnv1a("isSelectable"); }()): fromRawValue(context, value, isSelectable, defaults.isSelectable); return;
```
issue is that isSelectable is not the raw prop therefore JS to native flow for the prop is not correct .
(Note : this works for Android as ReactProp(name = "selectable"): https://github.com/facebook/react-native/blob/bbc1e121c71d14803d29a931f642bf8ea6ee2023/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.kt#L97-L100 )
fix
```
RAW_SET_PROP_SWITCH_CASE(isSelectable, selectable)
```
Current implementation selectable prop is not working for IOS and React native windows as the macro conversion is incorrect in ParagraphProps particularly for selectable prop.
## Changelog:
Updated ParagraphProps macro conversion for isSelectable , keeping it backward compatible.
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[IOS] [FIXED] - Fix selectable prop not working correctly
[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/52599
Test Plan:
Tested on react native windows playground
Sample code
```
export default class Bootstrap extends React.Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.header}>Selectable vs Non-Selectable Text</Text>
<Text selectable={true} style={styles.text}>
✅ This text is selectable. You can long-press and copy it.
</Text>
<Text selectable={false} style={styles.text}>
❌ This text is not selectable. You cannot copy it.
</Text>
</View>
);
}
}
```
before fix debug output , native unaware of selectable prop values from JS
```
ReactNative ['Samples\text'] (info): ''[Text.js] NativeText _selectable:', true'
ReactNative ['Samples\text'] (info): ''[Text.js] NativeText _selectable:', false'
[ParagraphComponentView] updateProps - old isSelectable: 0, new isSelectable: 0
[ParagraphComponentView] DrawText - isSelectable: 0
[ParagraphComponentView] DrawText - selection logic would be DISABLED here.
[ParagraphComponentView] updateProps - old isSelectable: 0, new isSelectable: 0
[ParagraphComponentView] DrawText - isSelectable: 0
[ParagraphComponentView] DrawText - selection logic would be DISABLED here.
[ParagraphComponentView] updateProps - old isSelectable: 0, new isSelectable: 0
[ParagraphComponentView] DrawText - isSelectable: 0
[ParagraphComponentView] DrawText - selection logic would be DISABLED here.
```
after fix debug output , native picks up selectable prop values from JS correctly
```
ReactNative ['Samples\text'] (info): ''[Text.js] NativeText _selectable:', true'
ReactNative ['Samples\text'] (info): ''[Text.js] NativeText _selectable:', false'
[ParagraphComponentView] updateProps - old selectable: 0, new selectable: 0
[ParagraphComponentView] DrawText - selectable: 0
[ParagraphComponentView] DrawText - selection logic would be DISABLED here.
[ParagraphComponentView] updateProps - old selectable: 0, new selectable: 1
[ParagraphComponentView] DrawText - selectable: 1
[ParagraphComponentView] DrawText - selection logic would be enabled here.
[ParagraphComponentView] updateProps - old selectable: 0, new selectable: 0
[ParagraphComponentView] DrawText - selectable: 0
[ParagraphComponentView] DrawText - selection logic would be DISABLED here.
```
Reviewed By: rozele
Differential Revision: D78333906
Pulled By: javache
fbshipit-source-id: 4d2f9ea591e991b1aed126e9fed72fdfe1a49ce9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52598
Defining this as {50%, 50%} mean we do unnecessary work as part of every transform. Instead set it to undefined, which means we'll ignore it when determining the final transform.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D78298587
fbshipit-source-id: 9d3b7375fc3bd9ea04f0a6d7e314fbba0fba6949
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52597
Add a Flow lib def for `memfs`, for use in internal and subsequently Metro tests, now that `metro-memory-fs` is deprecated.
Changelog: [Internal]
Reviewed By: vzaidman
Differential Revision: D78268713
fbshipit-source-id: f714000f2071f4bf45b4436cbd63fc6d74939f98
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52446
The logic for retrieving metrics from a placeholder character is kind of insane, and has been around since inline views were added built into TextView in Paper.
One of the workarounds, for old versions of Android on Samsung phones (no more info to bound the versions) causes incorrect behavior, at least in the case where we have RTL text in LTR layout.
Another, explicitly mentions `singleLine` with RTL para, a deprecated TextView prop, that doesn't apply to us here (and also could never apply to BoringLayout, since RTL chars are not boring).
We don't have these workarounds anywhere else (though we have some other workarounds for bidi crash in old Android), including other frameworks I could find.
Let's bias to cleaning this old code up.
Changelog:
[Android][Fixed] - Fix incorrect positioning of inline view at the end of string when RTL text in LTR container
Reviewed By: javache
Differential Revision: D77703906
fbshipit-source-id: f25a5e2f05100f0288f3889132b658cdabf26f22