@exponent/ex-navigation
Version:
Route-centric navigation library for React Native.
74 lines (64 loc) • 2.19 kB
Flow
/**
* @flow
*/
import React from 'react';
import {
Animated,
} from 'react-native';
import type { EventEmitter } from 'fbemitter';
import type { ExNavigationRoute } from './ExNavigationRouter';
import type {
NavigationSceneRendererProps,
NavigationTransitionProps,
NavigationTransitionSpec,
} from 'NavigationTypeDefinition';
export type ExNavigationStyles = {
applyAnimation: ?((position: Animated.Value, navigationState: Object) => void),
configureTransition: ?((
a: NavigationTransitionProps,
b: ?NavigationTransitionProps,
) => NavigationTransitionSpec),
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,
titleStyle?: Object | number,
tintColor?: string,
backgroundColor?: string | Function,
borderBottomWidth?: number,
elevation?: number,
borderBottomColor?: string,
height?: number,
translucent?: bool,
translucentTint?: 'dark' | 'default' | 'light',
renderLeft?: (state: ExNavigationState, props: NavigationSceneRendererProps) => ?React.Element<{}>,
renderTitle?: (state: ExNavigationState, props: NavigationSceneRendererProps) => ?React.Element<{}>,
renderRight?: (state: ExNavigationState, props: NavigationSceneRendererProps) => ?React.Element<{}>,
renderBackground?: (state: ExNavigationState, props: NavigationSceneRendererProps) => ?React.Element<{}>,
};
export type ExNavigationDrawerConfig = {
open?: boolean,
};
export type ExNavigationConfig = {
styles?: ExNavigationStyles,
transitionOptions?: {
transitionGroup: string,
},
navigationBar?: ExNavigationBarConfig,
eventEmitter?: EventEmitter,
};
export type StackNavigationPropTypes = {
id: string,
initialRoute: ExNavigationRoute,
defaultRouteConfig?: ExNavigationConfig,
renderOverlay?: (props: NavigationSceneRendererProps) => ?React.Element<{}>,
};