diff --git a/src/components/KeyboardStickyView/index.tsx b/src/components/KeyboardStickyView/index.tsx index 57f9e47f55..253c222a98 100644 --- a/src/components/KeyboardStickyView/index.tsx +++ b/src/components/KeyboardStickyView/index.tsx @@ -1,8 +1,5 @@ import React, { forwardRef, useMemo } from "react"; -import Reanimated, { - interpolate, - useAnimatedStyle, -} from "react-native-reanimated"; +import Reanimated, { clamp, useAnimatedStyle } from "react-native-reanimated"; import { useReanimatedKeyboardAnimation } from "react-native-keyboard-controller"; @@ -32,13 +29,13 @@ const KeyboardStickyView = forwardRef< { children, offset: { closed = 0, opened = 0 } = {}, style, ...props }, ref, ) => { - const { height, progress } = useReanimatedKeyboardAnimation(); + const { height } = useReanimatedKeyboardAnimation(); const stickyViewStyle = useAnimatedStyle(() => { - const offset = interpolate(progress.value, [0, 1], [closed, opened]); + const offset = clamp(height.value, closed, opened + height.value); return { - transform: [{ translateY: height.value + offset }], + transform: [{ translateY: offset }], }; }, [closed, opened]);