@@ -66,16 +66,16 @@ const Calendar = (props: CalendarProps) => {
66
66
render
67
67
) : (
68
68
< View style = { [ styles . header , { backgroundColor : color } ] } >
69
- < TouchableOpacity onPress = { ( ) => onPressBarLeft && onPressBarLeft ( ) } >
69
+ < TouchableOpacity style = { styles . headerBtnWrap } onPress = { ( ) => onPressBarLeft && onPressBarLeft ( ) } >
70
70
< View style = { styles . headerBtn } >
71
71
< Icon name = "left" size = { 20 } color = { '#fff' } />
72
72
< Text style = { styles . headerText } > { barRightText } </ Text >
73
73
</ View >
74
74
</ TouchableOpacity >
75
- < View >
75
+ < View style = { styles . headerTextWrap } >
76
76
< Text style = { styles . headerText } > { title } </ Text >
77
77
</ View >
78
- < TouchableOpacity onPress = { ( ) => goToday ( ) } >
78
+ < TouchableOpacity style = { styles . headerTextTouch } onPress = { ( ) => goToday ( ) } >
79
79
< Text style = { styles . headerText } > { barLeftText } </ Text >
80
80
</ TouchableOpacity >
81
81
</ View >
@@ -125,40 +125,42 @@ const Calendar = (props: CalendarProps) => {
125
125
key = { index }
126
126
style = {
127
127
lunarAll . type === 1
128
- ? styles . otherMonth
128
+ ? [ styles . dateBase , styles . otherMonth ]
129
129
: lunarAll . type === 2
130
- ? [ styles . currentMonth , { backgroundColor : color } ]
130
+ ? [ styles . currentMonth , styles . dateBase , { backgroundColor : color } ]
131
131
: lunarAll . type === 3
132
- ? [ styles . selectMonth , { borderColor : color } ]
133
- : styles . day
132
+ ? [ styles . selectMonth , styles . dateBase , { borderColor : color } ]
133
+ : styles . dateBase
134
134
}
135
135
onPress = { ( ) => goSelectDay ( day ) }
136
136
>
137
- < Text
138
- style = { [
139
- styles . dayText ,
140
- {
141
- color : lunarAll . type === 1 ? '#B5B5B5' : lunarAll . type === 2 ? '#fff' : '#000' ,
142
- lineHeight : lineHeight ,
143
- paddingTop : paddingTop ,
144
- } ,
145
- ] }
146
- >
147
- { day . monthDays }
148
- </ Text >
149
- { lunarHoliday === true && (
137
+ < View >
150
138
< Text
151
139
style = { [
152
140
styles . dayText ,
153
141
{
154
- color : lunarAll . type === 1 ? '#B5B5B5' : lunarAll . type === 2 ? '#fff' : colorType ,
155
- fontSize : 13 ,
142
+ color : lunarAll . type === 1 ? '#B5B5B5' : lunarAll . type === 2 ? '#fff' : '#000' ,
143
+ lineHeight : lineHeight ,
144
+ paddingTop : paddingTop ,
156
145
} ,
157
146
] }
158
147
>
159
- { nameLen > 3 ? < Ellipsis maxLen = { 2 } > { day . lunarHolidays } </ Ellipsis > : day . lunarHolidays || day . lunar }
148
+ { day . monthDays }
160
149
</ Text >
161
- ) }
150
+ { lunarHoliday === true && (
151
+ < Text
152
+ style = { [
153
+ styles . dayText ,
154
+ {
155
+ color : lunarAll . type === 1 ? '#B5B5B5' : lunarAll . type === 2 ? '#fff' : colorType ,
156
+ fontSize : 13 ,
157
+ } ,
158
+ ] }
159
+ >
160
+ { nameLen > 3 ? < Ellipsis maxLen = { 2 } > { day . lunarHolidays } </ Ellipsis > : day . lunarHolidays || day . lunar }
161
+ </ Text >
162
+ ) }
163
+ </ View >
162
164
</ TouchableOpacity >
163
165
) ;
164
166
} ) ;
@@ -249,16 +251,29 @@ const Calendar = (props: CalendarProps) => {
249
251
const styles = StyleSheet . create ( {
250
252
header : {
251
253
flex : 1 ,
254
+ display : 'flex' ,
252
255
backgroundColor : '#329BCB' ,
253
256
flexDirection : 'row' ,
254
257
padding : 10 ,
255
258
alignItems : 'center' ,
256
259
justifyContent : 'space-between' ,
257
260
} ,
261
+ headerBtnWrap : {
262
+ flex : 1 ,
263
+ } ,
258
264
headerBtn : {
259
265
flexDirection : 'row' ,
260
266
alignItems : 'center' ,
261
- width : 50 ,
267
+ // width: 50,
268
+ } ,
269
+ headerTextWrap : {
270
+ flex : 1 ,
271
+ alignItems : 'center' ,
272
+ } ,
273
+ headerTextTouch : {
274
+ flex : 1 ,
275
+ display : 'flex' ,
276
+ flexDirection : 'row-reverse' ,
262
277
} ,
263
278
headerText : {
264
279
fontSize : 20 ,
@@ -299,31 +314,28 @@ const styles = StyleSheet.create({
299
314
flexDirection : 'row' ,
300
315
paddingHorizontal : 2 ,
301
316
} ,
302
- currentMonth : {
303
- backgroundColor : '#329BCB' ,
304
- borderRadius : 50 ,
317
+ dateBase : {
305
318
marginHorizontal : 2 ,
306
319
width : MainWidth / 7 - 4.5 ,
307
320
height : MainWidth / 7 - 4.5 ,
321
+ ...Platform . select ( {
322
+ ios : { } ,
323
+ android : {
324
+ justifyContent : 'center' ,
325
+ } ,
326
+ } ) ,
327
+ } ,
328
+ currentMonth : {
329
+ backgroundColor : '#329BCB' ,
330
+ borderRadius : 50 ,
308
331
} ,
309
332
selectMonth : {
310
333
borderWidth : 1 ,
311
334
borderColor : '#329BCB' ,
312
335
borderRadius : 50 ,
313
- marginHorizontal : 2 ,
314
- width : MainWidth / 7 - 4.5 ,
315
- height : MainWidth / 7 - 4.5 ,
316
336
} ,
317
337
otherMonth : {
318
338
borderRadius : 50 ,
319
- marginHorizontal : 2 ,
320
- width : MainWidth / 7 - 4.5 ,
321
- height : MainWidth / 7 - 4.5 ,
322
- } ,
323
- day : {
324
- marginHorizontal : 2 ,
325
- width : MainWidth / 7 - 4.5 ,
326
- height : MainWidth / 7 - 4.5 ,
327
339
} ,
328
340
dayText : {
329
341
textAlign : 'center' ,
0 commit comments