Skip to content

Commit

Permalink
fix: virtualInput icon
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Jun 12, 2024
1 parent 92cb960 commit cefc14a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/virtual-input/virtual-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React, {
} from 'react'
import { NativeProps, withNativeProps } from '../../utils/native-props'
import { usePropsValue } from '../../utils/use-props-value'
import { mergeProps } from '../../utils/with-default-props'
import { mergeProp, mergeProps } from '../../utils/with-default-props'
import { useConfig } from '../config-provider'
import type { InputProps } from '../input'
import { NumberKeyboardProps } from '../number-keyboard'
Expand Down Expand Up @@ -41,7 +41,6 @@ export type VirtualInputProps = {

const defaultProps = {
defaultValue: '',
clearIcon: <CloseCircleFill />,
}

export type VirtualInputRef = {
Expand All @@ -58,6 +57,12 @@ export const VirtualInput = forwardRef<VirtualInputRef, VirtualInputProps>(
const contentRef = useRef<HTMLDivElement>(null)
const [hasFocus, setHasFocus] = useState(false)

const clearIcon = mergeProp(
<CloseCircleFill />,
componentConfig.clearIcon,
props.clearIcon
)

function scrollToEnd() {
const root = rootRef.current
if (!root) return
Expand Down Expand Up @@ -161,7 +166,7 @@ export const VirtualInput = forwardRef<VirtualInputRef, VirtualInputProps>(
role='button'
aria-label={locale.Input.clear}
>
{mergedProps.clearIcon}
{clearIcon}
</div>
)}
{[undefined, null, ''].includes(value) && (
Expand Down

0 comments on commit cefc14a

Please sign in to comment.