index.android.js ou index.io.js
...
render() {
return (
<Navigator
initialRoute={{component: Tela1}}
configureScene={() => {
return Navigator.SceneConfigs.FloatFromRight;
}}
renderScene={(route, navigator) => {
_navigator = navigator;
if(route.component){
// Não esqueça de passar o navigator e o route
return React.createElement(route.component, {navigator,route});
}
}} />
);
}
...
Tela1.js
...
goToTela2 = () => {
this.props.navigator.push({
component: Tela2,
callback: this.callback,
});
};
callback = () => {
console.log('callback');
}
...
Tela2.js
...
goBack(){
this.props.route.callback();
this.props.navigator.pop();
}
...
No comments:
Post a Comment