0.7.0 • Published 4 years ago

@dooboo-ui/native-search-input v0.7.0

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

Search Input

Npm Version Downloads

Simple search input for react-native.

Installation

yarn add @dooboo-ui/native

or

yarn add @dooboo-ui/native-search-input

Usage

npm.io

  • debounced input
  • reset button
  • customizable icon

Props

export interface SearchInputProps {
  value: string;
  onDebounceOrOnReset?: (value: string) => void;
  style?: StyleProp<ViewStyle>;
  debounceDelay?: number;
  customIcon?: React.ReactNode;
  placeholderText?: string;
}
necessarytypesdefaultinfo
valuestringundefined
onDebounceOrReset(string) => voidundefined
styleStyleProp<ViewStyle>undefinedcontainer style
debounceDelaynumber400
customIconReact.ReactNodemagnifier icon component
placeholderTextstring검색어를 입력해주세요.

Getting started

  • Import

    import { SearchInput } from '@dooboo-ui/native';
    // or
    import SearchInput from '@dooboo-ui/native-search-input';
  • Usage

    const SearchInputWithState = () => {
      const [value, setValue] = useState('');
      return (
        <>
          <SearchInput
            value={value}
            onDebounceOrOnReset={setValue}
            debounceDelay={number('delay', 400)}
            placeholderText={text('placeholder', '')}
          />
          <Value>{`value (after debounced delay) : ${value}`}</Value>
        </>
      );
    };