4

I'm using the library - https://github.com/osdnk/react-native-reanimated-bottom-sheet

I'm using a TextInput on this bottom sheet. And now when the Text Input is focused or typed in, the bottom sheet should remain at the same position. It works fine for iOS, shown in the below screenshot.

enter image description here

And when I focus the Text Input on Android, the bottom sheet moves up along with the keyboard, shown in below 2 screenshots.

(Bottom Sheet in Android not focused)

enter image description here

(Bottom Sheet in Android focused)

enter image description here

I've also tried wrapping my bottom sheet inside KeyboardAvoidingView and its props accordingly but it didn't work.

halfer
  • 19,824
  • 17
  • 99
  • 186
Shubham Bisht
  • 577
  • 2
  • 26
  • 51

3 Answers3

1

I solved the same problem in my project using Expo Kit 38

Just add this to your app.json file:

"android": {
  "softwareKeyboardLayoutMode": "pan"
}

Here’s how to upgrade your app to Expo SDK 38.0.0 from 37.0.0:

  1. Update expo-cli by running npm i -g expo-cli
  2. Run expo upgrade in your project directory

You may want to check the documentation for more details

Kewal Shah
  • 1,131
  • 18
  • 29
0

Using android:windowSoftInputMode="adjustPan" in AndroidManifest.xml worked! :D

Shubham Bisht
  • 577
  • 2
  • 26
  • 51
0

Set the device screen height to your BottomSheet's parent container. Example code:

import BottomSheet from 'reanimated-bottom-sheet'
import { View as Container, Dimensions } from 'react-native'

const { height } = Dimensions.get('window') // Magic value.


const Screen = () => (
  <Container style={{ height }}>
    {/* Your screen content here */}
    <BottomSheet {...yourBottomSheetParams} />
  </Container>
)

export default Screen
  1. Works for Expo Managed Workflow projects. While setting the android:windowSoftInputMode="adjustPan" is not possible there.
  2. height: 100% did not work for me (was suggested here on GitHub Bottom Sheet moves up along with Keyboard in Android and not iOS #203).
Yuri Z
  • 3
  • 2
  • 5