I am struggling with this issue now for over three weeks.
I am using the package osdnk/react-native-reanimated-bottom-sheet and I want to use textinputs inside the bottomsheet. The problem appears when opening the keyboard. The bottomsheet is pushed out of the screen.
There is already a github issue about this but everyone seems to get the problem solved. Except me? Also no one answers my questions there.
Steps I tried:
- Android.xml:
android:windowSoftInputMode="adjustPan"I am using expo and don't want to escape, so please don't provide solutions with the Android.xml file. - Replaced all
flex:1withheight:100% - I tried different variations with wrapping the whole Bottomsheet / Content
- Tried to create a 3rd snapping point with 100% and snap to this point as soon as an Inputfield is focused. However, this also results in the bottom sheet beeing out of the screen.
- On IOS its working fine.
My code looks like the following: (simplyfied)
const renderInner = () => (
<View>
<FormTextInput/>
</View>)
return (
<BottomSheet
snapPoints={['100%']}
renderContent={renderInner}
renderHeader={renderHeader}
initialSnap={0}
/>
)
How can I fix this weird behaviour? Please provide an example. Its enough to just use an example provided inside the git-repo, clear everything inside the bottom sheet and add a simple text-input.
SOLUTION
Your BottomSheet parent container should have the device screen height instead of height: 100%. There is no need for the android:windowSoftInputMode="adjustPan".
import BottomSheet from 'reanimated-bottom-sheet'
import { View as Container, Dimensions } from 'react-native'
const { height } = Dimensions.get('window')
const Screen = () => (
<Container style={{ height }}>
{/* Your screen content here */}
<BottomSheet {...yourBottomSheetParams} />
</Container>
)
export default Screen

