# @nghinv/react-native-search-bar

> React Native SearchBar Component

Latest version **0.2.0** (published 2021-11-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nghinv/react-native-search-bar
pnpm add @nghinv/react-native-search-bar
yarn add @nghinv/react-native-search-bar
bun add @nghinv/react-native-search-bar
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2021-11-04 |
| First published | 2021-07-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 74.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | NghiNV |
| Maintainers | nghinv |
| Keywords | react-native, ios, android, search, component, react-native-search-bar |

## Links

- npm: https://www.npmjs.com/package/@nghinv/react-native-search-bar
- Repository: https://github.com/nghinv-software/react-native-search-bar
- Homepage: https://github.com/nghinv-software/react-native-search-bar#readme
- Issues: https://github.com/nghinv-software/react-native-search-bar/issues
- npm.io page: https://npm.io/package/@nghinv/react-native-search-bar

## Dependencies (2)

- [react-fast-compare](https://npm.io/package/react-fast-compare.md) *
- [react-native-vector-icons](https://npm.io/package/react-native-vector-icons.md) *

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2021-11-04
- 0.0.1 (undefined) — 2021-07-08
- 0.1.0 — 2021-08-09
- 0.0.3 — 2021-07-31
- 0.0.2 — 2021-07-15

## README

# @nghinv/react-native-search-bar

React Native SearchBar Component use reanimated 2 library

---

[![CircleCI](https://circleci.com/gh/nghinv-software/react-native-search-bar.svg?style=svg)](https://circleci.com/gh/nghinv-software/react-native-search-bar)
[![Version][version-badge]][package]
[![MIT License][license-badge]][license]
[![All Contributors][all-contributors-badge]][all-contributors]
[![PRs Welcome][prs-welcome-badge]][prs-welcome]

<p align="center">
<img src="./assets/light.gif" width="300"/>
<img src="./assets/dark.gif" width="300"/>
</p>

## Installation

```sh
yarn add @nghinv/react-native-search-bar
```

or 

```sh
npm install @nghinv/react-native-search-bar
```

- peerDependencies

```sh
yarn add react-native-gesture-handler react-native-reanimated
```

## Usage

```js
import React, { useState, useCallback } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import SearchBar from '@nghinv/react-native-search-bar';

function App() {
  const [text, setText] = useState('');

  const onChangeText = useCallback((value) => {
    setText(value);
  }, []);

  return (
    <View style={styles.container}>
      <SearchBar
        placeholder='Search'
        containerStyle={styles.textInput}
        cancelTitle='Huỷ'
        value={text}
        onChangeText={onChangeText}
        // theme={theme.textInput}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    paddingVertical: 24,
  },
  textInput: {
    marginTop: 40,
    paddingHorizontal: 16,
    paddingVertical: 8,
  },
});

export default App;
```

# Property

| Property | Type | Default | Description |
|----------|:----:|:-------:|-------------|
| containerStyle | `ViewStyle` | `undefined` |  |
| textInputStyle | `TextStyle` | `undefined` |  |
| width | `number \| string` | `undefined` |  |
| height | `number` | `44` |  |
| borderRadius | `number` | `12` |  |
| cancelButton | `boolean` | `true` | Show, hide cancel button |
| cancelTitle | `string` | `Cancel` |  |
| cancelTitleStyle | `TextStyle` | `undefined` |  |
| onFocus | `() => void` | `undefined` |  |
| onBlur | `() => void` | `undefined` |  |
| onSubmitEditing | `() => void` | `undefined` |  |
| value | `string` | `undefined` |  |
| onChangeText | `(value: string) => void` | `undefined` |  |
| isDarkTheme | `boolean` | `false` |  |
| theme | `InputThemeType` |  |  |
| clearIcon | `React.ReactNode` | `null` |  |
| searchIcon | `React.ReactNode` | `null` |  |


- **InputThemeType**

| Property | Type | Default | Description |
|----------|:----:|:-------:|-------------|
| backgroundColor | `string` |  |  |
| placeholderColor | `string` |  |  |
| textInputBackground | `string` |  |  |
| textColor | `string` |  |  |
| selectionColor | `string` |  |  |
| clearIconColor | `string` |  |  |
| textButtonColor | `string` |  | Cancel title color |

```
TextInputThemeDefault = {
  dark: {
    backgroundColor: 'transparent',
    placeholderColor: '#636366',
    textInputBackground: 'rgba(44,44,46,0.8)',
    textColor: 'white',
    selectionColor: '#2979ff',
    clearIconColor: '#c7c7cc',
    searchIconColor: '#b0b0b2',
    textButtonColor: '#2979ff',
  },
  light: {
    backgroundColor: 'transparent',
    placeholderColor: '#8e8e93',
    textInputBackground: 'rgba(142,142,147,0.12)',
    textColor: 'black',
    selectionColor: '#2979ff',
    clearIconColor: '#c7c7cc',
    searchIconColor: '#8e8e93',
    textButtonColor: '#2979ff',
  },
};
```

---
## Credits

- [@Nghi-NV](https://github.com/Nghi-NV)


[version-badge]: https://img.shields.io/npm/v/@nghinv/react-native-search-bar.svg?style=flat-square
[package]: https://www.npmjs.com/package/@nghinv/react-native-search-bar
[license-badge]: https://img.shields.io/npm/l/@nghinv/react-native-search-bar.svg?style=flat-square
[license]: https://opensource.org/licenses/MIT
[all-contributors-badge]: https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square
[all-contributors]: #contributors
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs-welcome]: http://makeapullrequest.com

---
_Source: https://npm.io/package/@nghinv/react-native-search-bar · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
