-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPaperStyle.js
More file actions
38 lines (35 loc) · 720 Bytes
/
PaperStyle.js
File metadata and controls
38 lines (35 loc) · 720 Bytes
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
import { Platform } from 'react-native';
const shadowMap = [{
opacity: 0.12,
blur: 6,
}, {
opacity: 0.16,
blur: 10,
}, {
opacity: 0.19,
blur: 30,
}, {
opacity: 0.25,
blur: 45,
}, {
opacity: 0.30,
blur: 60,
}];
function createPaperStyle(_paper = 1) {
const paper = Math.round(_paper);
return Platform.select({
android: {
elevation: paper,
},
ios: {
shadowColor: 'black',
shadowOffset: { width: 0, height: 0 },
shadowRadius: shadowMap[paper].blur,
shadowOpacity: shadowMap[paper].opacity,
},
web: {
boxShadow: `rgba(0, 0, 0, ${shadowMap[paper].opacity}) 0px 0px ${shadowMap[paper].blur}px`,
},
});
}
export default createPaperStyle;