Skip to content

[Bug]: Switching keyboard types triggers unwanted close #2430

@goncalo1995

Description

@goncalo1995

Version

v5

Reanimated Version

v3

Gesture Handler Version

v2

Platforms

iOS

What happened?

Switching from text input to a numeric input (not the other way around) is cause the modal to close. I could not test in Android but happens in iOS.

Reproduction steps

Could not make BottomSheetModal show in expo snack, this bug happens in my development build.

How to reproduce the bug:

  1. Run this in Expo or bare React Native with @gorhom/bottom-sheet v4.4.5.
  2. Open the sheet, focus the text input, then switch to the numeric input.

Example modal that causes the unwanted close:
<BottomSheetModal
ref={sheetRef}
index={0}
snapPoints={snapPoints}
onDismiss={() => console.log("Sheet dismissed")}
keyboardBehavior="interactive"
keyboardBlurBehavior="restore"
enablePanDownToClose={false}
>
{/* Use BottomSheetScrollView or BottomSheetView */}
<BottomSheetScrollView contentContainerStyle={{ padding: 20 }}>
<Text style={{ marginBottom: 10 }}>Text Input:
<BottomSheetTextInput
style={{
borderWidth: 1,
borderColor: "#ccc",
padding: 10,
marginBottom: 20,
borderRadius: 5,
}}
placeholder="Text input"
value={textValue}
onChangeText={setTextValue}
/>

      <Text style={{ marginBottom: 10 }}>Numeric Input:</Text>
      <BottomSheetTextInput
        style={{
          borderWidth: 1,
          borderColor: "#ccc",
          padding: 10,
          borderRadius: 5,
        }}
        placeholder="Numeric input"
        value={numberValue}
        onChangeText={setNumberValue}
        keyboardType="numeric"
      />
    </BottomSheetScrollView>
  </BottomSheetModal>

Reproduction sample

https://snack.expo.dev/@cereja/mixed-inputs-bug-bottomsheet

Relevant log output

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingv5

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions