Replies: 2 comments 1 reply
-
I'd suggest to go with this solution first and see if you can discover any drawbacks. Can you attach a video of what you are trying to achieve (i. e. whats app) and what you currently have?
This is good if you build really complex interactions, involving interactive keyboard dismissal etc. For simple scenarios
I think for your example the correct decision will be wrapping list + input inside If you want to change colors depending on whether keyboard is shown or not, the you can use Let me know if you have any further questions ❤️ |
Beta Was this translation helpful? Give feedback.
-
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-02-26.at.16.56.59.mp4I am doing that for now, but it seems complicated: I kinda reinvent the wheel here. I tried using KeyboardAvoidingView, but no luck: animation of this bottom safe area seems not possible. const SMALL_BUFFER = 10;
export const KeyboardAdaptiveChat = ({
children,
SendComponent
}: KeyboardAdaptiveChatProps) => {
const { height, progress } = useReanimatedKeyboardAnimation();
const { bottom } = useSafeAreaInsets();
// animate the bottom margin of view when keyboard is shown including some Buffer
const animatedPaddingBottom = useAnimatedStyle(
() => ({
paddingBottom: interpolate(progress.value, [0, 1], [bottom, SMALL_BUFFER])
}),
[]
);
const fakeView = useAnimatedStyle(
() => ({
height: Math.abs(height.value)
}),
[]
);
return (
<View style={$styles.flex1}>
{/* For allowing keyboardDismissMode 'interactive' on android */}
<KeyboardGestureArea interpolator="ios" style={$styles.flex1}>
{children}
</KeyboardGestureArea>
{/* Here animation of bottom margin */}
<Reanimated.View style={[animatedPaddingBottom, $sendComponent]}>
{SendComponent}
</Reanimated.View>
{/* This is needed, that keyboard doesn't hide the rest. */}
<Reanimated.View style={[fakeView, $sendComponent]} />
</View>
);
};
const $sendComponent: ViewStyle = {
backgroundColor: colors.wizardBottomBar
}; |
Beta Was this translation helpful? Give feedback.
-
I have this chat app with a flatlist and a TextInput-Component at bottom.
I want this:
Any ideas how to achieve that with this library? Combination of KeyboardAvoidingView and KeyboardStickyView? Only KeyboardAvoidingView like in this example: https://github.com/kirillzyusko/react-native-keyboard-controller/blob/main/example/src/screens/Examples/ReanimatedChatFlatList/index.tsx ? Custom build solution with useReanimatedKeyboardAnimation or useKeyboardHandler?
Beta Was this translation helpful? Give feedback.
All reactions