一直无法使用goBack(key)返回登录页(react navigation)



  • /**

    • Sample React Native App
    • https://github.com/facebook/react-native
    • @flow
      */
      'use strict';
      import React, { Component } from 'react';
      import Storage from 'react-native-storage';
      import MainScence from './src/scene/MainScence'
      import {
      AppRegistry,
      } from 'react-native';
      import { StackNavigator, TabNavigator, TabBarBottom } from 'react-navigation';

    import color from './src/scene/widget/color'
    import TabBarItem from './src/scene/widget/TabBarItem'

    import AdvisoryScence from './src/scene/First/AdvisoryScence'
    import ASSpeakCase from './src/scene/First/ASSpeakCase'
    import ASSpeakSec from './src/scene/First/ASSpeakSec'

    import CaseScence from './src/scene/Second/CaseScence'
    import CaseScenceMain from './src/scene/Second/CaseScenceMain'

    import MedicalNewsScence from './src/scene/Third/MedicalNewsScence'
    import MineScene from './src/scene/Fouth/MineScence'
    import ASDoctorNewsSence from './src/scene/Fouth/ASDoctorNewsSence'
    import CaseWebDetail from './src/scene/Second/CaseWebDetail'

    import WebScene from './src/scene/widget/WebScene'
    import GuideView from './src/scene/GuideView.js'
    import LoginScene from './src/scene/LoginScene.js'

    const Tab = TabNavigator(
    {
    Home: {
    screen:ASSpeakCase,
    navigationOptions: ({ navigation }) => ({
    tabBarLabel: '咨询',
    tabBarIcon: ({ focused, tintColor }) => (
    <TabBarItem
    tintColor={tintColor}
    focused={focused}
    normalImage={require('./src/img/tabbar_1N.png')}
    selectedImage={require('./src/img/tabbar_1S.png')}
    />
    )
    }),
    },
    Nearby: {
    screen: CaseScenceMain,
    navigationOptions: ({ navigation }) => ({
    tabBarLabel: '病例',
    tabBarIcon: ({ focused, tintColor }) => (
    <TabBarItem
    tintColor={tintColor}
    focused={focused}
    normalImage={require('./src/img/tabbar_2N.png')}
    selectedImage={require('./src/img/tabbar_2S.png')}
    />
    )
    }),
    },

        Order: {
            screen: ASDoctorNewsSence,
            navigationOptions: ({ navigation }) => ({
                tabBarLabel: '医讯',
                tabBarIcon: ({ focused, tintColor }) => (
                    <TabBarItem
                        tintColor={tintColor}
                        focused={focused}
                        normalImage={require('./src/img/tabbar_3N.png')}
                        selectedImage={require('./src/img/tabbar_3S.png')}
                    />
                )
            }),
        },
    
        Mine: {
            screen: MineScene,
            navigationOptions: ({ navigation }) => ({
                tabBarLabel: '我的',
                tabBarIcon: ({ focused, tintColor }) => (
                  <TabBarItem
                        tintColor={tintColor}
                        focused={focused}
                        normalImage={require('./src/img/tabbar_4N.png')}
                        selectedImage={require('./src/img/tabbar_4S.png')}
                    />
                )
            }),
        },
    },
    {
        tabBarComponent: TabBarBottom,
        tabBarPosition: 'bottom',
        swipeEnabled: true,
        animationEnabled: true,
        lazy: true,
        tabBarOptions: {
            activeTintColor: color.theme,
            headerTintColor:color.theme,
            inactiveTintColor: '#979797',
            style: { backgroundColor: '#ffffff' },
        },
    }
    

    );
    const AppTabNav=StackNavigator(
    {
    Tab: { screen: Tab },
    CaseDetail: { screen: CaseScence},
    SpeakDetail:{screen:ASSpeakSec},
    CaseH5Detail:{screen:CaseWebDetail},
    },
    {
    navigationOptions: {
    headerBackTitle: '',
    headerTintColor: '#333333',
    showIcon: true,
    },
    }
    );
    const MyFirstApp = StackNavigator({
    Guide:{screen:GuideView},
    Profile: {screen: LoginScene},
    Main:{screen:AppTabNav,
    navigationOptions: {
    header:null,
    }},
    }, {initialRouteName: 'Profile',},
    );

    AppRegistry.registerComponent('MyFirstApp', () => MyFirstApp);


Log in to reply