/* @flow */

import React from 'react';
import hoistStatics from 'hoist-non-react-statics';

import { ContextWithNavigation } from '../TypeDefinition';

export default function withNavigation(Component: ReactClass<T>) {
  const componentWithNavigation = (props: T, { navigation }: ContextWithNavigation) => (
    <Component {...props} navigation={navigation} />
  );

  componentWithNavigation.displayName = `withNavigation(${Component.displayName || Component.name})`;

  componentWithNavigation.contextTypes = {
    navigation: React.PropTypes.object.isRequired,
  };

  return hoistStatics(componentWithNavigation, Component);
}

/* @flow */

import React from 'react';
import hoistStatics from 'hoist-non-react-statics';

import type { ContextWithNavigation } from '../TypeDefinition';

export default function withNavigation(Component: ReactClass<T>) {
  const componentWithNavigation = (props: T, { navigation }: ContextWithNavigation) => (
    <Component {...props} navigation={navigation} />
  );

  componentWithNavigation.displayName = `withNavigation(${Component.displayName || Component.name})`;

  componentWithNavigation.contextTypes = {
    navigation: React.PropTypes.object.isRequired,
  };

  return hoistStatics(componentWithNavigation, Component);
}

Fix missing "type" in flow import.
[FLOW] Fix missing "type" in flow import. 

Fixes: Named import from module `../TypeDefinition` `ContextWithNavigation` is a type, but not a value. In order to import it, please use `import type`.