В реагирующей навигации (до 5) я достиг того, что вы сказали, передавая верхнюю навигацию в качестве опоры вниз, используя пользовательский компонент навигации, например:
// this component's navigation is replaced by upper navigation, you can send another prop if you need both navigations.
const MyComponent0 = createStackNavigator(
{
Child1: {
screen: Child1,
navigationOptions: ({navigation}) => {
return {
headerRight: (
// you can use BackButton of library with import it, I wrote my own, that time i didn't know there is a ready importable back button.
<TouchableOpacity
style={{paddingLeft: 10}}
onPress={() => navigation.toggleDrawer()}>
<Icon ios="ios-menu" android="md-menu" style={{color: '#fff'}} />
</TouchableOpacity>
),
headerTitle: <Text style={styles.whiteText}>Child1 title</Text>,
headerLeft: (
<HeaderBackButton
style={{color: '#FFF'}}
onPress={() => navigation.goBack(null)}
/>
),
};
},
},
Child2,
...
},
{
defaultNavigationOptions: {
headerTitleStyle: {
color: '#fff',
fontSize: 13,
...Platform.select({
android: {
fontFamily: ...,
},
ios: {
fontFamily: ...,
},
}),
},
headerStyle: {
backgroundColor: 'rgba(0,0,0,1)',
},
headerTintColor: 'white',
},
},
);
class MyComponent1 extends Component {
constructor() {
super();
}
static router = MyComponent0.router;
render() {
return <MyComponent0 navigation={this.props.navigation} />; // you can send like navigation1 if you need downward navigation too.
}
}
Этот код в старом подходе , но он работает с использованием ответной навигации до 5. Надеюсь, это поможет вам.