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 (#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 authored May 13, 2024
1 parent e2a0c87 commit f636d2c
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 f636d2c

Please # to comment.