Skip to content

Commit

Permalink
[native] Don't use string as action for NAV/@@init
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashoat committed May 28, 2020
1 parent f945f54 commit cfbfb8e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions native/root.react.js
Expand Up @@ -52,6 +52,8 @@ if (Platform.OS === 'android') {
}

const navStateAsyncStorageKey = 'navState';
const navInitAction = Object.freeze({ type: 'NAV/@@INIT' });
const navUnknownAction = Object.freeze({ type: 'NAV/@@UNKNOWN' });

type Props = {
// Redux state
Expand Down Expand Up @@ -108,7 +110,7 @@ class Root extends React.PureComponent<Props, State> {
}
this.navState = initialState;
this.setNavContext();
actionLogger.addOtherAction('navState', 'NAV/@@INIT', null, initialState);
actionLogger.addOtherAction('navState', navInitAction, null, initialState);
this.setState({ initialState });
}

Expand Down Expand Up @@ -188,7 +190,7 @@ class Root extends React.PureComponent<Props, State> {
const { queuedActions } = this;
this.queuedActions = [];
if (queuedActions.length === 0) {
queuedActions.push('NAV/@@UNKNOWN');
queuedActions.push(navUnknownAction);
}
for (let action of queuedActions) {
actionLogger.addOtherAction('navState', action, prevState, state);
Expand Down Expand Up @@ -230,7 +232,7 @@ class Root extends React.PureComponent<Props, State> {

onNavAction = (action: GenericNavigationAction | string) => {
if (typeof action === 'string') {
this.queuedActions.push(`NAV/${action}`);
this.queuedActions.push({ type: `NAV/${action}` });
} else if (
action &&
typeof action === 'object' &&
Expand Down

0 comments on commit cfbfb8e

Please sign in to comment.