react-native-windows
react-native-windows copied to clipboard
Enable ABIViewManager to opt out of NeedsForceLayout
Description
Type of Change
Erase all that don't apply.
- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
Why
Currently, setting RequiresNativeLayout to true also opts into NeedsForceLayout on the shadow node for ABIViewManager, which makes an extra UpdateLayout call in UIManager. These two features are not necessarily tied together. For example, TextInputViewManager sets both RequiresNativeLayout and NeedsForceLayout, but TextViewManager does not.
We are currently experiencing a crash when being forced to call the extra UpdateLayout call on a custom view manager based on ABIViewManager with an E_FAIL hresult from UIElement::UpdateLayout.
What
This change adds another interface that allows ABI VMs to opt out of the forced extra UpdateLayout.
Testing
Confirmed in our app that crash no longer occurs because extra UpdateLayout call here is skipped: https://github.com/microsoft/react-native-windows/blob/main/vnext/Microsoft.ReactNative/Modules/NativeUIManager.cpp#L898
Microsoft Reviewers: Open in CodeFlow
Investigating better options for native layout, coming soon.
Abandoning. We are not going to use IVMRequiresNativeLayout for our component - prefer IViewManagerWithMeasure (assuming that gets merged :) )