/* @flow */ import * as React from 'react'; import { View, Platform, StyleSheet } from 'react-native'; import { Colors, Switch, Paragraph, Toolbar, ToolbarContent, ToolbarAction, ToolbarBackAction, withTheme, } from 'react-native-paper'; import type { Theme } from 'react-native-paper/types'; type Props = { navigation: any, theme: Theme, }; const initialParams = { showLeftIcon: true, showSubtitle: true, showSearchIcon: true, showMoreIcon: true, }; const MORE_ICON = Platform.OS === 'ios' ? 'more-horiz' : 'more-vert'; class ToolbarExample extends React.Component { static title = 'Toolbar'; static navigationOptions = ({ navigation }) => { const params = { ...initialParams, ...navigation.state.params }; return { header: ( {params.showLeftIcon && ( navigation.goBack()} /> )} {params.showSearchIcon && ( {}} /> )} {params.showMoreIcon && ( {}} /> )} ), }; }; render() { const { navigation, theme: { colors: { background } } } = this.props; const params = { ...initialParams, ...navigation.state.params }; return ( Left icon navigation.setParams({ showLeftIcon: value, }) } /> Subtitle navigation.setParams({ showSubtitle: value, }) } /> Search icon navigation.setParams({ showSearchIcon: value, }) } /> More icon navigation.setParams({ showMoreIcon: value, }) } /> ); } } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: Colors.white, paddingVertical: 8, }, row: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingVertical: 8, paddingHorizontal: 16, }, }); export default withTheme(ToolbarExample);