How to push a component from another component using Navigator Component (react-native Android ) ?
<Navigator initialRoute={{name: 'My First Scene', index: 0}}
renderScene={(route, navigator) =>
<LoginPopup name={route.name}
navigator = {this.props.navigator}
onForward={() => {
var nextIndex = route.index + 1;
navigator.push({ name: 'Scene ' + nextIndex, index: nextIndex, }); }} onBack={() => {
if (route.index > 0) { navigator.pop(); } }} /> } />
In LoginPopup i want to call navigator.push ( Another Component )
renderScene: function(route, navigator) {
if ('login' === route.id) {
return (
<Login
name={route.name}
navigator={navigator}
onForward={() => {}}
onBack={() => {}} />
);
}
if ('main' === route.id) {
return (
<MainPage
navigator={navigator} />
);
}
},
navigator.push({id: 'login', title: 'Login'});
UIExplorer is the best sample app. Please refer it again.
The Movies sample app is a good example of how to use the navigator in android https://github.com/facebook/react-native/tree/master/Examples/Movies/android/app
Hi! I hope the advice here helped -- that said, these types of questions are best suited for StackOverflow, whereas Github issues are ideal for bug reports and feature requests. Good luck!
Please refer to my demo app
How to pass property id from Navigator.NavigationBar and how to access in RightButton of NavigationBarRouteMapper
<Navigator.NavigationBar id={name} style={{backgroundColor: '#246dd5'}} routeMapper={NavigationBarRouteMapper} />
RightButton(route, navigator, index, nextState) {
return (
<TouchableOpacity style={{flex: 1, justifyContent: 'center'}}
onPress={() => navigator.parentNavigator.push({id: {route.id})}>
<Text style={{color: 'white', margin: 10,}}>
{route.id}
);
},