diff --git a/src/reanimated2/layoutReanimation/web/domUtils.ts b/src/reanimated2/layoutReanimation/web/domUtils.ts index 9d8b4ef0747..7e918f50830 100644 --- a/src/reanimated2/layoutReanimation/web/domUtils.ts +++ b/src/reanimated2/layoutReanimation/web/domUtils.ts @@ -163,6 +163,12 @@ function findDescendantWithExitingAnimation( node: ReanimatedHTMLElement, root: Node ) { + // Node could be something else than HTMLElement, for example TextNode (treated as plain text, not as HTML object), + // therefore it won't have children prop and calling Array.from(node.children) will cause error. + if (!(node instanceof HTMLElement)) { + return; + } + if (node.reanimatedDummy && node.removedAfterAnimation === undefined) { reattachElementToAncestor(node, root); }