npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rn-searchbox

v1.0.0

Published

searchbox

Downloads

1

Readme

rn-searchbox

A simple Search Bar with Flatlist Component for handling huge and large data.

With simple search capability which can be utilised by handing the component data to Flatlist Component and providing a onClick function which will receive the item selected of the data array.

The search function uses a Dice Algorithm to traverse the data and looks for an indexOf the user input within all strings, numbers, and boolean values in the data.

Build for React Native App and works on both Android and iOS.

Install

npm install --save rn-searchbox

or

yarn add rn-searchbox

Component props

Property | Type | Default | Description | :---------|:--------|:----------|:------------| onClick(item) | function | null | Fires after each Click and return item data. itemsStyles | array | [] | The array of styles of data to be displayed in FlatList. data | array | [] required* | The array of data to be searched placeholder | string | Search | The placeholder for the search bar. onFocus | function | null | Fires when the search bar receives focus. onBlur | function | null | Fires when the search bar loses focus. closeButton | Component | MaterialIcon | Sets the close button component. closeButtonAccessibilityLabel | string | Clear search text | Accessibility label for the close button. heightAdjust | number | 0 | Adjust the height of the search bar. backgroundColor | string | white | The background colour of the search bar. iconColor | string | gray | The color of the back and X icons. textColor | string | gray | The color of the search bar text. selectionColor | string | lightskyblue | The color of the the search bar cursor and text selection. placeholderTextColor | string | lightgray | The color of the placeholder text. showOnLoad | boolean | false | Show the search bar when it is first rendered. clearOnShow | boolean | false | Clear input when the search bar is shown. clearOnHide | boolean | true | Clear input when the search bar is hidden. clearOnBlur | boolean | false | Clear input when the search bar is blurred. focusOnLayout | boolean | true | Focus the text input box whenever it is shown. autoCorrect | boolean | true | AutoCorrect the search bar text. autoCapitalize | string | sentences | Auto capitialize behaviour of the text input - enum('none', 'sentences', 'words', 'characters') keyboardAppearance | string | 'default' | Determines the color of the keyboard. fontFamily | string | System | The font family to be used. fontSize | number | 20 | Sets the font size.

Usage

import React, { Component } from 'react' 
import { StyleSheet, Alert } from 'react-native' 
import SearchBox from 'rn-searchbox' 

export default class Example extends Component {
    
    onClick(item) {
        Alert.alert('Item: '+JSON.stringify(item)) 
    }
    render() {
        return (
            <SearchBox
                data={data.users}
                showOnLoad
                onClick={(item) => this.onClick(item)}
                itemsStyles={itemsStyle()}
            />
        ) 
    }
}

const itemsStyle = () => {
    return {
        name: {
            fontSize: 18
        },
        email: {
            color: 'red'
        },
        phone: {
            fontSize: 16,
            color: 'blue'
        }
    }
}

const data = {
    "users":
        [
            {
                "key": "0",
                "name": "Proxima Midnight",
                "phone": "+216 54 548 216"
            },
            {
                "key": "1",
                "name": "Ebony Maw",
                "email": "[email protected]",
            },
            {
                "key": "2",
                "name": "Black Dwarf",
            },
            {
                "key": "3",
                "name": "Mad Titan",
                "email": "[email protected]",
                "phone": "+216 54 548 100",
                "adress": "Sousse, Tunis"
            },
            {...}
        ]
}

Next Step:

  • Possibility to add a custom icon/image to the ListView
  • New Algorithm for String Matching
  • Update docs for Box component
  • Update react, react-native & other dependencies

Questions?

Feel free to contact me or create an issue.

Author

kerim selmi karimation

License

This project is licensed under the MIT License