Skip to content

Commit e3625a6

Browse files
Improve dark modus and follow specs
1 parent 4ac8788 commit e3625a6

File tree

2 files changed

+57
-34
lines changed

2 files changed

+57
-34
lines changed

src/Date/AnimatedCrossView.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react'
22
import { Animated, StyleSheet, View } from 'react-native'
3+
import { useTheme } from 'react-native-paper'
34

45
export default function AnimatedCrossView({
56
visible,
@@ -12,6 +13,7 @@ export default function AnimatedCrossView({
1213
visible: boolean
1314
collapsed: boolean
1415
}) {
16+
const theme = useTheme()
1517
const calendarOpacity = React.useRef<Animated.Value>(
1618
new Animated.Value(collapsed ? 1 : 0)
1719
)
@@ -57,6 +59,7 @@ export default function AnimatedCrossView({
5759
style={[
5860
styles.calendarEdit,
5961
{
62+
backgroundColor: theme.colors.surface,
6063
opacity: calendarOpacity.current.interpolate({
6164
inputRange: [0, 1],
6265
outputRange: [1, 0],
@@ -82,7 +85,7 @@ const styles = StyleSheet.create({
8285
root: { flex: 1, minHeight: 300 },
8386
calendarEdit: {
8487
position: 'absolute',
85-
backgroundColor: '#fff',
88+
8689
left: 0,
8790
right: 0,
8891
},

src/Date/DatePickerModalHeader.tsx

Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
import * as React from 'react'
2-
import { View, StyleSheet, StatusBar, SafeAreaView } from 'react-native'
3-
import { Appbar, Button, IconButton, Text, useTheme } from 'react-native-paper'
2+
import {
3+
View,
4+
StyleSheet,
5+
StatusBar,
6+
Animated,
7+
SafeAreaView,
8+
} from 'react-native'
9+
import {
10+
Appbar,
11+
Button,
12+
IconButton,
13+
overlay,
14+
Text,
15+
useTheme,
16+
} from 'react-native-paper'
417
import { ModeType } from './Calendar'
518
import { LocalState } from './DatePickerModal'
619
import { useMemo } from 'react'
@@ -40,7 +53,7 @@ export default function DatePickerModalHeader(props: HeaderProps) {
4053

4154
const backgroundColor =
4255
theme.dark && theme.mode === 'adaptive'
43-
? theme.colors.surface
56+
? overlay(4, theme.colors.surface)
4457
: theme.colors.primary
4558

4659
return (
@@ -54,43 +67,50 @@ export default function DatePickerModalHeader(props: HeaderProps) {
5467
},
5568
]}
5669
/>
57-
<SafeAreaView
70+
71+
<Animated.View
5872
style={{
5973
backgroundColor,
6074
paddingBottom: 0,
75+
elevation: 4,
6176
}}
6277
>
63-
<Appbar style={[styles.appbarHeader, { backgroundColor }]}>
64-
<Appbar.Action icon="close" onPress={props.onDismiss} />
65-
<Appbar.Content title={''} />
66-
<Button color={'#fff'} onPress={props.onSave}>
67-
{saveLabel}
68-
</Button>
69-
</Appbar>
70-
</SafeAreaView>
71-
<View
72-
style={[
73-
styles.header,
74-
{
75-
backgroundColor,
76-
},
77-
]}
78-
>
79-
<View>
80-
<Text style={styles.label}>{label.toUpperCase()}</Text>
78+
<SafeAreaView
79+
style={{
80+
paddingBottom: 0,
81+
}}
82+
>
83+
<Appbar
84+
style={[
85+
styles.appbarHeader,
86+
{ backgroundColor: backgroundColor.toString() },
87+
]}
88+
>
89+
<Appbar.Action icon="close" onPress={props.onDismiss} />
90+
<Appbar.Content title={''} />
91+
<Button color={'#fff'} onPress={props.onSave}>
92+
{saveLabel}
93+
</Button>
94+
</Appbar>
95+
96+
<View style={[styles.header]}>
97+
<View>
98+
<Text style={styles.label}>{label.toUpperCase()}</Text>
8199

82-
<View style={styles.headerContentContainer}>
83-
{mode === 'range' ? <HeaderContentRange {...props} /> : null}
84-
{mode === 'single' ? <HeaderContentSingle {...props} /> : null}
100+
<View style={styles.headerContentContainer}>
101+
{mode === 'range' ? <HeaderContentRange {...props} /> : null}
102+
{mode === 'single' ? <HeaderContentSingle {...props} /> : null}
103+
</View>
104+
</View>
105+
<View style={styles.fill} />
106+
<IconButton
107+
icon={collapsed ? 'pencil' : 'calendar'}
108+
color={'#fff'}
109+
onPress={onToggle}
110+
/>
85111
</View>
86-
</View>
87-
<View style={styles.fill} />
88-
<IconButton
89-
icon={collapsed ? 'pencil' : 'calendar'}
90-
color={'#fff'}
91-
onPress={onToggle}
92-
/>
93-
</View>
112+
</SafeAreaView>
113+
</Animated.View>
94114
</>
95115
)
96116
}

0 commit comments

Comments
 (0)