朋友我有隱藏和顯示在運行時當用戶點擊按鈕的組件(視圖)必須隱藏並再次點擊它應該顯示的按鈕。React Native - 在按鈕上隱藏和顯示組件點擊動畫
mycode的:
constructor(props) {
super(props);
this.state = {
isModalVisible : false,
};
}
callFunc(){
if(this.isModalVisible){
this.setState({isModalVisible:false});
}else{
this.setState({isModalVisible:true});
}
}
render() {
return (
<View style = {styles.companyScroll}>
<Button
onPress={this.callFunc}
title="Learn More"
color="#841584"
accessibilityLabel="Learn more about this purple button"
/>
{this.state.isModalVisible && <Picker style ={{backgroundColor : 'white'}}
selectedValue={this.state.language}
onValueChange={(itemValue, itemIndex) => this.setState({language: itemValue})}>
<Picker.Item label="Java" value="java" />
<Picker.Item label="JavaScript" value="js" />
</Picker>
</View>
)
}
我要像下面的圖片。
謝謝。工作中。但想要動畫。任何想法。 –
什麼樣的動畫,不透明或下拉或其他? – Val
你應該使用動畫組件。 https://facebook.github.io/react-native/docs/animated.html –