-
Notifications
You must be signed in to change notification settings - Fork 9
/
Nuclein.js
138 lines (131 loc) · 3.28 KB
/
Nuclein.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// 核酸检测
import React, { useEffect, useState } from 'react';
import {
Dimensions,
StyleSheet,
Text,
View,
Image,
ScrollView,
TouchableOpacity,
TouchableWithoutFeedback
} from 'react-native';
import moment from 'moment';
import LinearGradient from 'react-native-linear-gradient';
const Nuclein = props => {
const colors = {
'48': ['#b191f5', '#8660db'],
'72': ['#52dabf', '#08b898'],
}
const isReact3Day = colors.hasOwnProperty(props.duration)
const createContainer = () => {
// 近48小时 和 近72小时
// 更早的时间
return isReact3Day ? <View style={styles.viewRecent}>
<Text style={styles.textRecentTime}>{props.duration}</Text>
<View style={{width: 2}} />
<View style={styles.viewRecentRight}>
<Text style={styles.textRecentRight}>小时</Text>
<Text style={styles.textRecentRight}>阴性</Text>
</View>
</View> : <View>
<Text style={styles.textMessage}>阴性</Text>
</View>
}
return (
<TouchableOpacity
style={styles.all}
onLongPress={() => {
props.onItemLongPress()
}}
onPress={() => {
props.onItemPress()
}}
>
<LinearGradient style={styles.viewLinear} colors={colors[props.duration] || ['#ffffff', '#ffffff']}>
<View style={styles.viewTitle}>
<Image source={require('./images/item_ok.png')} style={[styles.imageImage, { tintColor: isReact3Day ? 'white' : '#3db36e' }]} />
<View style={{ width: 4 }} />
<Text style={[styles.textTitle, { color: isReact3Day ? 'white' : 'black' }]}>核酸检测</Text>
<View style={{ width: 4 }} />
<Image
source={require('./images/item_more.png')}
style={[styles.imageMore, { tintColor: isReact3Day ? 'white' : 'grey' }]}
/>
</View>
{createContainer()}
<Text style={[styles.textTime, { color: isReact3Day ? 'white' : 'grey' }]}>{props.time}</Text>
</LinearGradient>
</TouchableOpacity>
);
};
const styles = StyleSheet.create({
viewLinear: {
paddingVertical: 12,
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'space-between',
borderRadius: 4,
height: 138,
width: Dimensions.get('screen').width / 2 - 32,
},
all: {
height: 144,
width: Dimensions.get('screen').width / 2 - 26,
backgroundColor: 'white',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
borderRadius: 4
},
viewRecent: {
flexDirection: 'row',
display: 'flex',
alignItems: 'center'
},
textRecentTime: {
fontSize: 56,
color: 'white',
},
viewRecentRight: {
flexDirection: 'column',
justifyContent: 'space-between',
display: 'flex',
height: 48
},
textRecentRight: {
fontSize: 20,
color: 'white',
fontWeight: '500',
textAlign: 'justify'
},
viewMore: {
},
textTitle: {
fontSize: 18,
color: 'black',
},
viewTitle: {
flexDirection: 'row',
alignItems: 'center',
display: 'flex',
},
imageImage: {
height: 22,
width: 22,
},
imageMore: {
height: 14,
width: 14,
},
textMessage: {
fontSize: 22,
fontWeight: '400',
color: '#3db36e'
},
textTime: {
fontSize: 16,
color: 'grey',
},
});
export default Nuclein;