How to use the @react-navigation/core.withNavigation 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 keybase / client / shared / util / safe-navigation.tsx View on Github external
// @ts-ignore
        
      )
    }
  }
  const WithForwardRef = React.forwardRef((props: WithSafeNavigationProps, ref) => (
    
  ))
  WithForwardRef.displayName = `ForwardRef(WithSafeNavigation)`
  return withNavigation(WithForwardRef)
}
github react-navigation / native / src / createNavigationAwareScrollable.js View on Github external
export default function createNavigationAwareScrollable(Component: any) {
  const ComponentWithNavigationScrolling = withNavigation(
    class extends React.PureComponent {
      static displayName = `withNavigationScrolling(${Component.displayName ||
        Component.name})`;

      _subscription: any;

      componentDidMount() {
        this._subscription = this.props.navigation.addListener(
          'refocus',
          () => {
            const scrollableNode = this.getNode();
            if (this.props.navigation.isFocused() && scrollableNode !== null) {
              if (scrollableNode.scrollToTop != null) {
                scrollableNode.scrollToTop();
              } else if (scrollableNode.scrollTo != null) {
                scrollableNode.scrollTo({ y: 0 });
github react-navigation / core / example / src / EventsStack.js View on Github external
return (
      
    );
  }
}

const FocusTag = withNavigation(FocusTagWithNav);

class SampleScreen extends React.Component {
  static navigationOptions = ({ navigation }) => ({
    title: 'Lorem Ipsum',
    headerRight: navigation.getParam('nextPage') ? (
      <button title="Next"> navigation.navigate(navigation.getParam('nextPage'))}
      /&gt;
    ) : null,
  });

  componentDidMount() {
    this.props.navigation.addListener('refocus', () =&gt; {
      if (this.props.navigation.isFocused()) {
        this.scrollView.scrollTo({ x: 0, y: 0 });</button>
github react-navigation / web / src / Link.js View on Github external
? `/${pathAndParams.path}?${queryString.stringify(pathAndParams.params)}`
      : `/${pathAndParams.path}`;
    return (
      <a href="{href}"> {
          navigation.dispatch(navAction);
          e.preventDefault();
        }}
      &gt;
        {children}
      </a>
    );
  }
}
const Link = withNavigation(LinkWithNavigation);

export default Link;