Skip to content

Commit

Permalink
fix: review
Browse files Browse the repository at this point in the history
  • Loading branch information
oasis-cloud committed Nov 20, 2024
1 parent 05c2769 commit ddf58c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
11 changes: 1 addition & 10 deletions src/packages/pagination/pagination.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { View } from '@tarojs/components'
import { useConfig } from '@/packages/configprovider/index.taro'
import { usePropsValue } from '@/utils/use-props-value'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import { harmony } from '@/utils/platform-taro'
import addColorForHarmony from '@/utils/add-color-for-harmony'

export interface PaginationProps extends BasicComponent {
defaultValue: number
Expand Down Expand Up @@ -106,15 +106,6 @@ export const Pagination: FunctionComponent<
setCurrentPage(curPage)
}

function addColorForHarmony(maybeElement: ReactNode, color: string) {
if (React.isValidElement(maybeElement) && harmony()) {
return React.cloneElement<any>(maybeElement, {
color,
})
}
return maybeElement
}

return (
<View className={classNames(classPrefix, className)} style={style}>
{(mode === 'multi' || mode === 'simple') && (
Expand Down
13 changes: 13 additions & 0 deletions src/utils/add-color-for-harmony.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React, { ReactNode } from 'react'
import { harmony } from './platform-taro'

function addColorForHarmony(maybeElement: ReactNode, color: string) {
if (React.isValidElement(maybeElement) && harmony()) {
return React.cloneElement<any>(maybeElement, {
color,
})
}
return maybeElement
}

export default addColorForHarmony

0 comments on commit ddf58c1

Please sign in to comment.