Comments (2)
### below is my code
import {createAppContainer} from 'react-navigation';
// import {createStackNavigator} from 'react-navigation-stack';
import {createBottomTabNavigator} from 'react-navigation-tabs';
import React from 'react';
import {connect} from 'react-redux';
import {
createReduxContainer,
createReactNavigationReduxMiddleware,
createNavigationReducer,
} from 'react-navigation-redux-helpers';
// import AuthLoading from '../screens/AuthLoading';
// import Search from '../screens/Search';
import CustomTabBarBottom from '../components/CustomTabBarBottom';
import Goods from '../screens/Goods';
import Serve from '../screens/Serve';
import Member from '../screens/Member';
import Rank from '../screens/Rank';
// import Detail from '../screens/Detail/index';
// import CommentsDetail from '../screens/Rank/Comments/Detail';
// import DataDetail from '../screens/DataDetail';
// import ServiceDetail from '../screens/ServiceDetail';
// import SecondPage from '../screens/SecondPage';
const Home = createBottomTabNavigator(
{
Goods: {
screen: Goods,
navigationOptions: {
title: '商品',
},
},
Serve: {
screen: Serve,
navigationOptions: {
title: '服务',
},
},
Member: {
screen: Member,
navigationOptions: {
title: '会员',
},
},
Rank: {
screen: Rank,
navigationOptions: {
title: '排行榜',
},
},
},
{
tabBarComponent: ({navigation}) => (
<CustomTabBarBottom navigation={navigation} />
),
initialRouteName: 'Goods',
},
);
export const AppNavigator = createAppContainer(Home);
// export const AppNavigator = createAppContainer(
// createStackNavigator(
// {
// AuthLoading,
// Home,
// Detail,
// CommentsDetail,
// DataDetail,
// Search,
// ServiceDetail,
// SecondPage,
// },
// {},
// ),
// );
export const navReducer = createNavigationReducer(AppNavigator);
// fix addListener is not function
export const routeMiddleware = createReactNavigationReduxMiddleware(
'root',
state => state.nav,
);
const App = createReduxContainer('root', AppNavigator);
// const AppWithNavigationState = ({dispatch, nav}) => (
// <AppNavigator
// navigation={addNavigationHelpers({dispatch, state: nav, addListener})}
// />
// );
// AppWithNavigationState.propTypes = {
// dispatch: PropTypes.func.isRequired,
// nav: PropTypes.object.isRequired,
// };
const mapStateToProps = state => ({
nav: state.nav,
});
export default connect(mapStateToProps)(App);
from redux-helpers.
You should be passing the root navigator directly to createReduxContainer
and not using createAppContainer
at all. If you really want the functionality createAppContainer
provides (eg. back button handling) you could try to make the app container look like a navigator by hoisting the root navigator’s static onto the app container using hoist-non-react-statics
. Then presumably you could pass the app container into createReduxContainer
.
from redux-helpers.
Related Issues (20)
- Issues in ThemeProvider HOT 3
- this .setState does'nt work in componnent didmount anyone can help me? HOT 3
- Is @react-navigation/core needed? v4.0.1 HOT 3
- NavState missing routes
- React Nav 5 support - undefined is not object _core.NavigationActions.init HOT 7
- When will react-navigation-5 be adapted? HOT 2
- undefined is not object _core.NavigationActions.init HOT 2
- TypeError: undefined is not an object (evaluating 'Navigator.router')
- React navigation navigation.getChildNavigation is not a fucntion HOT 1
- createReactNavigationReduxMiddleware called more than once
- Cannot read property 'routes' of undefined HOT 2
- TypeScript typings rely on nonexistent @react-navigation/core libdefs HOT 4
- Typings error HOT 2
- Upgrading react-navigation from 1.0.0-beta.13 to latest, having trouble re-integrating my nested navigators with redux. HOT 3
- Cannot read property 'routes' of undefined - react-navigation 3.11, redux-helper 3.0.2 HOT 1
- createNavigationReducer on Web HOT 1
- Upgrading from 1.0.0-beta.21 to v4, gives navigation.getChildNavigation is not a function HOT 3
- Invariant Violation HOT 5
- Changing imports from @react-navigation/core to react-navigation breaks web apps HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux-helpers.