From 1110f54d4c57e6822aec316f04dccc43e2c88b94 Mon Sep 17 00:00:00 2001 From: Sam Walker Date: Mon, 13 May 2024 16:11:51 -0400 Subject: [PATCH] Fixing crash when passing null children to view with no-hide-descendents (#13224) * Preventing crash when passing null children to view with no-hide-descendents * Change files --------- Co-authored-by: Sam Walker Co-authored-by: Andrew <30809111+acoates-ms@users.noreply.github.com> --- ...ative-windows-4d35cfde-27d7-409c-903e-1e2bec97cb74.json | 7 +++++++ vnext/src-win/Libraries/Components/View/View.windows.js | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 change/react-native-windows-4d35cfde-27d7-409c-903e-1e2bec97cb74.json diff --git a/change/react-native-windows-4d35cfde-27d7-409c-903e-1e2bec97cb74.json b/change/react-native-windows-4d35cfde-27d7-409c-903e-1e2bec97cb74.json new file mode 100644 index 00000000000..939a2ae9655 --- /dev/null +++ b/change/react-native-windows-4d35cfde-27d7-409c-903e-1e2bec97cb74.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Preventing crash when passing null children to view with no-hide-descendents", + "packageName": "react-native-windows", + "email": "30809111+acoates-ms@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/vnext/src-win/Libraries/Components/View/View.windows.js b/vnext/src-win/Libraries/Components/View/View.windows.js index 4d6d3cc58ac..51c4df0329a 100644 --- a/vnext/src-win/Libraries/Components/View/View.windows.js +++ b/vnext/src-win/Libraries/Components/View/View.windows.js @@ -175,6 +175,9 @@ const View: React.AbstractComponent< // [Windows // $FlowFixMe - children typing const childrenWithImportantForAccessibility = children => { + if (children == null) { + return children; + } const updatedChildren = React.Children.map(children, child => { if (React.isValidElement(child)) { // $FlowFixMe[incompatible-use]