我想隐藏 Sign Up 并且我使用了 的disable
属性,TouchableOpacity
但它似乎不起作用
const isInvalid =
passwordOne !== passwordTwo ||
passwordOne === "" ||
email === "" ||
username === "";
<TouchableOpacity style={styles.button} disabled={isInvalid}>
<Text style={styles.buttonText} onPress={this.handleSignUp}>
Sign up
</Text>
</TouchableOpacity>
但是注册按钮没有隐藏
我的代码:
import ....
const INITIAL_STATE = {
...
};
export default class Signup extends Component<{}> {
handleSignUp = () => {
...
};
render() {
const isInvalid =
passwordOne !== passwordTwo ||
passwordOne === "" ||
email === "" ||
username === "";
return (
<View style={styles.container}>
<TextInput .../>
<TextInput .../>
<TextInput ... />
<TextInput ... />
<TouchableOpacity style={styles.button} disabled={isInvalid}>
<Text style={styles.buttonText} onPress={this.handleSignUp}>
Sign up
</Text>
</TouchableOpacity>
</View>
);
}
}
const styles = StyleSheet.create({
});