How to use the @react-navigation/core.getNavigation function in @react-navigation/core

To help you get started, we’ve selected a few @react-navigation/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-navigation / web / src / handleServerRequest.js View on Github external
// Get initial action from the URL
  const navigationAction =
    Router.getActionForPathAndParams(path, query) || NavigationActions.init();

  // Get state from reducer
  const navigationState = Router.getStateForAction(navigationAction);

  const actionSubscribers = new Set();

  // Prepare top-level navigation prop
  let navigation = null;
  function getCurrentNavigation() {
    return navigation;
  }

  navigation = getNavigation(
    Router,
    navigationState,
    () => {},
    actionSubscribers,
    () => ({}),
    getCurrentNavigation
  );

  // Get title from active screen options
  const activeKey = navigationState.routes[navigationState.index].key;
  const activeChildNavigation = navigation.getChildNavigation(activeKey);
  const options = Router.getScreenOptions(activeChildNavigation);
  const title = options.title || options.headerTitle;

  return { navigation, title, options };
}
github keybase / client / shared / router-v2 / router.desktop.js View on Github external
render() {
      let navigation = this.props.navigation
      const navState = this.state.nav
      if (!navState) {
        return null
      }
      if (!this._navigation || this._navigation.state !== navState) {
        this._navigation = getNavigation(
          Component.router,
          navState,
          this.dispatch,
          this._actionEventSubscribers,
          this._getScreenProps,
          () => this._navigation
        )
      }
      navigation = this._navigation
      return (
        
          
        
      )
    }
github react-navigation / native / src / createAppContainer.js View on Github external
render() {
      let navigation = this.props.navigation;
      if (this._isStateful()) {
        const navState = this.state.nav;
        if (!navState) {
          return this._renderLoading();
        }
        if (!this._navigation || this._navigation.state !== navState) {
          this._navigation = getNavigation(
            Component.router,
            navState,
            this.dispatch,
            this._actionEventSubscribers,
            this._getScreenProps,
            () => this._navigation
          );
        }
        navigation = this._navigation;
      }
      invariant(navigation, 'failed to get navigation');

      return (
github react-navigation / web / src / createBrowserApp.js View on Github external
render() {
      this._navigation = getNavigation(
        App.router,
        this.state.nav,
        this.dispatch,
        this._actionEventSubscribers,
        () => this.props.screenProps,
        () => this._navigation
      );
      return (
        
          
            
          
        
      );
    }
    dispatch = action => {
github keybase / client / shared / router-v2 / router.desktop.tsx View on Github external
render() {
      let navigation = this.props.navigation
      const navState = this.state.nav
      if (!navState) {
        return null
      }
      if (!this.navigation || this.navigation.state !== navState) {
        this.navigation = getNavigation(
          Component.router,
          navState,
          this.dispatch,
          this.actionEventSubscribers,
          this._getScreenProps,
          () => this.navigation
        )
      }
      navigation = this.navigation
      return (
        
          
        
      )
    }
github react-navigation / redux-helpers / src / middleware.js View on Github external
): NavigationScreenProp => {
    invariant(
      router,
      "App.router must be provided to createNavigationPropConstructor as of " +
        "react-navigation-redux-helpers@2.0.0. Learn more: " +
        "https://reactnavigation.org/docs/en/" +
        "redux-integration.html#breaking-changes-in-2.3",
    );
    invariant(
      getCurrentNavigation,
      "getCurrentNavigation must be provided to createNavigationPropConstructor as of " +
        "react-navigation-redux-helpers@2.0.0. Learn more: " +
        "https://reactnavigation.org/docs/en/" +
        "redux-integration.html#breaking-changes-in-2.3",
    );
    return getNavigation(
      router,
      state,
      dispatch,
      getReduxSubscribers(key),
      getScreenProps,
      getCurrentNavigation,
    );
  };
}