react-native-router-flux how to open scene with react-native-drawer?

794 Views Asked by At

I try to use react-native-drawer (https://github.com/root-two/react-native-drawer) in my app with react-native-router-flux

According to the documentation I've added my scene with drawer to the Router:

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>

In my LoginScene I call:

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

after press on Login button, but NOTHING happens.

Any ideas? Thanks in advance.

1

There are 1 best solutions below

0
On

Could you try below method

Added the login component

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;