Reflect native modality, avoid adjusting view size when opening the keyboard (Android)

I am using a react-native modal that contains a View.
View has some TextInput elements. When the keyboard pops up, the View elements are all collapsed to fit the remaining space, but I don’t want the View Completely changed.

This will not happen to IOS. Moreover, it will not happen in a non-modal Android view in the same application.

I set windowSoftInputMode=”adjustPan” in my android Manifest, but it doesn’t seem to be applied on Modal.

return( 
style={{flex: 1}} imageStyle={{resizeMode:'cover'}}>

(...)
presentationStyle={'fullScreen'}
onRequestClose={() => this.closeModal()}>

style={ {flex: 1}} imageStyle={{resizeMode:'cover'}}>




(...)

flexDirection:'row'}}>
onChangeText={(myTitle) => this.setState({ myTitle}))
placeholder='Title'
/>

< div class="answer"> As a workaround, I ended up using Modal’s subview instead of the fixed height value of flex. (Used size height to get). It seems to work as I expected.

I’m using a reactive native modal that contains a View.
View has some TextInput elements. When the keyboard pops up, the View elements are all collapsed to fit the remaining space, but I don’t want the View to change completely.

< /p>

This will not happen in IOS. Moreover, it will not happen in the non-modal Android view in the same application.

I set it in my android Manifest windowSoftInputMode = “adjustPan”, but it doesn’t seem to be applied on Modal.

return( 
style={{flex: 1}} imageStyle={{resizeMode:'cover'}}>

(...)
presentationStyle={'f ullScreen'}
onRequestClose={() => this.closeModal()}>

style={{flex: 1}} imageStyle={{resizeMode:'cover'}}>




(...)

flexDirection:'row'}}>
onChangeText={(myTitle) => this.setState({myTitle })}
placeholder='Title'
/>

As a solution, I ended up using Modal’s subview instead of flex’s fixed height value. (Used size height to get). It seems to work as I expected.

Leave a Comment

Your email address will not be published.