hook reactotron into redux. more search page tweaks.

This commit is contained in:
Akinwale Ariwodola 2019-12-29 11:02:11 +01:00
parent b5abddb69a
commit d538838921
3 changed files with 12 additions and 7 deletions

View file

@ -1,8 +1,12 @@
import AsyncStorage from '@react-native-community/async-storage'; import AsyncStorage from '@react-native-community/async-storage';
import Reactotron from 'reactotron-react-native' import Reactotron from 'reactotron-react-native';
import { reactotronRedux } from 'reactotron-redux';
Reactotron const reactotron = Reactotron
.setAsyncStorageHandler(AsyncStorage) // AsyncStorage would either come from `react-native` or `@react-native-community/async-storage` depending on where you get it from .setAsyncStorageHandler(AsyncStorage) // AsyncStorage would either come from `react-native` or `@react-native-community/async-storage` depending on where you get it from
.configure() // controls connection & communication settings .configure() // controls connection & communication settings
.useReactNative() // add all built-in react native plugins .useReactNative() // add all built-in react native plugins
.connect(); // let's connect! .use(reactotronRedux())
.connect();
export default reactotron;

View file

@ -42,6 +42,7 @@ import AppWithNavigationState, {
} from 'component/AppNavigator'; } from 'component/AppNavigator';
import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist'; import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
import { __ } from 'i18n'; import { __ } from 'i18n';
import reactotron from '../reactotron';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4'; import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
import FilesystemStorage from 'redux-persist-filesystem-storage'; import FilesystemStorage from 'redux-persist-filesystem-storage';
@ -179,7 +180,7 @@ const sharedStateCallback = ({ dispatch, getState }) => {
const emailVerified = selectUserVerifiedEmail(state); const emailVerified = selectUserVerifiedEmail(state);
if (syncEnabled && emailVerified) { if (syncEnabled && emailVerified) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password =>
dispatch(doGetSync(password)) dispatch(doGetSync(password)),
); );
} }
}; };
@ -195,7 +196,7 @@ const composeEnhancers = compose;
const store = createStore( const store = createStore(
enableBatching(reducers), enableBatching(reducers),
{}, // initial state, {}, // initial state,
composeEnhancers(applyMiddleware(...middleware)) composeEnhancers(applyMiddleware(...middleware), reactotron.createEnhancer()),
); );
window.store = store; window.store = store;

View file

@ -71,8 +71,8 @@ class SearchPage extends React.PureComponent {
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const { currentRoute, query } = nextProps; const { currentRoute, query, isSearching } = nextProps;
const { currentRoute: prevRoute, search } = this.props; const { currentRoute: prevRoute, search, isSearching: prevIsSearching } = this.props;
if (Constants.DRAWER_ROUTE_SEARCH === currentRoute && currentRoute !== prevRoute) { if (Constants.DRAWER_ROUTE_SEARCH === currentRoute && currentRoute !== prevRoute) {
this.onComponentFocused(); this.onComponentFocused();