导航抽屉与redux使用反应导航

时间:2018-03-23 06:13:02

标签: react-native redux navigation-drawer

如何使用反应原生的反应导航将redux与导航抽屉集成。这是我没有redux的代码

import React, { Component } from "react";
import { AppRegistry } from "react-native";
import { StackNavigator, DrawerNavigator } from "react-navigation";
import DrawerMenu from "./containers/DrawerMenu";
import BarChart from "./containers/BarChart";
import PieChart from "./containers/PieChart";
import LineChart from "./containers/LineChart";

const MainScreenNavigator = StackNavigator ({
    bChart: { screen: BarChart },
    pChart: { screen: PieChart },
    lChart: { screen: LineChart }
});
const Drawer = DrawerNavigator (
    {
        Main: { screen: MainScreenNavigator }
    },
    {
        contentComponent: DrawerMenu,
        drawerWidth: 200
    }
);
export default Drawer;

1 个答案:

答案 0 :(得分:0)

不建议将React Navigation与Redux(redux-integration)连接。就个人而言,即使使用多个嵌套的导航器,它们分开时也没有任何问题。您不必将导航器保留在商店中。您应该考虑将它们分开。