В настоящее время я пытаюсь использовать переопределение поведения правой кнопки навигации из моего представления под названием «НазначениеПроектирование». Я полностью смутился тем, что 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>