-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappbar
More file actions
77 lines (70 loc) · 2.55 KB
/
appbar
File metadata and controls
77 lines (70 loc) · 2.55 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import * as React from 'react';
import { View, Platform, StyleSheet } from 'react-native';
import { Appbar, FAB, Switch, Paragraph, Text, useTheme, RadioButton, List } from 'react-native-paper';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
const MORE_ICON = Platform.OS === 'ios' ? 'dots-horizontal' : 'dots-vertical';
const MEDIUM_FAB_HEIGHT = 56;
const AppbarExample = ({ navigation }) => {
const [showLeftIcon, setShowLeftIcon] = React.useState(true);
const [showSubtitle, setShowSubtitle] = React.useState(true);
const [showSearchIcon, setShowSearchIcon] = React.useState(true);
const [showMoreIcon, setShowMoreIcon] = React.useState(true);
const [showCustomColor, setShowCustomColor] = React.useState(false);
const [showExactTheme, setShowExactTheme] = React.useState(false);
const [appbarMode, setAppbarMode] = React.useState('small');
const [showCalendarIcon, setShowCalendarIcon] = React.useState(false);
const [showElevated, setShowElevated] = React.useState(false);
const theme = useTheme();
const { bottom, left, right } = useSafeAreaInsets();
const height = theme.isV3 ? 80 : 56;
React.useLayoutEffect(() => {
navigation.setOptions({
header: () => (
<Appbar.Header
style={styles.customColor}
theme={{
mode: showExactTheme ? 'exact' : 'adaptive',
}}
mode="small"
elevated={false}
>
<Appbar.BackAction onPress={() => navigation.goBack()} />
<Appbar.Content title="Title" subtitle="Subtitle" />
<Appbar.Action icon="calendar" onPress={() => {}} />
<Appbar.Action icon="magnify" onPress={() => {}} />
<Appbar.Action icon={MORE_ICON} onPress={() => {}} />
</Appbar.Header>
),
});
}, [navigation]);
return <></>;
};
export default AppbarExample;
const styles = StyleSheet.create({
container: {
marginBottom: 56,
},
contentContainer: {
paddingVertical: 8,
},
row: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
paddingVertical: 8,
paddingHorizontal: 16,
},
bottom: {
position: 'absolute',
left: 0,
right: 0,
bottom: 0,
},
fab: {
position: 'absolute',
right: 16,
},
customColor: {
backgroundColor: '#ffff00',
},
});