Skip to content

Commit

Permalink
Fixing crash when passing null children to view with no-hide-descende…
Browse files Browse the repository at this point in the history
…nts (microsoft#13224)

* Preventing crash when passing null children to view with no-hide-descendents

* Change files

---------

Co-authored-by: Sam Walker <sawalker@microsoft.com>
Co-authored-by: Andrew <30809111+acoates-ms@users.noreply.github.com>
  • Loading branch information
3 people committed May 14, 2024
1 parent fc6f5fa commit 1110f54
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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"
}
3 changes: 3 additions & 0 deletions vnext/src-win/Libraries/Components/View/View.windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 1110f54

Please sign in to comment.