React Native中的双标头嵌套导航

时间:2020-04-04 10:38:24

标签: react-native navigation

所以我在我的应用程序上设置导航系统时遇到麻烦,这是基本结构;

MainScreen

QuestionMenuScreen

  • QuestionLisaEdition

  • QuestionErikEdition

  • 等等...

这是我设置导航的地方

import { createStackNavigator} from 'react-navigation-stack';
import { createAppContainer} from 'react-navigation';

import MainScreen from '../screens/MainScreen';
import QuestionMenu from '../screens/QuestionMenuScreen';
import QuestionLisaEdition from '../screens/QuestionScreens/QuestionsLisaEdition'

const lisaScreen = {
        screen: QuestionLisaEdition,
        navigationOptions: {
            title: '100 Spørsmål!',
            headerStyle: { backgroundColor: '#f4511e' },
            headerTintColor: '#fff',
            headerTitleStyle: { fontWeight: 'bold' },
            headerTitleAlign: 'center',

    }
}

const questionMenu = {
        screen: QuestionMenu,
}

const mainMenu = {
        screen: MainScreen,
        navigationOptions: {
            title: 'BONSKI',
            headerStyle: { backgroundColor: '#f4511e' },
            headerTintColor: '#fff',
            headerTitleStyle: { fontWeight: 'bold', },
            headerTitleAlign: 'center',
    }
}

const questionScreens = createStackNavigator(
    {
        questionMenu : questionMenu,
        lisaScreen: lisaScreen,


    }
)

questionScreens.navigationOptions = {
        title: 'Velg en playlist',
        headerStyle: { backgroundColor: '#f4511e' },
        headerTintColor: '#fff',
        headerTitleStyle: { fontWeight: 'bold' },
        headerTitleAlign: 'center',
}


const screens = {
    mainMenu,
    questionScreens
}

除标题外,所有内容均正常运行,当我导航至QuestionMenuScreen或QuestionLisaEdition时,我看到两个条,在其中我可以返回到MainScreen或QuestionMenuScreen。我只希望它显示一个裸露的地方,并带有指向上一个屏幕的“返回”箭头。

0 个答案:

没有答案