Closed arpkirill closed 1 month ago
Perhaps this is due to the height of the keyboard, if it is too high, then the keyboard collapses
I have the very same problem
I have the very same problem
I found a temporary solution, but it makes the interface a bit crooked.
keyboardBehavior={Platform.OS === 'ios' ? 'interactive' : 'fillParent'}
Facing same Keyboard issue in Android device only. Any Update on this?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
actual
I have the very same problem, anyone help me !
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
having the exact same issue
dont close this thread :v
actually I think this is the same as #1602
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
could you please test on v5 ?
For me, this issue occurred with a TextInput
/BottomSheetTextInput
inside the footer component. The footerComponent was dependent on the insets.bottom
variable from useSafeAreaInsets
.
This caused the footer to rerender when the keyboard was opened, which subsequently closed the keyboard.
It might not be the exact same issue, but definitely check for any insets that could be updating and causing rerenders!
I have tested on v5.0.0-alpha.11, still presents the same issue. I'm also adding a BottomSheetTextInput
via the footerComponent
prop, and I even tried removing any bottomInset
references. It seems like the changing of the value of the input itself is causing it to rerender. I removed several layers of composition so that the BottomSheetTextInput
was a direct and only child of BottomSheetFooter
, and the issue persisted. It also seems like banging on the keyboard too quickly results in a crash.
Thank you for testing, I'm currently preparing for the v5 stable release, and I'll make sure to include this one in
Same issue on Samsung S23
no one provide a reproducible sample code of the issue, how can i help you 🫠
no one provide a reproducible sample code of the issue, how can i help you 🫠
Still got the issue on 5.0.1, i will do a reproducible sample code
My issue occurs when I import my custom hook. In my case, I will just delete this hook as I don't even remember why I was using it.
export default function useKeyboard() {
const [keyboardStatus, setKeyboardStatus] = useState(false);
function _keyboardDidShow() {
setKeyboardStatus(true);
}
function _keyboardDidHide() {
setKeyboardStatus(false);
}
useEffect(() => {
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', _keyboardDidShow);
const keyboardDidShowListener2 = Keyboard.addListener('keyboardDidHide', _keyboardDidHide);
return () => {
keyboardDidShowListener.remove()
keyboardDidShowListener2.remove()
};
}, []);
return keyboardStatus;
}
import React, { useCallback, useMemo, useRef } from 'react';
import { View, Text, StyleSheet, Button } from 'react-native';
import {
BottomSheetModal,
BottomSheetView,
BottomSheetModalProvider, BottomSheetModalProps, BottomSheetTextInput,
} from '@gorhom/bottom-sheet';
import {GestureHandlerRootView} from "react-native-gesture-handler";
import useKeyboard from "@/hooks/useKeyboard";
const App = () => {
// ref
const bottomSheetModalRef = useRef<BottomSheetModal>(null);
// variables
const snapPoints = useMemo(() => ['25%', '50%'], []);
// callbacks
const handlePresentModalPress = useCallback(() => {
bottomSheetModalRef.current?.present();
}, []);
function bottomSheetConfig() : Omit<BottomSheetModalProps, 'children'> {
return {
keyboardBehavior: 'interactive',
keyboardBlurBehavior: 'restore',
enablePanDownToClose: true,
android_keyboardInputMode: "adjustResize",
}
}
// This hook will break the input
const keyboard = useKeyboard()
// renders
return (
<GestureHandlerRootView>
<BottomSheetModalProvider>
<View style={styles.container}>
<Button
onPress={handlePresentModalPress}
title="Present Modal"
color="black"
/>
<BottomSheetModal
{...bottomSheetConfig()}
ref={bottomSheetModalRef}
index={1}
snapPoints={snapPoints}
>
<BottomSheetView style={styles.contentContainer}>
<Text>Awesome 🎉</Text>
</BottomSheetView>
<BottomSheetTextInput
style={{
fontWeight: "400",
height: 50,
backgroundColor: "#EAEEF1",
borderRadius: 400,
paddingLeft: 20,
paddingRight: 20,
marginLeft: 10,
marginRight: 10,
width: 200,
textAlign: "center"
}}
placeholder={"Text input"}
/>
</BottomSheetModal>
</View>
</BottomSheetModalProvider>
</GestureHandlerRootView>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 24,
justifyContent: 'center',
backgroundColor: 'grey',
},
contentContainer: {
},
});
export default App;
Bug
When you try to open the keyboard by pressing input, the keyboard appears for a couple of seconds and then disappears, this only happens on some phones. I couldn't understand the pattern.
SAMSUNG SM-A105F SAMSUNG SM-A750FN
Environment info
Steps To Reproduce
Describe what you expected to happen:
Reproducible sample code
https://github.com/gorhom/react-native-bottom-sheet/assets/44532033/0ef5822a-22a6-4460-b67e-a15bbb4eeb31