Skip to content

Commit f3b14f2

Browse files
committed
fix: fix keyboard scroll to bottom button
1 parent bc442b9 commit f3b14f2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • libs/mobile/chat/features/chat/src/lib/components/chat-bottom-button

libs/mobile/chat/features/chat/src/lib/components/chat-bottom-button/component.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ReactElement } from 'react';
2+
import { useReanimatedKeyboardAnimation } from 'react-native-keyboard-controller';
23
import { interpolate, SharedValue, useAnimatedStyle } from 'react-native-reanimated';
34
import { AnimatedView, IconButton } from '@open-webui-react-native/mobile/shared/ui/ui-kit';
45

@@ -8,8 +9,14 @@ interface ChatBottomButtonProps {
89
}
910

1011
export default function ChatBottomButton({ isVisible, onPress }: ChatBottomButtonProps): ReactElement | null {
12+
//NOTE: height is 0 when the keyboard is closed and -keyboardHeight when open, so it lifts the button above the keyboard
13+
const { height: keyboardHeight } = useReanimatedKeyboardAnimation();
14+
1115
const animatedStyle = useAnimatedStyle(() => ({
12-
transform: [{ scale: interpolate(isVisible.value, [0, 1], [0, 1]) }],
16+
transform: [
17+
{ translateY: keyboardHeight.value ? keyboardHeight.value + 15 : 0 },
18+
{ scale: interpolate(isVisible.value, [0, 1], [0, 1]) },
19+
],
1320
}));
1421

1522
return (

0 commit comments

Comments
 (0)