Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: React Native Bottom Sheet: How to dismiss keyboard on drag start? #2125

Open
sen46Sko opened this issue Jan 22, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@sen46Sko
Copy link

Version

v4 (deprecated)

Reanimated Version

v3

Gesture Handler Version

v2

Platforms

iOS

What happened?

Using @gorhom/bottom-sheet v4. Need to dismiss keyboard immediately when user starts dragging the sheet, not just on close.

Current behavior:

  • Keyboard stays open while dragging if input is focused
  • Only dismisses after sheet fully closes

Tried:

  • onClose handler
  • enableContentPanningGesture
  • onChange event

Code:
`
import { TextInput } from 'react-native';

<BottomSheet
ref={bottomSheetRef}
index={visible ? 0 : -1}
snapPoints={snapPoints}
enablePanDownToClose
onClose={handleSheetClose}
backdropComponent={renderBackdrop}
handleIndicatorStyle={styles.handleIndicator}
backgroundStyle={styles.modalBackground}
>
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
style={styles.keyboardAvoidingView}
keyboardVerticalOffset={Platform.OS === 'ios' ? 10 : 0}
>

...

`

Any suggestions for handling keyboard dismiss on initial drag?

Reproduction steps

  • `
    import { TextInput } from 'react-native';

<BottomSheet
ref={bottomSheetRef}
index={visible ? 0 : -1}
snapPoints={snapPoints}
enablePanDownToClose
onClose={handleSheetClose}
backdropComponent={renderBackdrop}
handleIndicatorStyle={styles.handleIndicator}
backgroundStyle={styles.modalBackground}
>
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
style={styles.keyboardAvoidingView}
keyboardVerticalOffset={Platform.OS === 'ios' ? 10 : 0}
>

...

`

Reproduction sample

https://snack.expo.dev/n7fZgSTu9LyH137W7yod3

Relevant log output

@sen46Sko sen46Sko added the bug Something isn't working label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant