0
我有以下代碼如何使用導航器轉到反應原生的另一個組件?
InterfaceA是帶有文本視圖的另一個反應組件。
當前當我點擊「轉到另一個組件」時,它會一直回到它自己的視圖。
當我按「轉到另一個組件」它不會去interfaceA視圖。有誰知道我如何使用navigator.push去interfaceA?
var ToolbarAndroidExample = React.createClass({
_goA: function(navigator) {
navigator.push({
component: InterfaceA
})
},
_goPrevious: function(navigator) {
navigator.pop();
},
_renderScene: function(route, navigator) {
return (
<View>
<TouchableHighlight onPress={() => this._goA(navigator) }>
<Text> Go another component </Text>
</TouchableHighlight>
<TouchableHighlight onPress={() => this._goPrevious() }>
<Text> Go previous</Text>
</TouchableHighlight>
</View>
)
},
render: function() {
return (
<Navigator
initialRoute={{
message: "First Scene. Press me to go to the next scene.", index: 1
}}
renderScene={this._renderScene} />
);
},
});
爲什麼downvote? –