Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions scripts/rn/copy-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,20 @@ const copyFile = async (from, to, success, isSingle = false) => {
'griditem',
'hoverbuttonitem',
'avatargroup',
'icon',
].includes(item)
) {
modify(
`${targetBaseUrl}/packages/${item}/demo.taro.tsx`,
`import '../../../styles/demo.scss';\n`
)
}
modify(
`${targetBaseUrl}/packages/${item}/${item}.taro.tsx`,
`import "./${item}.harmony.css";\n`
)
if (!['icon'].includes(item)) {
modify(
`${targetBaseUrl}/packages/${item}/${item}.taro.tsx`,
`import "./${item}.harmony.css";\n`
)
}
}
})
})
Expand Down
39 changes: 8 additions & 31 deletions src/packages/countdown/countdown.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, {
import { View } from '@tarojs/components'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import { padZero } from '@/utils/pad-zero'
import { harmonyAndRn, web } from '@/utils/platform-taro'
import { web } from '@/utils/platform-taro'

export interface CountDownTimeProps {
d: number
Expand Down Expand Up @@ -201,12 +201,6 @@ const InternalCountDown: ForwardRefRenderFunction<
formatCache = formatCache.replace('SS', msC.slice(0, 1))
}
}
formatCache = formatCache.replace(
/(\d+)/g,
type === 'primary'
? `<View class="nut-countdown-number-primary">$1</View>`
: `<View class="nut-countdown-number">$1</View>`
)

return formatCache
}
Expand Down Expand Up @@ -293,10 +287,6 @@ const InternalCountDown: ForwardRefRenderFunction<
destroy && cancelAnimationFrame(stateRef.current.timer)
}

const renderTime = (() => {
return formatRemainTime(stateRef.current.restTime)
})()

const getUnit = (unit: string) => {
const formatArr = format.split(/(DD|HH|mm|ss|S)/)
const index = formatArr.indexOf(unit)
Expand Down Expand Up @@ -356,26 +346,13 @@ const InternalCountDown: ForwardRefRenderFunction<
return (
<>
{children || (
<>
{!harmonyAndRn() ? (
<View
className={`${classPrefix} ${className}`}
style={{ ...style }}
{...rest}
dangerouslySetInnerHTML={{
__html: `${renderTime}`,
}}
/>
) : (
<View
className={`${classPrefix} ${className}`}
style={{ ...style }}
{...rest}
>
{renderTaroTime()}
</View>
)}
</>
<View
className={`${classPrefix} ${className}`}
style={{ ...style }}
{...rest}
>
{renderTaroTime()}
</View>
)}
</>
)
Expand Down