# searchable-flatlist

> Wrapper component over Flatlist component to provide search functionality.

Latest version **0.0.4** (published 2018-01-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install searchable-flatlist
pnpm add searchable-flatlist
yarn add searchable-flatlist
bun add searchable-flatlist
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2018-01-10 |
| First published | 2018-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Ajith Pandian |
| Maintainers | ajithpantian |
| Keywords | searchable, filterable, flatlist, list, filter, reactnative, react, search, filter, filter-list, search-list, react-native-search, react-native-filter, flatlist-search, flatlist-filter, react-native-flatlist, react-native-search, react-native-filter |

## Links

- npm: https://www.npmjs.com/package/searchable-flatlist
- Repository: https://github.com/Ajith-Pandian/SearchableFlatlist
- Homepage: https://github.com/Ajith-Pandian/SearchableFlatlist#readme
- Issues: https://github.com/Ajith-Pandian/SearchableFlatlist/issues
- npm.io page: https://npm.io/package/searchable-flatlist

## Dependencies (3)

- [react](https://npm.io/package/react.md) 16.0.0
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.0
- [react-native](https://npm.io/package/react-native.md) 0.51.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2018-01-10
- 0.0.3 — 2018-01-03
- 0.0.2 — 2018-01-02
- 0.0.1 — 2018-01-02

## README

# Searchable Flatlist

Wrapper component over Flatlist component to provide search functionality.

[![npm](https://img.shields.io/npm/v/searchable-flatlist.svg?style=plastic)](https://www.npmjs.com/package/searchable-flatlist) [![npm](https://img.shields.io/npm/dm/searchable-flatlist.svg?style=plastic)](https://npmjs.org/package/searchable-flatlist) [![npm](https://img.shields.io/npm/dt/searchable-flatlist.svg?style=plastic)](https://npmjs.org/package/searchable-flatlist)

## Preview

<img src="./gifs/search.gif" width="320" style="box-shadow: 4px 4px 50px #888888;"/>

## Usage

### Install from npm:

`npm install --save searchable-flatlist`

### Integrate into your app:

```js
import React, { Component } from "react";
import { StyleSheet, Text, View, TextInput } from "react-native";
import SearchableFlatlist from "searchable-flatlist";

const data = [
  { id: 1, name: "Francesco Raoux" },
  { id: 2, name: "Tasha Bonanno" },
  { id: 3, name: "Merle Braunstein" },
  { id: 4, name: "Aleda Bouzan" },
  { id: 5, name: "Issiah Elnaugh" }
];

export default class App extends Component {
  state = { searchTerm: "" };
  render() {
    let { sContainer, sSearchBar, sTextItem } = styles;
    return (
      <View style={sContainer}>
        <TextInput
          placeholder={"Search"}
          style={sSearchBar}
          onChangeText={searchTerm => this.setState({ searchTerm })}
        />
        <SearchableFlatlist
          searchProperty={"name"}
          searchTerm={this.state.searchTerm}
          data={data}
          containerStyle={{ flex: 1 }}
          renderItem={({ item }) => <Text style={sTextItem}>{item.name}</Text>}
          keyExtractor={item => item.id}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  sContainer: {
    flex: 1,
    backgroundColor: "#F5FCFF"
  },
  sTextItem: {
    height: 50,
    width: "100%",
    textAlign: "center",
    textAlignVertical: "center",
    fontSize: 18
  },
  sSearchBar: {
    paddingHorizontal: 10,
    margin: 10,
    height: 50,
    borderColor: "gray",
    borderWidth: 1,
    fontSize: 18
  }
});
```

| Props            | Description                           | Value                                                                         | Required               |
| ---------------- | ------------------------------------- | ----------------------------------------------------------------------------- | ------------------------ |
| `data`           | data for flatlist                     | `object array`                                                                | :heavy_check_mark:       |
| `searchProperty` | property of the object to be searched | `string`                                                                      | :heavy_check_mark:       |
| `searchTerm`     | searching term                        | `string`                                                                      | :heavy_check_mark:       |
| `type`           | type of search                        | one of the following `SearchableFlatlist.WORDS` `SearchableFlatlist.INCLUDES` | :heavy_multiplication_x: |

`SearchableFlatlist.WORDS` - search words

`SearchableFlatlist.INCLUDES` - search everything (default)

---
_Source: https://npm.io/package/searchable-flatlist · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
