-
Notifications
You must be signed in to change notification settings - Fork 28
/
appDemo.js
169 lines (152 loc) · 4.4 KB
/
appDemo.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import React, { Component, PropTypes } from 'react'
import {
StyleSheet,
TouchableHighlight,
Image,
Text,
View,
} from 'react-native';
import CountDownReact from './CountDownReact'
const appDemo = React.createClass({
render() {
return <View style={{paddingTop:40,}}>
<CountDownReact
//date={new Date(parseInt(seckill.endTime))}
date="2018-11-28T00:00:00+00:00"
days={{plural: 'Days ',singular: 'day '}}
hours=':'
mins=':'
segs=''
daysStyle={styles.time}
hoursStyle={styles.time}
minsStyle={styles.time}
secsStyle={styles.time}
firstColonStyle={styles.colon}
secondColonStyle={styles.colon}
/>
<View style={{
flexDirection: 'row',
alignItems:'baseline',
marginTop:20,
}}>
<Text style={styles.cardItemTimeRemainTxt}>还剩</Text>
<CountDownReact
//date={new Date(parseInt(seckill.endTime))}
date="2017-11-28T00:00:00+00:00"
days={{plural: '天 ',singular: '天 '}}
hours=':'
mins=':'
segs=''
daysStyle={styles.cardItemTimeRemainTxt}
hoursStyle={styles.cardItemTimeRemainTxt}
minsStyle={styles.cardItemTimeRemainTxt}
secsStyle={styles.cardItemTimeRemainTxt}
firstColonStyle={styles.cardItemTimeRemainTxt}
secondColonStyle={styles.cardItemTimeRemainTxt}
/>
</View>
<CountDownReact
//date={new Date(parseInt(seckill.endTime))}
date="2017-11-28T00:00:00+00:00"
days={{plural: 'D ',singular: 'D '}}
hours=':'
mins=':'
segs=''
containerStyle={styles.container}
daysStyle={styles.text}
hoursStyle={styles.text}
minsStyle={styles.text}
secsStyle={styles.text}
firstColonStyle={styles.text}
secondColonStyle={styles.text}
/>
<View style={styles.cardItem}>
<Image source={{uri: 'timg'}}
style={styles.cardItemMainPic} backgroundColor={'#'+Math.floor(Math.random()*16777215).toString(16)}/>
<View style={styles.cardItemMask}>
<View style={styles.cardItemTimer}>
<Image style={styles.cardItemTimerIcon}
source={{uri: 'http://www.qiyipic.com/common/fix/gmjy3/images/groupontimeredicon.png'}}/>
<View style={{
flexDirection: 'row',
alignItems:'baseline'
}}>
<Text style={styles.cardItemTimeRemainTxt}>还剩</Text>
<CountDownReact
//date={new Date(parseInt(seckill.endTime))}
date="2017-10-28T00:00:00+00:00"
days={{plural: '天 ',singular: '天 '}}
hours=':'
mins=':'
segs=''
daysStyle={styles.cardItemTimeRemainTxt}
hoursStyle={styles.cardItemTimeRemainTxt}
minsStyle={styles.cardItemTimeRemainTxt}
secsStyle={styles.cardItemTimeRemainTxt}
firstColonStyle={styles.cardItemTimeRemainTxt}
secondColonStyle={styles.cardItemTimeRemainTxt}
/>
</View>
</View>
</View>
</View>
</View>
}
});
const styles = StyleSheet.create({
cardItemTimeRemainTxt: {
fontSize: 20,
color: '#ee394b'
},
container: {
backgroundColor: '#000',
padding: 5,
borderRadius: 5,
flexDirection: 'row',
marginTop:20
},
text: {
fontSize: 30,
color: '#FFF',
marginLeft: 7,
},
//时间文字
time: {
paddingHorizontal: 3,
backgroundColor: 'rgba(85, 85, 85, 1)',
fontSize: 12,
color: 'white',
marginHorizontal: 3,
borderRadius: 2,
},
//冒号
colon: {
fontSize: 12, color: 'rgba(85, 85, 85, 1)'
},
cardItemMask:{
position: 'absolute',
top: 15,
right:10,
backgroundColor: 'transparent'
},
cardItemTimer:{
flexDirection: 'row',
alignItems: 'center'
},
cardItemTimerIcon: {
width:11,
height: 11,
},
cardItem: {
flexDirection: 'column',
backgroundColor:'red',
marginTop:20,
width: 370,
height: 370 * 0.65625,
},
cardItemMainPic: {
width: 370,
height: 370 * 0.65625,
},
});
export default appDemo