/* @flow */ import React from 'react'; import { StackNavigator } from 'react-navigation'; import { Platform, StatusBar } from 'react-native'; import { Toolbar } from 'react-native-paper'; import ExampleList, { examples } from './ExampleList'; const MORE_ICON = Platform.OS === 'ios' ? 'more-horiz' : 'more-vert'; const routes = Object.keys(examples) .map(id => ({ id, item: examples[id] })) .reduce((acc, { id, item }) => { const Comp = item; const Screen = props => ; Screen.navigationOptions = ({ navigation }) => { const { params = {} } = navigation.state; return { header: ( {!params.showLeftIcon && ( navigation.goBack()} /> )} {params.showSearchIcon && ( {}} /> )} {!params.showMoreIcon && ( {}} /> )} ), /* $FlowFixMe */ ...Comp.navigationOptions, }; }; return { ...acc, [id]: { screen: Screen }, }; }, {}); export default StackNavigator( { home: { screen: ExampleList }, ...routes, }, { navigationOptions: { header: ( ), }, } );