如何在绑定到 'react-native-router-flux' 中的 onPress 事件的函数中调用 Actions.xxx
How to call Actions.xxx in functions binded to onPress event in 'react-native-router-flux'
我正在使用 RN0.24 和 flux3.26。 RN 版本可能已过时,但 Actions.xxx
在我使用 onPress={Actions.xxx}
时工作正常
但是,一旦我将它放入 onPress={this.function}
之类的函数中,并且在函数中我就这样做了
function(event){ Actions.xxx; }
那就不行了
有人能帮忙吗?
这是一个this
问题,我想你可以试试:
render() {
const login = () => { Action.login() }
return (
<View style={styles.container}>
<Text style={styles.welcome} onPress={ login }>
Go to Login
</Text>
</View>
);
}
}
希望对他有帮助。
我正在使用 RN0.24 和 flux3.26。 RN 版本可能已过时,但 Actions.xxx
在我使用 onPress={Actions.xxx}
时工作正常
但是,一旦我将它放入 onPress={this.function}
之类的函数中,并且在函数中我就这样做了
function(event){ Actions.xxx; }
那就不行了
有人能帮忙吗?
这是一个this
问题,我想你可以试试:
render() {
const login = () => { Action.login() }
return (
<View style={styles.container}>
<Text style={styles.welcome} onPress={ login }>
Go to Login
</Text>
</View>
);
}
}
希望对他有帮助。