2016-03-24 25 views
0

Şu anda 'GezinmeBooking Görünümü' adlı görünümümden doğru gezinme düğmesinin davranışını geçersiz kılmaya çalışıyorum. Navigator ve NavigationBar'ın birlikte nasıl çalıştığı konusunda kafamı karıştırdım, böylece çözümü çözemedim. Bunun bile yapılıp yapılmayacağını bilen var mı?Gezinme çubuğu düğmelerini bir görünümde nasıl değiştiririm?

React Native Gifted Forms kullanıyorum.

myapp.ios.js: Ben ne yapabileceğim bir şey

<GiftedForm 
    formName='bookingForm' // GiftedForm instances that use the same name will also share the same states 

    openModal={(route) => { 
     route.giftedForm = true; 
     this.props.navigator.push(route); 
    }} 
> 
</GiftedForm> 

cevap

1

davranışla

AppointmentBookingView.js geçersiz kılmak istiyoruz burasıdır

static NavbarRouteMapper = { 
    LeftButton(route, navigator, index, navState) { 
     if (index === 0) { 
      return null; 
     } 
     var previousRoute = navState.routeStack[index - 1]; 
     return (
      <TouchableOpacity 
       onPress={() => navigator.pop()} 
       style={styles.navBarLeftButton}> 
       <Text style={[styles.navBarText, styles.navBarButtonText]}> 
        Back 
       </Text> 
      </TouchableOpacity> 
     ); 
    }, 

    RightButton(route, navigator, index, navState) { 

    }, 

    Title(route, navigator, index, navState) { 
     return (
      <Text style={[styles.navBarText, styles.navBarTitleText]}> 
       {route.name || 'MyApp'} 
      </Text> 
     ); 
    } 
}; 

render(){ 
    return (
     <Navigator 
      style={styles.appContainer} 
      configureScene={this.configureScene} 
      initialRoute={{name: 'MyApp', component: BookAppointmentView }} 
      navigationBar={ 
       <Navigator.NavigationBar 
        style={styles.navBar} 
        routeMapper={MyApp.NavbarRouteMapper} 
       /> 
      } 
      renderScene={this.renderScene.bind(this)} 
     /> 

    ); 
} 

var bunun gibi:

... 

RightButton(route, navigator, index, navState) { 
    if (route.name === 'AppointmentBookingView') { 
     // Here put the button you want and whatever you want it to do 
    } 
}, 

... 

Cevabım biraz geç oldu ama umarım yardımcı olur

İlgili konular