-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathTabScreenWithButtons.tsx
52 lines (50 loc) · 1.38 KB
/
TabScreenWithButtons.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React from 'react';
import {
Divider,
HeaderButtons,
HiddenItem,
Item,
OverflowMenu,
} from 'react-navigation-header-buttons';
import { MaterialHeaderButton } from '../components/MaterialHeaderButton';
import { ScreenBody } from '../components/ScreenBody';
import { Text } from 'react-native';
import { MaterialIcons } from '@expo/vector-icons';
export type TabScreenWithButtonsProps = any;
export const TabScreenWithButtons = ({
navigation,
}: TabScreenWithButtonsProps) => {
React.useLayoutEffect(() => {
navigation.setOptions({
title: 'Buttons in tab bar',
headerRight: () => (
<HeaderButtons
HeaderButtonComponent={MaterialHeaderButton}
preset={'tabHeader'}
>
<Item
title="search"
iconName="search"
onPress={() => alert('search')}
/>
<OverflowMenu
OverflowIcon={({ color }) => (
<MaterialIcons name="more-horiz" size={23} color={color} />
)}
// preset={'tabHeader'}
>
<HiddenItem title="hidden1" onPress={() => alert('hidden1')} />
<Divider />
</OverflowMenu>
</HeaderButtons>
),
});
}, [navigation]);
return (
<ScreenBody>
<Text>
dummy screen in tab bar, with header managed by the tab navigator
</Text>
</ScreenBody>
);
};