How do I prevent keyboard from pushing overlay view up?
My solution to this problem :
import React , {Component} from 'react';
import {View , Dimensions,ScrollView} from 'react-native';
const windowHeight = Dimensions.get('window').height;
export default class Items extends Component {
render(){
return(
<View style={{flex:1}}>
<ScrollView style={{flex:1}}>
<View style={{width:'100%', height:windowHeight }}>
/*Every thing inside this will shift up with out changing style */
</View>
</ScrollView>
</View>
)
}
}
How to avoid Soft Keyboard from pushing Buttons up in Android (iOS is OK)
This worked for me,
setting
android:windowSoftInputMode="adjustResize"
and using KeyboardAvoidingView component from react-native to automatically adjust the views to keyboard
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
style={{flex: 1}}>
<ScrollView
keyboardShouldPersistTaps="handled">
...
<TextInput />
...
</ScrollView>
<Button>Save</Button>
</KeyboardAvoidingView>
Related Topics
How Listview'S Recycling Mechanism Works
How to Get Screen Dimensions as Pixels in Android
How to Handle Notification When App in Background in Firebase
How to Open a New Fragment from Another Fragment
Download Failed Because the Resources Could Not Be Found
How to Make User Login from Only One Device At a Time
Why Is the Android Emulator So Slow? How to Speed Up the Android Emulator
How to Get the Current Gps Location Programmatically in Android
Onactivityresult Is Not Being Called in Fragment
Aligning Textviews on the Left and Right Edges in Android Layout
Java.Io.Ioexception: Permission Denied Cannot Create File
React Native: Java_Home Is Not Set and No 'Java' Command Could Be Found in Your Path
How to Use Localbroadcastmanager
Best Practice For Instantiating a New Android Fragment
Activity Restart on Rotation Android
How to Retrieve Current Fragment in Navhostfragment
Android Force Gpu Rendering How to Enable and Disable
Method to Refresh Fragment Content When Data Changed ( Like Recall Oncreateview)