Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to integrate it with Provider & PersistGate #15

Open
alainib opened this issue Apr 4, 2018 · 0 comments
Open

how to integrate it with Provider & PersistGate #15

alainib opened this issue Apr 4, 2018 · 0 comments

Comments

@alainib
Copy link

alainib commented Apr 4, 2018

Steps to reproduce

this is my actual code :

store.js

import { createStore, compose, applyMiddleware } from 'redux';
import { persistStore, persistCombineReducers } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import { createLogger } from 'redux-logger';
import rootReducers from "test/src/redux/reducers";

const config = {
  key: 'root',
  storage,
};
const middleware = [];

const reducers = persistCombineReducers(config, rootReducers);
const enhancers = [applyMiddleware(...middleware)];
const initialState = {};
const persistConfig = { enhancers };
const store = createStore(reducers, undefined, compose(...enhancers));
const persistor = persistStore(store, persistConfig, () => {});
const configureStore = () => {
  return { persistor, store };
}

export default configureStore;

App.js

import configureStore from "test/src/redux/store";
const { persistor, store } = configureStore();

const MyTabView = TabNavigator({ ... });

export default class App extends React.PureComponent {
 ...	
 render() {
	return (
	  <Provider store={store}>
		<PersistGate
		  loading={<ActivityIndicator />}
		  persistor={persistor}>
			<MyTabView />          
		</PersistGate>
	  </Provider>
	);
  }
}

Expected behaviour

how to integrate your lib with Provider and PersistGate instead of AppNavigator

Environment

  • react: "^16.3.0-alpha.1",
  • react-native: "0.54.2",
  • React Native platform + platform version**: iOS and Android

react-navigation-is-focused-hoc

Version: npm version or "master"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant