0
我需要在图像上单击时更改图像,如果单击图像时需要再次更改图像,如果再次单击图像时需要返回到先前状态在图像反应原生我的代码是:单击后更改图像,再次单击React Native时再次更改为上一图像
constructor (props) {
super(props);
this.state = {
toggleCollapse: false,
selectedUnit: null,
uri: require('../resources/icons/circle.png')
};
_onPress =() => {
this.props.onPressItem(this.props.item, this.props.index);
this._renderLessons(this.props.item, this.props.index);
this.setState({
toggleCollapse: !this.state.toggleCollapse,
uri: require('../resources/loader.gif')
});
}
你的解释很棒:) – Andrew