Skip to content

Commit 3d54734

Browse files
thomasvoclaude
andcommitted
fix: use library findNodeHandle wrapper, guard view.superview nil
- Import findNodeHandle from library's utils wrapper (consistent with KeyboardAwareScrollView usage) instead of directly from react-native - Add view.superview nil check in iOS windowPosition to avoid silently resolving with CGRectZero when superview is nil Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 48cb2af commit 3d54734

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

ios/KeyboardControllerModule.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ - (void)windowPosition:(double)viewTag
129129
}
130130
}
131131
UIView *view = [window viewWithTag:tag];
132-
if (!view) {
132+
if (!view || !view.superview) {
133133
reject(@"E_VIEW_NOT_FOUND", @"Could not find view for tag", nil);
134134
return;
135135
}

src/components/KeyboardAvoidingView/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { forwardRef, useCallback, useMemo } from "react";
2-
import { View, findNodeHandle } from "react-native";
2+
import { View } from "react-native";
33
import Reanimated, {
44
interpolate,
55
runOnUI,
@@ -10,6 +10,7 @@ import Reanimated, {
1010

1111
import { KeyboardControllerNative } from "../../bindings";
1212
import { useWindowDimensions } from "../../hooks";
13+
import { findNodeHandle } from "../../utils/findNodeHandle";
1314
import useCombinedRef from "../hooks/useCombinedRef";
1415

1516
import { useKeyboardAnimation, useTranslateAnimation } from "./hooks";

0 commit comments

Comments
 (0)