Skip to content

Commit ab5ab7f

Browse files
authored
[Web] Do not set role on non HTMLElement nodes (#4159)
## Description In Gesture Handler 3 it is possible to attach `GestureDetector` not only to `Views`, but also to `Text`. However, this crashes on `removeAttribute` method. ## Test plan Nested text example
1 parent 2d6a20d commit ab5ab7f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/react-native-gesture-handler/src/v3/detectors/useNativeGestureRole.web.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export function useNativeGestureRole(
99
children: ReactNode
1010
): void {
1111
useEffect(() => {
12-
const child = viewRef.current?.firstChild as HTMLElement | undefined;
12+
const child = viewRef.current?.firstChild;
1313

14-
if (!child) {
14+
if (!(child instanceof HTMLElement)) {
1515
return;
1616
}
1717

0 commit comments

Comments
 (0)