-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathcalendar-input-bar.react.js
54 lines (49 loc) · 1.27 KB
/
calendar-input-bar.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
// @flow
import * as React from 'react';
import { Text } from 'react-native';
import { FadeIn, FadeOut } from 'react-native-reanimated';
import Button from '../components/button.react.js';
import { useStyles } from '../themes/colors.js';
import { AnimatedView } from '../types/styles.js';
type Props = {
+onSave: () => void,
+disabled: boolean,
};
function CalendarInputBar(props: Props): React.Node {
const styles = useStyles(unboundStyles);
const inactiveStyle = props.disabled ? styles.inactiveContainer : undefined;
const style = React.useMemo(
() => [styles.container, inactiveStyle],
[styles.container, inactiveStyle],
);
return (
<AnimatedView
style={style}
pointerEvents={props.disabled ? 'none' : 'auto'}
entering={FadeIn}
exiting={FadeOut}
>
<Button onPress={props.onSave} iosActiveOpacity={0.5}>
<Text style={styles.saveButtonText}>Save</Text>
</Button>
</AnimatedView>
);
}
const unboundStyles = {
container: {
alignItems: 'flex-end',
backgroundColor: 'listInputBar',
},
inactiveContainer: {
opacity: 0,
height: 0,
},
saveButtonText: {
color: 'link',
fontSize: 16,
fontWeight: 'bold',
marginRight: 5,
padding: 8,
},
};
export default CalendarInputBar;