0
我有一个反应组件类像下面更改活动状态和挠曲过渡
<View style={{flex: 1}}>
<TouchableOpacity style={styles.FreeCoffee}/>
<TouchableOpacity style={styles.Help}/>
</View>
既touchableopacity组件具有柔性2的值,以便它们同样在窗口划分。当其中一个touchableopacity按下时,我想在flex到2之间转换为4,这样一个盒子可以随着动画一起增长,也可以将其标记为“活动”或“选定”。我已经搜索了很多次,但因为我是ReactNative的初学者,所以找不到任何适当的方法。
这是可能或可以实现的吗?
//编辑全码
import React from 'react'
import {ScrollView, Text, View, TouchableOpacity, Button} from 'react-native'
import styles from '../Styles/Containers/HomePageStyle'
export default class HomePage extends React.Component {
constructor(props){
super(props);
/*this.state = {
active : { flex : 8 }
}*/
}
render() {
return (
<View style={styles.mainContainer}>
<View style={{flex: 1}}>
<TouchableOpacity style={styles.FreeCoffee}/>
<TouchableOpacity style={styles.Help}/>
</View>
</View>
)
}
componentWillMount(){
}
animateThis(e) {
}
}
感谢您的评论真棒的答案!将使用此并深入调查。 –