Socket
Socket
Sign inDemoInstall

react-native-platform-searchbar

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-platform-searchbar

A searchbar component for React Native


Version published
Weekly downloads
208
decreased by-33.76%
Maintainers
1
Install size
152 kB
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 22 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc