react-native-windows
react-native-windows copied to clipboard
Fix XamlRoot crashes in FlyoutViewManager
Description
Type of Change
Erase all that don't apply.
- Bug fix (non-breaking change which fixes an issue)
Why
There are two cases where a flyout may crash when opened:
- If the native view corresponding to the target tag is unmounted before the flyout is shown.
- If the XamlRoot on the flyout differs from the XamlRoot of the target.
This can happen if the XamlRoot changes (e.g., window loses focus) before the UIManager operation to create the Flyout and set the isOpen prop executes.
Note - this is only relevant to multi-window RN applications.
What
This change logs the error and does not attempt to show the flyout if either of these cases occur.
Testing
This change has been in production in Messenger Desktop for more than a year and has fixed a significant crash that occurred when attempting to show a flyout just before opening a call window.