一句話就可以pop返回了:
this.props.navigator.pop();
demo
var HomeDetail = React.createClass({
render() {
return (
<View style={styles.container}>
<TouchableOpacity onPress={()=>{this.popTopHome()}}>
<Text style={styles.welcome}>
測試跳轉
</Text>
</TouchableOpacity>
</View>
);
},
popTopHome(){
this.props.navigator.pop();
}
});
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'blue',
},
});