Skip to content

Commit 373c2c1

Browse files
authored
shadows in dark mode (wix#2242)
* shadows in dark mode * Fixed review notes
1 parent 76fa3a5 commit 373c2c1

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/style/shadows.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,57 @@ import {ShadowStyleIOS} from 'react-native';
22
import _ from 'lodash';
33
import Colors from './colors';
44

5-
type Shadow = {top?: ShadowStyleIOS, bottom?: ShadowStyleIOS} & ShadowStyleIOS;
5+
type Shadow = {top?: ShadowStyleIOS; bottom?: ShadowStyleIOS} & ShadowStyleIOS;
6+
7+
const isDark = Colors.getScheme() === 'dark';
68

79
const Shadows = {
810
sh10: {
911
top: {
10-
shadowColor: Colors.grey40,
12+
shadowColor: isDark ? 'transparent' : Colors.grey40,
1113
shadowOpacity: 0.18,
1214
shadowRadius: 5,
1315
shadowOffset: {height: -1, width: 0},
14-
elevation: 2
16+
elevation: isDark ? 0 : 2
1517
},
1618
bottom: {
17-
shadowColor: Colors.grey40,
19+
shadowColor: isDark ? 'transparent' : Colors.grey40,
1820
shadowOpacity: 0.18,
1921
shadowRadius: 5,
2022
shadowOffset: {height: 1, width: 0},
21-
elevation: 2
23+
elevation: isDark ? 0 : 2
2224
}
2325
},
2426
sh20: {
2527
top: {
26-
shadowColor: Colors.grey30,
28+
shadowColor: isDark ? 'transparent' : Colors.grey30,
2729
shadowOpacity: 0.2,
2830
shadowRadius: 10,
2931
shadowOffset: {height: -2, width: 0},
30-
elevation: 3
32+
elevation: isDark ? 0 : 3
3133
},
3234
bottom: {
33-
shadowColor: Colors.grey30,
35+
shadowColor: isDark ? 'transparent' : Colors.grey30,
3436
shadowOpacity: 0.2,
3537
shadowRadius: 10,
3638
shadowOffset: {height: 2, width: 0},
37-
elevation: 3
39+
elevation: isDark ? 0 : 3
3840
}
3941
},
4042
sh30: {
4143
top: {
42-
shadowColor: Colors.grey30,
44+
shadowColor: isDark ? 'transparent' : Colors.grey30,
4345
shadowOpacity: 0.2,
4446
shadowRadius: 12,
4547
shadowOffset: {height: -5, width: 0},
46-
elevation: 4
48+
elevation: isDark ? 0 : 4
4749
},
4850
bottom: {
49-
shadowColor: Colors.grey30,
51+
shadowColor: isDark ? 'transparent' : Colors.grey30,
5052
shadowOpacity: 0.2,
5153
shadowRadius: 12,
5254
shadowOffset: {height: 5, width: 0},
53-
elevation: 4
55+
elevation: isDark ? 0 : 4
5456
}
5557
},
5658
/* Old Presets */

0 commit comments

Comments
 (0)