Skip to content

Commit 27a5fd0

Browse files
committed
Merge branch 'feat/v3.2' into next
2 parents 539a6f7 + 37fc4d4 commit 27a5fd0

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

packages/taro-ui/rn/components/countdown/index.tsx

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,12 @@ export default class AtCountdown extends React.Component<
6464

6565
if (this.seconds > 0) {
6666
day = this.props.isShowDay ? Math.floor(this.seconds / (60 * 60 * 24)) : 0
67-
hours = Math.floor(this.seconds / (60 * 60)) - day * 24
68-
minutes = Math.floor(this.seconds / 60) - day * 24 * 60 - hours * 60
67+
hours = this.props.isShowHour
68+
? Math.floor(this.seconds / (60 * 60)) - day * 24
69+
: 0
70+
minutes = this.props.isShowMinute
71+
? Math.floor(this.seconds / 60) - day * 24 * 60 - hours * 60
72+
: 0
6973
seconds =
7074
Math.floor(this.seconds) -
7175
day * 24 * 60 * 60 -
@@ -134,7 +138,8 @@ export default class AtCountdown extends React.Component<
134138
format,
135139
isShowDay,
136140
isCard,
137-
isShowHour
141+
isShowHour,
142+
isShowMinute
138143
} = this.props
139144
const { _day, _hours, _minutes, _seconds } = this.state
140145

@@ -150,25 +155,15 @@ export default class AtCountdown extends React.Component<
150155
style={customStyle}
151156
>
152157
{isShowDay && (
153-
<AtCountdownItem isCard={isCard} num={_day} separator={format!.day} />
158+
<AtCountdownItem num={_day} separator={format?.day || '天'} />
154159
)}
155160
{isShowHour && (
156-
<AtCountdownItem
157-
isCard={isCard}
158-
num={_hours}
159-
separator={format!.hours}
160-
/>
161+
<AtCountdownItem num={_hours} separator={format?.hours || ''} />
161162
)}
162-
<AtCountdownItem
163-
isCard={isCard}
164-
num={_minutes}
165-
separator={format!.minutes}
166-
/>
167-
<AtCountdownItem
168-
isCard={isCard}
169-
num={_seconds}
170-
separator={format!.seconds}
171-
/>
163+
{isShowMinute && (
164+
<AtCountdownItem num={_minutes} separator={format?.minutes || ''} />
165+
)}
166+
<AtCountdownItem num={_seconds} separator={format?.seconds || ''} />
172167
</View>
173168
)
174169
}
@@ -180,6 +175,7 @@ AtCountdown.defaultProps = {
180175
isCard: false,
181176
isShowDay: false,
182177
isShowHour: true,
178+
isShowMinute: true,
183179
format: {
184180
day: '天',
185181
hours: '时',
@@ -198,6 +194,7 @@ AtCountdown.propTypes = {
198194
isCard: PropTypes.bool,
199195
isShowDay: PropTypes.bool,
200196
isShowHour: PropTypes.bool,
197+
isShowMinute: PropTypes.bool,
201198
format: PropTypes.object,
202199
day: PropTypes.number,
203200
hours: PropTypes.number,

packages/taro-ui/src/components/noticebar/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default class AtNoticebar extends React.Component<
2525
animationData: {
2626
actions: [{}]
2727
},
28-
dura: 15,
28+
dura: 0,
2929
isWEAPP: Taro.getEnv() === Taro.ENV_TYPE.WEAPP,
3030
isALIPAY: Taro.getEnv() === Taro.ENV_TYPE.ALIPAY,
3131
isWEB: Taro.getEnv() === Taro.ENV_TYPE.WEB
@@ -135,8 +135,13 @@ export default class AtNoticebar extends React.Component<
135135
const innerClassName = ['at-noticebar__content-inner']
136136
if (marquee) {
137137
close = false
138-
style['animation-duration'] = `${dura}s`
139138
innerClassName.push(animElemId)
139+
style['animation-delay'] = '3s'
140+
141+
if (dura > 0) {
142+
style['animation-duration'] = `${dura}s`
143+
style['animation-delay'] = '1s'
144+
}
140145
}
141146

142147
const classObject = {

0 commit comments

Comments
 (0)