diff --git a/src/components/KeyboardAwareScrollView/index.tsx b/src/components/KeyboardAwareScrollView/index.tsx index 10e316b88c..c7e3e67008 100644 --- a/src/components/KeyboardAwareScrollView/index.tsx +++ b/src/components/KeyboardAwareScrollView/index.tsx @@ -1,5 +1,4 @@ import React, { forwardRef, useCallback, useMemo } from "react"; -import { findNodeHandle } from "react-native"; import Reanimated, { interpolate, scrollTo, @@ -15,6 +14,7 @@ import { useReanimatedFocusedInput, useWindowDimensions, } from "../../hooks"; +import { findNodeHandle } from "../../utils/findNodeHandle"; import { useSmoothKeyboardHandler } from "./useSmoothKeyboardHandler"; import { debounce, scrollDistanceWithRespectToSnapPoints } from "./utils"; diff --git a/src/internal.ts b/src/internal.ts index 85e507a737..3346f86aa1 100644 --- a/src/internal.ts +++ b/src/internal.ts @@ -1,7 +1,8 @@ import { useRef } from "react"; -import { Animated, findNodeHandle } from "react-native"; +import { Animated } from "react-native"; import { registerEventHandler, unregisterEventHandler } from "./event-handler"; +import { findNodeHandle } from "./utils/findNodeHandle"; type EventHandler = (event: never) => void; type ComponentOrHandle = Parameters[0]; diff --git a/src/utils/findNodeHandle/index.native.ts b/src/utils/findNodeHandle/index.native.ts new file mode 100644 index 0000000000..55ac2fa7c6 --- /dev/null +++ b/src/utils/findNodeHandle/index.native.ts @@ -0,0 +1,3 @@ +import { findNodeHandle } from "react-native"; + +export { findNodeHandle }; diff --git a/src/utils/findNodeHandle/index.ts b/src/utils/findNodeHandle/index.ts new file mode 100644 index 0000000000..7ba6580570 --- /dev/null +++ b/src/utils/findNodeHandle/index.ts @@ -0,0 +1,6 @@ +import type { findNodeHandle as findNodeHandleRN } from "react-native"; + +type FindNodeHandleRN = typeof findNodeHandleRN; + +export const findNodeHandle: FindNodeHandleRN = (componentOrHandle) => + componentOrHandle as number | null;