@exponent/ex-navigation
Version:
Route-centric navigation libary for React Native.
63 lines (51 loc) • 1.83 kB
Flow
/**
* @flow
*/
import React from 'react';
import {
NavigationExperimental,
} from 'react-native';
import NavigationTypeDefinition from 'react-native/Libraries/NavigationExperimental/NavigationTypeDefinition';
import { Animated } from 'react-native';
import type { EventEmitter } from 'fbemitter';
import type { ExNavigationRoute } from './ExNavigationRouter';
import type {
NavigationSceneRendererProps,
} from 'NavigationTypeDefinition';
export type ExNavigationStyles = {
applyAnimation: ?((position: Animated.Value, navigationState: Object) => void);
sceneAnimations: ?((props: NavigationSceneRendererProps) => Object),
navigationBarAnimations: ?((props: NavigationSceneRendererProps) => Object),
gestures: ?((props: NavigationSceneRendererProps) => Object),
};
export type ExNavigationState = {
key: string,
params: Object,
config: ExNavigationConfig,
};
export type ExNavigationBarConfig = {
visible?: boolean,
styles?: ExNavigationStyles,
title?: string | Function,
tintColor?: string,
backgroundColor?: string,
height?: number,
translucent?: bool,
renderLeft?: (state: ExNavigationState, props: NavigationSceneRendererProps) => ?React.Element<{}>,
renderTitle?: (state: ExNavigationState, props: NavigationSceneRendererProps) => ?React.Element<{}>,
renderRight?: (state: ExNavigationState, props: NavigationSceneRendererProps) => ?React.Element<{}>,
};
export type ExNavigationDrawerConfig = {
open?: boolean,
};
export type ExNavigationConfig = {
styles?: ExNavigationStyles,
navigationBar?: ExNavigationBarConfig,
eventEmitter?: EventEmitter,
};
export type StackNavigationPropTypes = {
id: string,
initialRoute: ExNavigationRoute,
defaultRouteConfig?: ExNavigationConfig,
renderOverlay?: (props: NavigationSceneRendererProps) => ?React.Element<{}>,
};