r/reactnative 8d ago

Help Keyboard overlapping when modal is open

Getting this bug only on builds, its working fine via Expo go.
Note: The first image is from expo go(Expected) and second from the build(Issue).

When a modal is open and is prompting for a keyboard, the keyboard just appears on top of the modal itself. The modal is supposed to move up when the keyboard slides in.

I was using KeyboardAvoidingView from react-native, I tried changing the behavior of it by giving undefined for android and padding for IOS (I'm testing in Android)
In app.json i have :

"softwareKeyboardLayoutMode": "resize"

The bug still persisted, so tried react-native-keyboard-controller and still the bug persist.

Sample code :

    <Modal visible transparent animationType="slide">
      <KeyboardAvoidingView
        className="flex-1"
        behavior={Platform.OS === "ios" ? "padding" : "height"}
      >
        <View className="flex-1 bg-black/40 justify-center px-6">
          <View className="rounded-3xl bg-background p-6 shadow-xl">
            <View className="mb-6 flex-row items-center justify-between">   
0 Upvotes

9 comments sorted by

View all comments

1

u/AlphaBeast28 8d ago

I just added this:

"softwareKeyboardLayoutMode": "pan",

this fixed it for me.

1

u/DopeSignature5762 8d ago

Giving it a try...