1

我尝试在我的应用程序中使用react-native-drawer ( https://github.com/root-two/react-native-drawer ) 和react-native-router-flux

根据文档,我已将带抽屉的场景添加到路由器:

import NavigationDrawer from './scenes/NavigationDrawer';
import MetricsScene from './scenes/MetricsScene';
...
<Router>
     <Scene key="root">

         <Scene key="login"
             component={LoginScene}
             hideNavBar={true}
             initial
         />

         <Scene key="drawer" component={NavigationDrawer} open={false} >
             <Scene key="metrics" component={MetricsScene}/>
         </Scene>

     </Scene>
</Router>

在我的 LoginScene 中,我调用:

Actions.metrics({type: ActionConst.RESET});

按下登录按钮后,但没有任何反应。

有任何想法吗?提前致谢。

4

1 回答 1

0

你能试试下面的方法吗

添加登录组件

import React, { Component } from 'react';
import { Router, Scene } from 'react-native-router-flux';

//Components
import loginfrom './scenes/login'; // Added the your login component
import NavigationDrawer from './scenes/NavigationDrawer';
import MetricsScene from './scenes/MetricsScene';


const App = () => {
  return (
    <Router>
        <Scene key="login" component={LoginScene}  hideNavBar={true} duration={0} />
        <Scene key="drawer" component={NavigationDrawer} open={false} >
             <Scene key="metrics" component={MetricsScene}/>
         </Scene>
    </Router>
  );
}

export default App;
于 2017-05-23T13:23:08.400 回答