-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathUsageWithOverflow.tsx
49 lines (46 loc) · 1.4 KB
/
UsageWithOverflow.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
import * as React from 'react';
import { MaterialIcons } from '@expo/vector-icons';
import { Text } from 'react-native';
import {
HeaderButtons,
Item,
HiddenItem,
OverflowMenu,
defaultOnOverflowMenuPress,
} from 'react-navigation-header-buttons';
import type { ScreenProps } from '../NavTypes';
import { MaterialHeaderButton } from '../components/MaterialHeaderButton';
import { ScreenBody } from '../components/ScreenBody';
const RightHeader = () => (
<HeaderButtons HeaderButtonComponent={MaterialHeaderButton}>
<Item title="person" iconName="person" onPress={() => alert('person')} />
<Item title="edit" onPress={() => alert('edit')} />
<OverflowMenu
OverflowIcon={<MaterialIcons name="more-vert" size={23} color="blue" />}
pressColor="blue"
onPress={(params) => {
defaultOnOverflowMenuPress({
...params,
cancelButtonLabel: 'cancel - custom iOS label!',
});
}}
>
<HiddenItem title="hidden" onPress={() => alert('hidden shortcut')} />
</OverflowMenu>
</HeaderButtons>
);
export function UsageWithOverflow({
navigation,
}: ScreenProps<'UsageWithOverflow'>) {
React.useLayoutEffect(() => {
navigation.setOptions({
headerRight: RightHeader,
// title: '',
});
}, [navigation]);
return (
<ScreenBody>
<Text>default overflow menu handler with custom cancel label</Text>
</ScreenBody>
);
}