react-native-bottom-sheet icon indicating copy to clipboard operation
react-native-bottom-sheet copied to clipboard

keyboardBehavior="interactive" doesn't work

Open onmotion opened this issue 5 years ago • 6 comments

Bug

Hi!

I try to use feature keyboardBehavior="interactive", but it doesn't work, possibly because of:

https://github.com/gorhom/react-native-bottom-sheet/blob/7c6d9f3fb601a092f0e7b4752ac608c40c47c60a/src/hooks/useKeyboard.ts#L31

Environment info

Library Version
@gorhom/bottom-sheet 3.6.3
react-native 0.64.0
react-native-reanimated 2.1.0
react-native-gesture-handler 1.10.3

Steps To Reproduce

Set up keyboardBehavior="interactive"

Describe what you expected to happen:

from to

But its hide behind keyboard

Reproducible sample code

<BottomSheetModalProvider>
        <BottomSheetModal
          ref={bottomSheetModalRef}
          keyboardBehavior="interactive"
          keyboardBlurBehavior="restore"
          index={0}
          snapPoints={snapPoints}
          backdropComponent={BottomSheetBackdrop}
          onChange={handleSheetChanges}
        >
            <TextInputComponent>
            </TextInputComponent>
        </BottomSheetModal>
      </BottomSheetModalProvider>

onmotion avatar Apr 14 '21 10:04 onmotion

I'm seeing the same thing with keyboardBehavior="fullScreen" - nothing happens when the keyboard is shown. Changing the referenced line to const shouldHandleKeyboardEvents = useSharedValue(true); causes the keyboard handling to match what is described in the documentation.

It seems like the intention may have been for BottomSheet to set shouldHandleKeyboardEvents.value = true when keyboardBehavior !== KEYBOARD_BEHAVIOR.none?

jordoh avatar May 13 '21 22:05 jordoh

You have to use BottomSheetTextInput

VithuJey avatar May 14 '21 15:05 VithuJey

You have to use BottomSheetTextInput

Thanks - I can confirm that works for the TextInput use case, though my use case is a focus-able WebView in the modal. It looks like there isn't a way to access useBottomSheetInternal in external code - so perhaps a more generic focusable component would be useful?

jordoh avatar May 14 '21 16:05 jordoh

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.

github-actions[bot] avatar Jul 05 '21 09:07 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Jul 11 '21 09:07 github-actions[bot]

@onmotion I'm facing same issue. Have you found any solution.

Haider-Ali-7 avatar Oct 12 '22 11:10 Haider-Ali-7