react-native icon indicating copy to clipboard operation
react-native copied to clipboard

How to push a component from another component using Navigator Component (react-native Android ) ?

Open prashanthmerugucs opened this issue 11 years ago • 5 comments

<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 )

prashanthmerugucs avatar Sep 16 '15 12:09 prashanthmerugucs

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.

h87kg avatar Sep 16 '15 13:09 h87kg

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

andreicoman11 avatar Sep 16 '15 15:09 andreicoman11

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!

brentvatne avatar Sep 16 '15 16:09 brentvatne

Please refer to my demo app

h87kg avatar Sep 17 '15 09:09 h87kg

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}
); },

prashanthmerugucs avatar Sep 22 '15 08:09 prashanthmerugucs