Skip to content

Commit

Permalink
fix(search-bar): fix react wraning and inputRef (#1793)
Browse files Browse the repository at this point in the history
Co-authored-by: maxin <maxin@growingio.com>
  • Loading branch information
nnmax and maxin committed Jan 12, 2022
1 parent 1fc7c1c commit ba1a1a3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/search-bar/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { usePrefixCls } from '@gio-design/utils';
import classNames from 'classnames';
import React, { useCallback, useMemo, useState, useEffect, useRef } from 'react';
import Input from '../input/Input';
import { composeRef } from '../utils/composeRef';
import { SearchBarProps } from './interface';

const SearchBar = React.forwardRef<HTMLInputElement, SearchBarProps>((props, ref) => {
Expand All @@ -14,6 +15,8 @@ const SearchBar = React.forwardRef<HTMLInputElement, SearchBarProps>((props, ref
placeholder,
onSearch,
className,
inputRef: inputRefProp,
...otherProps
} = props;

const prefixCls = usePrefixCls('search', customizePrefixCls);
Expand Down Expand Up @@ -74,15 +77,16 @@ const SearchBar = React.forwardRef<HTMLInputElement, SearchBarProps>((props, ref
return (
<Input
data-testid="search-bar"
{...props}
className={classNames(className, prefixCls)}
type="text"
placeholder={placeholder}
value={value}
onChange={onChange}
suffix={suffix}
ref={ref}
inputRef={inputRef}
inputRef={inputRefProp ? composeRef(inputRef, inputRefProp) : inputRef}
disabled={disabled}
{...otherProps}
/>
);
});
Expand Down

1 comment on commit ba1a1a3

@vercel
Copy link

@vercel vercel bot commented on ba1a1a3 Jan 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.