-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathUsageDisabled.tsx
42 lines (39 loc) · 1.12 KB
/
UsageDisabled.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
import * as React from 'react';
import { Ionicons } from '@expo/vector-icons';
import {
HeaderButtons,
HeaderButton,
Item,
HeaderButtonsComponentType,
} from 'react-navigation-header-buttons';
import type { ScreenProps } from '../NavTypes';
import { ScreenBody } from '../components/ScreenBody';
const DisableableHeaderButton: HeaderButtonsComponentType = (props) => (
<HeaderButton
{...props}
onPress={props.onPress}
disabled={props.disabled}
buttonStyle={props.disabled ? { color: 'grey' } : undefined}
IconComponent={Ionicons}
iconSize={23}
color="blue"
/>
);
export function UsageDisabled({ navigation }: ScreenProps<'UsageDisabled'>) {
React.useLayoutEffect(() => {
navigation.setOptions({
headerRight: () => (
<HeaderButtons HeaderButtonComponent={DisableableHeaderButton}>
<Item
title="search"
iconName="search"
onPress={() => alert('search')}
disabled
/>
<Item title="select" onPress={() => alert('select')} />
</HeaderButtons>
),
});
}, [navigation]);
return <ScreenBody />;
}