title: Prevent navigating when double press button quickly react-native
body: <p>Hi I am have code with react-navigation.
  I want to prevent navigating twice when clicking a button quickly. This code is working perfectly.
  This is my <strong>SignedOut</strong> Navigation</p>
  
  <pre><code>export const SignedOut = StackNavigator({
      Onboarding: {
          screen: Onboarding,
          navigationOptions: {
              title: "Onboarding",
              header: null
          }
      },
      InitApp: {
          screen: InitApp,
              navigationOptions: {
              title: "Init",
              header: null
          }
      },
      Auth: {
          screen: Auth,
          navigationOptions: {
              title: "Auth",
              header: null
          }
      }
  });
  const navigateOnce = (getStateForAction) =&gt; (action, state) =&gt; {
          const {type, routeName} = action;
          return (
          state &amp;&amp;
              type === NavigationActions.NAVIGATE &amp;&amp;
              routeName === state.routes[state.routes.length - 1].routeName
      ) ? null : getStateForAction(action, state);       
  };
  SignedOut.router.getStateForAction = navigateOnce(SignedIn.router.getStateForAction);
  </code></pre>
  
  <p>It is working perfectly. But today I want to add params to StackNavigator and <strong>navigateOnce</strong> didn't work! </p>
  
  <p>The code like this:</p>
  
  <pre><code>export const SignedOuts = (firstTime = false) =&gt;
      StackNavigator({
          Onboarding: {
          screen: Onboarding,
          navigationOptions: {
              title: "Onboarding",
              header: null
          }
      },
      InitApp: {
          screen: InitApp,
              navigationOptions: {
              title: "Init",
              header: null
          }
      },
      Auth: {
          screen: Auth,
          navigationOptions: {
              title: "Auth",
              header: null
          }
       }
      },
      {
          initialRouteName: firstTime ? "Onboarding" : "Auth",            
      }
  )
  </code></pre>
  
  <p>It said: <strong>Cannot read property 'getStateForAction' of undefined</strong></p>
  
  <p>What should I do?</p>