Skip to content

Commit be8cd78

Browse files
committed
[LA Web] Add check for HTMLElement when looking for descendant with animation. (#5749)
## Summary This issue was found in [Expensify](Expensify/App#37463). `node.children` was undefined, because `node` wasn't `HTMLElement` - it was `plaintext`. This PR introduces new check - if `node` is not `HTMLElement`, we won't perform any action. ## Test plan Tested on Expensify App
1 parent 97f41cc commit be8cd78

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/reanimated2/layoutReanimation/web/domUtils.ts

+6
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ function findDescendantWithExitingAnimation(
163163
node: ReanimatedHTMLElement,
164164
root: Node
165165
) {
166+
// Node could be something else than HTMLElement, for example TextNode (treated as plain text, not as HTML object),
167+
// therefore it won't have children prop and calling Array.from(node.children) will cause error.
168+
if (!(node instanceof HTMLElement)) {
169+
return;
170+
}
171+
166172
if (node.reanimatedDummy && node.removedAfterAnimation === undefined) {
167173
reattachElementToAncestor(node, root);
168174
}

0 commit comments

Comments
 (0)