Closed jamesbtlr closed 2 weeks ago
@jamesbtlr, it is true that on Android it works out of the box but you can make it work also for iOS following the suggestions in the Keyboard Handling doc.
Sorry, but I don't understand what exactly you mean here. I've tried copying things over, but the problem still persists.
@jamesbtlr this does work, at least it does for me. One thing I noticed was that there were styles being applied to the container so the bottom sheet wasn't able to go that high. Here is an example that works for me.
<BottomSheetHandler
bottomSheetRef={bottomSheetRef}
handleSheetChange={handleSheetChange}
onSave={() => {}}>
<BottomSheetTextInput style={styles.textInput} value='Awesome 🎉' />
</BottomSheetHandler>
import { View, StyleSheet } from 'react-native';
import React from 'react';
import BottomSheet, { BottomSheetBackdrop } from '@gorhom/bottom-sheet';
import DefaultButton from './buttons/DefaultButton';
interface BottomSheetHandlerProps {
bottomSheetRef: React.RefObject<BottomSheet>;
handleSheetChange: (index: number) => void;
children: React.ReactNode;
onSave: () => void;
}
export default function BottomSheetHandler({
bottomSheetRef,
handleSheetChange,
children,
onSave,
}: BottomSheetHandlerProps) {
return (
<BottomSheet
backdropComponent={backdropProps => (
<BottomSheetBackdrop {...backdropProps} disappearsOnIndex={-1} appearsOnIndex={0} />
)}
ref={bottomSheetRef}
index={-1}
snapPoints={['90%', '50%', '25%']}
onChange={handleSheetChange}
enablePanDownToClose
keyboardBehavior='interactive'>
<View style={styles.bottomSheetContainer}>
{children}
<DefaultButton title='Save' onPress={onSave} />
</View>
</BottomSheet>
);
}
const styles = StyleSheet.create({
bottomSheetContainer: {
flex: 1,
alignItems: 'center',
padding: 20,
},
});
https://github.com/user-attachments/assets/604e2d61-23aa-4590-81b8-50f021a0c8ec
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.
Bug
When interacting with an input field within the bottom sheet on iOS, the keyboard opens above the bottom sheet instead of pushing the content upwards with it. This only seems to be an issue on iOS, as it's working correctly for us on Android.
Environment info
Steps To Reproduce
Describe what you expected to happen:
Reproducible sample code
Can provide later if needed.