1.2.3 • Published 2 years ago

react-native-platform-searchbar v1.2.3

Weekly downloads
25
License
MIT
Repository
github
Last release
2 years ago

react-native-platform-searchbar

npm version

A customizable SearchBar component for React Native. Includes platform specific designs for iOS and Android. Written in Typescript.

Installation

  1. install react-native-platform-searchbar npm install react-native-platform-searchbar --save or yarn add react-native-platform-searchbar
  2. if not already installed, add react-native-svg

Usage

Basic

import SearchBar from 'react-native-platform-searchbar';

const Example = () => {
    const [value, setValue] = useState('');
    <SearchBar
        value={value}
        onChangeText={setValue}
        style={styles.searchBar}
    />;
};

With children

ActivityIndicator Example

import SearchBar from 'react-native-platform-searchbar';

const Example = () => {
    const [value, setValue] = useState('');
    <SearchBar
        value={value}
        onChangeText={setValue}
        placeholder="Search"
        theme="light"
        platform="ios"
        style={styles.searchBar}
    >
        {loading ? (
            <ActivityIndicator style={{ marginRight: 10 }} />
        ) : undefined}
    </SearchBar>;
};

Props

NameTypeDefaultDescription
valuestringREQUIREDSearchBar value
onChangeText(string) => voidREQUIREDcalled when SearchBar value changes
theme"light" | "dark""light"SearchBar theme
platform"default" | "ios" | "android""default"which SearchBar version to use. "default" uses current platform
cancelTextstring"Cancel"cancel button text. Only visible in iOS SearchBar
placeholderTextColorstringdifferent shades of gray depending on theme and platformColor of placeholderText
iconColorstringsame as placeholderTextColorcolor of icons (Search, Clear...)
leftIconReactElementsearch iconcustom icon to show on the left
styleobject (ViewStyle)undefinedcustom style for the outer container view
inputStyleobject (TextStyle)undefinedcustom style for the TextInput component
onCancel() => voidundefinedcallback that gets called when cancel button is pressed
onClear() => voidundefinedcallback that gets called when clear button is pressed

All TextInput Props are also supported.

1.2.3

2 years ago

1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago