2016-03-24 4 views
0

私は現在、「AppointmentBookingView」と呼ばれる私のビューから右ナビゲーションボタンの動作を無効にしようとしています。 NavigatorとNavigationBarがどのように連携して解決策を見つけられなかったのか全くわかりました。これを行うことさえできれば、誰でも明確にすることができますか?ビュー内のナビゲーションバーボタンを変更するにはどうすればよいですか?

私はReact Native Gifted Formsを使用しています。

myapp.ios.js:

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

    ); 
} 

私はあなたが何ができるかを行動に

AppointmentBookingView.js

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

答えて

1

を上書きしたいのはここだものですこのように:

... 

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

... 

私の回答は少し遅れますが、私はそれが助けてくれることを願っています。

関連する問題