render() {
return (
<View style={{flex:1,flexDirection:'column',justifyContent:'space-evenly',alignItems:'center',backgroundColor:datum.secondaryColor}}>
<TextInput
placeholderTextColor={datum.secondaryColor}
style={{
height: '7%', borderColor:datum.primaryColor, borderWidth: 1,
width:'50%',backgroundColor:datum.primaryColor, fontWeight: '200'
}}
onChangeText={(value) => this.setState({name:value})}
placeholder="Name"
/>
<TextInput
placeholderTextColor={datum.secondaryColor}
style={{height: '7%', borderColor:datum.primaryColor, borderWidth: 1,width:'50%',backgroundColor:datum.primaryColor, fontWeight: '200'}}
onChangeText={(value) => this.setState({number:value})}
placeholder="Mobile no"
/>
<Button
onPress={()=>this.signupPressed()
}
title="Signup"
color={datum.primaryColor}
accessibilityLabel="Learn more about this purple button"
/>
</View>
);
}
实际上,我正在设计一个简单的表单页面,在处理键盘时遇到了麻烦,是的,我还看到了本机文档的反应,因为他们建议我使用Keyboardavoiding视图,但这样会使布局更糟,任何人都可以告诉如何处理问题
答案 0 :(得分:1)
我认为虚拟键盘正在影响您的宽度和高度,您可以尝试使用尺寸:
var windowWidth = Dimensions.get('window').width;
var windowHeight = Dimensions.get('window').height;
width: width * 0.5
height: height * 0.07