-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathcalendar.react.js
85 lines (75 loc) · 2.15 KB
/
calendar.react.js
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
78
79
80
81
82
83
84
85
// @flow
import type {
StackNavigationProp,
StackNavigationHelpers,
} from '@react-navigation/core';
import { createStackNavigator } from '@react-navigation/stack';
import * as React from 'react';
import { View } from 'react-native';
import CalendarScreen from './calendar-screen.react.js';
import KeyboardAvoidingView from '../components/keyboard-avoiding-view.react.js';
import CommunityDrawerButton from '../navigation/community-drawer-button.react.js';
import {
CalendarScreenRouteName,
type CalendarParamList,
type ScreenParamList,
} from '../navigation/route-names.js';
import type { TabNavigationProp } from '../navigation/tab-navigator.react.js';
import { useStyles, useColors } from '../themes/colors.js';
export type CalendarNavigationProp<
RouteName: $Keys<CalendarParamList> = $Keys<CalendarParamList>,
> = StackNavigationProp<ScreenParamList, RouteName>;
const Calendar = createStackNavigator<
ScreenParamList,
CalendarParamList,
StackNavigationHelpers<ScreenParamList>,
>();
type Props = {
+navigation: TabNavigationProp<'Calendar'>,
...
};
function CalendarComponent(props: Props): React.Node {
const styles = useStyles(unboundStyles);
const colors = useColors();
const headerLeft = React.useCallback(
() => <CommunityDrawerButton navigation={props.navigation} />,
[props.navigation],
);
const options = React.useMemo(
() => ({
headerTitle: 'Calendar',
headerLeft,
headerStyle: {
backgroundColor: colors.tabBarBackground,
},
headerShadowVisible: false,
}),
[colors.tabBarBackground, headerLeft],
);
return (
<View style={styles.view}>
<KeyboardAvoidingView
behavior="padding"
style={styles.keyboardAvoidingView}
>
<Calendar.Navigator>
<Calendar.Screen
name={CalendarScreenRouteName}
component={CalendarScreen}
options={options}
/>
</Calendar.Navigator>
</KeyboardAvoidingView>
</View>
);
}
const unboundStyles = {
keyboardAvoidingView: {
flex: 1,
},
view: {
flex: 1,
backgroundColor: 'panelBackground',
},
};
export default CalendarComponent;