<View style={{flex: 1}}>
<TextInput
placeholder='用户名' value={username}
onChangeText={text => this.setState({username: text})}
style={{height: 40, lineHeight: 40, padding: 10}}/>
<TextInput
secureTextEntry={true}
onChangeText={text => this.setState({password: text})}
value={password}
placeholder="密码"
style={{height: 40, lineHeight: 40, padding: 10}}/>
<Button
onPress={() => {
let {username, password} = this.state;
if (username === 'liaoyf' && password === '123') {
navigate('Profile');
} else {
this.setState({
modalVisible: true
})
}
}}
title="登录"/>
上面的代码中,Button为什么没有高度,不显示呢?
包一个View, Button是根据外层容器布局的