I cannot seem to get the keyboard to push the content up in my React-Native Expo app.
(我似乎无法在我的React-Native Expo应用程序中使用键盘来推送内容。)
I am testing this from the expo App by publishing it from my development machine.(我正在通过从我的开发机器发布它来通过expo App测试它。)
Try as I might, nothing seems to push the view up when the keyboard comes into focus, is there a specific order of components, or some property I am missing;
(尽我所能尝试,当键盘对准焦点,组件的特定顺序或缺少的某些属性时,似乎没有什么可以推动视图向上移动;)
I have included the versions, the render block and the style blocks I think which are relevant.(我已经包括了我认为相关的版本,渲染块和样式块。)
I am using the following versions (latest);
(我正在使用以下版本(最新);)
"expo": "^29.0.0",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz",
For the login page, the render code looks like the following;
(对于登录页面,呈现代码如下所示;)
render() {
return (
<SafeAreaView style={styles.flexContainer}>
<KeyboardAvoidingView
style={styles.flexContainer}
behavior="padding"
>
<Image style={styles.image} source={require('../../assets/images/backgroundWelcome.png')} role="presentation" />
<View style={styles.container}>
<View style={[styles.row, styles.border]}>
<TextInput
placeholder='Email'
style={styles.input}
onChangeText={(input) => this.setState({email: input})}
value={this.state.email}
/>
</View>
<View style={[styles.row, styles.border]}>
<TextInput
placeholder='Password'
style={styles.input}
secureTextEntry={true}
onChangeText={(input) => this.setState({password: input})}
value={this.state.password}
/>
</View>
<View style={styles.row}>
<StyledButton callback={this.handleLogin} title='Log In'/>
</View>
</View>
</KeyboardAvoidingView>
</SafeAreaView>
)
}
These are the styles that are relevant;
(这些是相关的样式。)
root: {
flex: 1,
alignItems: 'center',
backgroundColor: '#fff',
},
flexContainer: {
flex: 1,
},
container: {
paddingHorizontal: 40,
paddingBottom: 22,
alignItems: 'center',
flex: -1
},
row: {
flexDirection: 'row',
marginVertical: 10,
},
ask by dhj translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…