react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

Enable ABIViewManager to opt out of NeedsForceLayout

Open rozele opened this issue 1 year ago • 1 comments

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

rozele avatar Aug 08 '22 21:08 rozele

Investigating better options for native layout, coming soon.

rozele avatar Aug 10 '22 16:08 rozele

Abandoning. We are not going to use IVMRequiresNativeLayout for our component - prefer IViewManagerWithMeasure (assuming that gets merged :) )

rozele avatar Aug 22 '22 20:08 rozele