Summary:
Changelog: [internal]
Introducing LeakChecker. A tool that checks if all native components have been cleaned up when surface is stopped.
**Known shortcomings**:
- LeakChecker is only enabled in debug builds and the existence of leaks is logged to console.
- For now, Leak Checker looks at N-1 screen. This is intentional as there is a known limitation of React that doesn't free up all shadow nodes when surface is stopped. Because of this, the use of LeakChecker is not intuitive and I'll work with React team to try to work around this.
- It doesn't help locating the leak, it only informs that leak is present. I'll be looking into ways to help locate the leak.
Reviewed By: JoshuaGross, mdvacca
Differential Revision: D26727461
fbshipit-source-id: 8350190b99f24642f8e15a3c2e1d79cfaa810d3d
Summary:
Changelog:
[General][Changed] - Change VirtualizeUtils to use ESM and change function signature on `computeWindowedRenderLimits` as part of larger effort to remove defaultProps from VirtualizedList
Reviewed By: nadiia
Differential Revision: D26969586
fbshipit-source-id: cd1961a2088d37543dbc9bca8c4a062cdb426a35
Summary:
Changelog:
[Internal][Changed] - Remove initialNumToRender from defaultProps as part of larger effort to remove defaultProps from VirtualizedList
Reviewed By: nadiia
Differential Revision: D26969585
fbshipit-source-id: 8674544c06b7b99eee693cc7508c9e4199232e98
Summary:
If a root view is initialized with a bridge that is already loaded, then it immediately will initialize its content view with a zero size, which results in that content view's size being calculated according to its content instead of the size set on the root view after initialization. This would lead to a race condition where sometimes the content view has a smaller size than the root view.
Changelog:
[iOS][Added] - Allow RCTRootView to be initialized with a frame
Reviewed By: PeteTheHeat
Differential Revision: D27052637
fbshipit-source-id: 384ab3be27c92c0d84d34d49afb697882335d890
Summary:
Changelog:
[Internal][Changed] - Remove horizontal from defaultProps as part of larger effort to remove defaultProps from VirtualizedList
Reviewed By: nadiia
Differential Revision: D26969583
fbshipit-source-id: c21ac15a220a68a58e32b78dcc37c053756b72cf
Summary:
Changelog:
[Internal][Changed] - Remove disableVirtualization from defaultProps as part of larger effort to remove defaultProps from VirtualizedList
Reviewed By: nadiia
Differential Revision: D26969587
fbshipit-source-id: 662fa620bc5b6b9a64c1906f62dae1f4b373a23b
Summary:
The non-Fabric API has a `blockNativeResponder` param in setJSResponder. Make sure to pass that along in Fabric.
On Android this allows us to respect the flag and do the same thing non-Fabric was doing if `blockNativeResponder` is false. It's not clear yet what the impact is on iOS.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D27058806
fbshipit-source-id: aa5074fa46191d78f5292a93d9040ab4bb58ca66
Summary:
These methods are only ever called just after setting the various YGStyle props. Therefore we can read any padding / margin / border state from there rather than recalculating it.
Changelog: [Internal]
Reviewed By: SidharthGuglani
Differential Revision: D27010098
fbshipit-source-id: a33f879b25c54cfdb0ffc724b6aa325858e97df5
Summary:
Avoid recalculating margin and padding by pre-subtracting the margin from `availableWidth` and inlining the calculation of `paddingAndBorderAxisCross`.
Changelog: [Internal]
Reviewed By: SidharthGuglani
Differential Revision: D27010094
fbshipit-source-id: afc3cf251a0306b9e5d7f0dc6856feee8d1dca6e
Summary:
Noticed in simpleperf this was a very hot method, showing 8ms spent in these methods in our sample application. By splitting the method out in a horizontal and vertical variant we can simplify cases enormously and check for begin/end in one go.
Changelog: [Internal]
Reviewed By: SidharthGuglani
Differential Revision: D27010008
fbshipit-source-id: 22fed58c7476e1d716b0191b55997c7a06e63223
Summary:
Media picking wasn't working for Venice because we didn't implement onActivityResult in BridgelessReactFragment so the listener in FBProfileGemstoneReactModule didn't called.
Changelog:
[Android][Changed] - Added Nullable annotation
Reviewed By: mdvacca
Differential Revision: D27045861
fbshipit-source-id: 0ab2961ef0570d92259856b4132507ebb264eb9d
Summary:
On Android we have the notion of "virtual views", which are defined consistently but the logic is scattered and duplicated throughout the codebase.
The logic exists to mark nodes that exist in the ShadowTree, but not the View tree. We want to CREATE, UPDATE, and DELETE them on the platform, but not INSERT or REMOVE
them. They basically exist as EventEmitter objects.
The only issue with this is (1) duplicated code, which opened the possibility for inconsistent definition (2) StubViewTree did not account for virtualized views, which caused
assert crashes in debug mode for certain LayoutAnimations on Android.
By moving the definition to ShadowViewMutation and accounting for it in StubViewTree, asserts are correct and consistent on all platforms.
This was not caught until recently, because, until recently, no asserts actually ran on Android.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D27001199
fbshipit-source-id: eb29085317037ba8a286d7813bdd57095ad4746f
Summary:
Changelog: [internal]
Creates new function `RCTInstallNativeComponentRegistryBinding` which can be called during JS setup to register JS function `__nativeComponentRegistry__hasComponent`.
Note: This diff doesn't call `RCTInstallNativeComponentRegistryBinding`.
Reviewed By: shergin
Differential Revision: D26946176
fbshipit-source-id: 0625b8dd6090bc9e08baa38ba60b9cbe48268184
Summary:
Right now there are places in UIManagerBinding.cpp where native java exceptions will be thrown if calling JSI functions results in errors, such as:
```Trying to report error getPropertyAsObject: property '__fbBatchedBridge' is undefined, expected an Object
Error: getPropertyAsObject: property '__fbBatchedBridge' is undefined, expected an Object
```
https://www.internalfb.com/intern/logview/details/facebook_android_javascripterrors/358181062b47b9561e60427bbb3816a9
In this diff I added LOG(ERROR) and checks because:
1, Throwing errors neither prevents the JSI errors nor handles them properly, checks prevent JSI errors from happening.
2, Errors are aggregated in Logview with other JSI errors as "Error: android_crash:com.facebook.react.devsupport.JSException:facebook::jni::throwNewJavaException" which keeps the SLA task open forever, checks can prevent JSI errors so they won't lead to exceptions, and LOG(ERROR) will make sure we have enough info for debugging.
Changelog:
[General][Changed] - Add checks and logs to for better error handling
Reviewed By: JoshuaGross
Differential Revision: D26885562
fbshipit-source-id: c0c1c057342e9efc0ff708188703f4332036e7a9
Summary:
This diff forces a remeasure of the children of VirtualizedLists everytime the VirtualizedList is measured.
The goal is to ensure that nested VirtualizedList has the correct "scroll information" all the time, scroll information information is used by ViewabilityHelper.computeViewableItems method to determine if Items of the list are visible to the user.
This new code is controlled by the MC: rn_core:enable_virtualizedlist_remeasure_children_if_needed.
changelog: [internal] internal
// I used an internal changelog because this is under a MC
Reviewed By: lunaleaps
Differential Revision: D27003249
fbshipit-source-id: f9452ceb27683b0f595dd4bffdcced0ecf6bb0b5
Summary:
As part of stoping a Surface, we have to commit an empty shadow node tree. And to avoid a deadlock we have to do it not under a `linkMutex_`. To do so, we need to move the part that commits an empty tree from UIManager to SurfaceHandler. And this diff does exactly this.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: sammy-SC
Differential Revision: D27010535
fbshipit-source-id: 60cc79b1c81d7340b550e78653737d2cc5bec24d
Summary:
When EventTarget is created in createNode, it's currently treated as optional in native, but it's not optional in JS. We should assert that it's non-null to make the contract more clear.
For now, we keep it as an assert so we catch issues in debug/dev, but it won't impact prod.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D27002506
fbshipit-source-id: c541dc02d3de22df19292deaef1a3b68fe57ba1f
Summary:
In DevSupportManagerBase.java->updateLastErrorInfo(), errorType was not recorded like errorMessage and errorStack, we could either remove errorType as a parameter or recorded it for future use. This diff recorded it since it would make the error info complete.
Changelog:
[Android][Changed] - Record latest error type in dev support
Reviewed By: PeteTheHeat
Differential Revision: D26884647
fbshipit-source-id: 712d82667bdc4b3410f4c83a3df9a456af6d9061
Summary:
Live reloading has been deprecated in favor of fast refresh for years, this diff removes remaining references to it.
Changelog: [iOS] Delete deprecated "live reloading" setting
Reviewed By: fkgozali
Differential Revision: D26983596
fbshipit-source-id: c7f86e7ec511f80e53659bccd8f40ac4f0cac27c
Summary:
Now cumulative time spent on text measuring is available as as part of SurfaceTelemetry.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: mdvacca
Differential Revision: D26827445
fbshipit-source-id: 8ad3178557ea71170557fcf19b6f62f7072d6da2
Summary:
Now we not only measure how many times we measured text but also measure how much time it takes. This way we can see which portion of the layout process is spent by layout itself (and measuring embedded components).
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: mdvacca
Differential Revision: D26827447
fbshipit-source-id: e0b09fcacc86aed50dd94b48458215adbb0a60ef
Summary:
Changelog: [Internal]
We were using RN util to get pixel density, but it depends on the surface being created after venice instance is initialized. Given that we have context every time we update constraints, it makes sense to use it directly.
Reviewed By: mdvacca
Differential Revision: D26959430
fbshipit-source-id: 78701786efd82857812df689a725ba094fbd226e
Summary:
Issue # https://github.com/facebook/react-native/issues/30934 .When using a screen reader disabled buttons do not announce that they are disabled.
## Changelog
[Android] [Changed] - Passing accessibility state in button so it can announce disabled in talkback
Pull Request resolved: https://github.com/facebook/react-native/pull/31001
Test Plan:
I have added Button in Button Example with accessibiltyState prop that will announce button is disabled when testing with talkback.
## Ios test
I am unable to run ios project on my machine. RNTesterPods.xcworkspace gives workspace integrity error :/
Reviewed By: kacieb
Differential Revision: D26492483
Pulled By: lunaleaps
fbshipit-source-id: c4bbe8ca896b0d303976591c300ccac67a96ac73
Summary:
Changelog: [internal]
Extract componentNameByReactViewName to separate file so it can be used elsewhere.
Reviewed By: shergin, mdvacca
Differential Revision: D26946159
fbshipit-source-id: cf69df1f80f1c1938fc667f4666a5d3fec5a9658
Summary:
Just adding more logs I found useful while playing around with the last diff (to verify that these methods were not actually implicated at all).
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D26972725
fbshipit-source-id: 0e048e1edbfbe5ed32c5277f17a7197e0afdc04f
Summary:
When the height of a HorizontalScrollView changes and there is a `layout` event, it can cause the underlying platform View code to scroll slightly to the right.
I'm... not really sure why, even after looking at the View code for a while. But it is clearly detectable and mirrors issues with RTL that were fixed recently.
This might warrant more investigation, but I believe the fix is relatively safe - we detect if there's an autoscroll only if the height changes and only if the scroll happens in "layout". That scopes the hack pretty well to just this bug.
There aren't really times when we actually want layout to scroll to the right, so... I think this is reasonable.
Changelog: [Changed][Android] Fixed issue that causes HorizontalScrollView to shift to the right when a TextInput is selected and keyboard pops up
Reviewed By: mdvacca
Differential Revision: D26972710
fbshipit-source-id: 441b1a3f07b9b68195a9e5e9a0c8d75c9d24a109
Summary:
Does not impact prod or even debug builds unless you switch on the debug flag. The issue is that we were trying to coerce booleans to integers.
Changelog: [internal]
Reviewed By: mdvacca
Differential Revision: D26970274
fbshipit-source-id: 3327029ae3afc307dd19b089c23c190cb9e3150c
Summary:
See https://github.com/react-native-community/discussions-and-proposals/pull/335 for extra context.
A VirtualizedList may have sticky headers, forwarded on to ScrollView. These sticky headers are exempt from virtualization once realized for the first time. This change documents the behavior of keeping sticky header cells realized after scrolling away.
This scenario performs the same behavior as creating an internal "realization window" for sticky headers with a single cell window size. Generalizing the concept of realization windows should be shaped to support the existing sticky header scenario.
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->
[Internal] [Added] - Add tests describing current sticky header realization behavior
Pull Request resolved: https://github.com/facebook/react-native/pull/31075
Reviewed By: lunaleaps
Differential Revision: D26767582
Pulled By: appden
fbshipit-source-id: 0d151bd6046fcb5384c646205aafa1ca7edf6c77
Summary:
Restore deprecated event listener removal methods in order to minimize breaking changes for the next release. The methods will work, but they will not report a warning via `console.error`.
Changelog:
[General][Added] - `EventEmitter.removeListener` now emits a deprecation notice.
[General][Added] - Restored `AppState.removeEventListener` with a deprecation notice.
[General][Added] - Restored `Keyboard.removeEventListener` with a deprecation notice.
[General][Added] - Restored `Linking.removeEventListener` with a deprecation notice.
Reviewed By: nadiia, kacieb
Differential Revision: D26589441
fbshipit-source-id: 7d89982a182cf2163136e157d4c1beee91c30393
Summary:
Changes `Dimensions.addEventListener` to return an `EventSubscription` object that has a `remove()` method on it.
In an upcoming commit, calling `Dimensions.removeEventListener` will lead to a deprecation warning.
Changelog:
[General][Change] - `Dimensions.addEventListener` now returns an `EventSubscription`.
Reviewed By: kacieb
Differential Revision: D26808827
fbshipit-source-id: 0cfdc65b83c177f60937c1aa3a4cf633592f73d7
Summary:
The documentation of jsi::Value::strictEquals was confusing it with SameValue (which differs in treatment of signed zeroes and NaN). Fix it by referring to the correct part of the spec.
Changelog:
[Internal][Fixed] - Fix incorrect comment
Reviewed By: avp
Differential Revision: D26430216
fbshipit-source-id: 0ea4208fbdda40c87f8028231ddefb2323b6eb96
Summary:
This NativeModule will now be type-safe, and TurboModule-compatible.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D26956332
fbshipit-source-id: 6651a003c70819934869dd6a8c664ef984d0efcb
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1068
There is an issue in react-native when the Yoga node position type is set to absolute and display: none is set where the node layout calculation gives the absolute dimensions, rather than the expected 0 x 0.
Here are some OSS issues tracking this:
https://github.com/facebook/react-native/issues/18415https://github.com/microsoft/react-native-windows/issues/7289
## Changelog
[General] [Fix] - Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute
Reviewed By: Andrey-Mishanin
Differential Revision: D26849307
fbshipit-source-id: 197618aa3c4e1b3b7efeba7ea4efd30b2d1c982d
Summary:
Fix warnings about implicit type truncation.
## Changelog
[Internal] [Fixed] - Fix various C++ warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/31002
Test Plan:
Almost all the changes here are simply making explicit conversions which are already occurring. With the exception of a couple of constants being changed from doubles to floats.
With these changes I am able to remove a bunch of warning suppressions in react-native-windows.
Reviewed By: shergin
Differential Revision: D26900502
Pulled By: rozele
fbshipit-source-id: d5e415282815c2212a840a863713287bbf118c10
Summary:
Changelog: [Internal]
Flipper moved to maven central recently, so we can remove exceptions for it.
Reviewed By: fkgozali
Differential Revision: D26915353
fbshipit-source-id: c245e25ecb0eef1e279f197c2717673ec9ce3ca1
Summary:
Changelog: [internal]
"onDismiss" event wasn't called in Fabric. This diff adds it.
Paper implementation of Modal uses `RCTEventEmitter` instead of callback to deliver the event. To align better with Paper, Fabric will follow this pattern.
Reviewed By: shergin
Differential Revision: D26911312
fbshipit-source-id: b0de619c5a02c3378d1f7ac3ce1b705bb5fb634d
Summary:
Changelog:
These are no longer being used by Buck, we can just remove them.
Reviewed By: zigwei
Differential Revision: D26913017
fbshipit-source-id: c75a07b2dc8c337ceef6da275b0046c0ac048ba7
Summary:
Add a stickyHeaderHiddenOnScroll option to keep the sticky header hidden during scrolling down, and only slide in when scrolling up
Changelog:
[General][Added] - Add a stickyHeaderHiddenOnScroll option to keep the sticky header hidden during scrolling down, and only slide in when scrolling up
Reviewed By: JoshuaGross
Differential Revision: D26900810
fbshipit-source-id: 6bfb1a4da07fff0763223d60836df187f9d95dd6
Summary:
This diff creates a new unstable method (unstable_hasComponent) to expose `global.__nativeComponentRegistry__hasComponent` into NativeComponentRegistry.js
changelog: [internal] internal
Reviewed By: yungsters
Differential Revision: D26716903
fbshipit-source-id: 52ff63b2779f41770b292cfc0b9022b1669d59fe