All Projects → localz → React Native Searchbar

localz / React Native Searchbar

Licence: mit
A pretty sweet search bar for React Native.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Searchbar

Googleapi
C# .NET Core Google Api (Maps, Places, Roads, Search, Translate). Supports all endpoints and requests / responses.
Stars: ✭ 346 (-11.73%)
Mutual labels:  search
Tribler
Privacy enhanced BitTorrent client with P2P content discovery
Stars: ✭ 3,915 (+898.72%)
Mutual labels:  search
React Select Search
⚡️ Lightweight select component for React
Stars: ✭ 379 (-3.32%)
Mutual labels:  search
Xapiand
Xapiand: A RESTful Search Engine
Stars: ✭ 347 (-11.48%)
Mutual labels:  search
Sparkler
Spark-Crawler: Apache Nutch-like crawler that runs on Apache Spark.
Stars: ✭ 362 (-7.65%)
Mutual labels:  search
Maryam
Maryam: Open-source Intelligence(OSINT) Framework
Stars: ✭ 371 (-5.36%)
Mutual labels:  search
Docsearch Configs
DocSearch - Configurations
Stars: ✭ 339 (-13.52%)
Mutual labels:  search
Open Semantic Search
Open Source research tool to search, browse, analyze and explore large document collections by Semantic Search Engine and Open Source Text Mining & Text Analytics platform (Integrates ETL for document processing, OCR for images & PDF, named entity recognition for persons, organizations & locations, metadata management by thesaurus & ontologies, search user interface & search apps for fulltext search, faceted search & knowledge graph)
Stars: ✭ 386 (-1.53%)
Mutual labels:  search
Awesome Search
Awesome Search - this is all about the (e-commerce) search and its awesomeness
Stars: ✭ 361 (-7.91%)
Mutual labels:  search
Search Tweets Python
Python client for the Twitter search endpoints (v2/Labs/premium/enterprise). Now supports Twitter API v2 /recent and /all search endpoints.
Stars: ✭ 378 (-3.57%)
Mutual labels:  search
Algoliasearch Rails
AlgoliaSearch integration to your favorite ORM
Stars: ✭ 352 (-10.2%)
Mutual labels:  search
Searchdialog
仿bilibili搜索框效果(三句代码实现)
Stars: ✭ 361 (-7.91%)
Mutual labels:  search
Ctrlp Funky
A super simple function navigator for ctrlp.vim
Stars: ✭ 373 (-4.85%)
Mutual labels:  search
Fmap
宇行地图:高仿高德地图Android客户端(持续更新中...)
Stars: ✭ 347 (-11.48%)
Mutual labels:  search
Dbreeze
C# .NET MONO NOSQL ( key value store embedded ) ACID multi-paradigm database management system.
Stars: ✭ 383 (-2.3%)
Mutual labels:  search
Js Worker Search
JavaScript client-side search API with web-worker support
Stars: ✭ 345 (-11.99%)
Mutual labels:  search
Jivesearch
A search engine that doesn't track you.
Stars: ✭ 364 (-7.14%)
Mutual labels:  search
Iosdropdown
Drop Down Menu for iOS With Search And Other Awesome Customisation
Stars: ✭ 390 (-0.51%)
Mutual labels:  search
Pysearch
🔍 An elegant search controller which replaces the UISearchController for iOS (iPhone & iPad) .
Stars: ✭ 3,816 (+873.47%)
Mutual labels:  search
Algorithms
Minimal examples of data structures and algorithms in Python
Stars: ✭ 20,123 (+5033.42%)
Mutual labels:  search

react-native-searchbar

A pretty awesome search bar for React Native. It has a built in simple search capability which can be utilised by handing the component data and providing a handleResults function which will receive the filtered copy of the data array.

The search function uses a depth-first algorithm to traverse the data and simply looks for an indexOf the user input within all strings, numbers, and boolean values in the data.

Works on both iOS and Android.

react-native-searchbar

(Rendered with the example in these docs and repository)

Installation

  • npm install react-native-searchbar --save
  • Install react-native-vector-icons if the project doesn't have them already. The search bar accesses MaterialIcons.
  • Now you can require the search bar with import SearchBar from 'react-native-searchbar' or var SearchBar = require('react-native-searchbar')

Available Props

Property Type Default Description
data array [] The array of data to be searched (if not using a custom search algorithm)
placeholder string Search The placeholder for the search bar.
handleChangeText(input) function null Fires when the input text changes.
handleSearch(input) function null Fires after handleChangeText, and can be used to implement a custom search. If not present, the internal search logic will be used.
handleResults(results) function null Fires after each internal search with the results array.
onSubmitEditing function null Fired after pressing 'search' on the device keyboard
getValue function null Returns the current value of the search bar input.
onHide(input) function null Fires when the search bar is hidden with the current user input.
onBack function Hides the search bar Fires when the back icon is pressed.
onX function null Fires when the X button is pressed. Still clears the input.
onFocus function null Fires when the search bar receives focus.
onBlur function null Fires when the search bar loses focus.
backButton Component MaterialIcon Sets the back button component.
backButtonAccessibilityLabel string Navigate up Accessibility label for the back button.
closeButton Component MaterialIcon Sets the close button component.
closeButtonAccessibilityLabel string Clear search text Accessibility label for the close button.
backCloseSize number 28 Sets the size of back button & 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.
animate boolean true Animate the search bar when it is shown and hidden.
animationDuration number 200 The duration of the above animation in milliseconds.
showOnLoad boolean false Show the search bar when it is first rendered.
hideBack boolean false Hide the back button.
hideX boolean false Hide the X icon which clears the input.
iOSPadding boolean true Pad the size of the iOS status bar.
iOSHideShadow boolean false Hide the shadow under the search bar in iOS.
iOSPaddingBackgroundColor string transparent Change the background color of the padding.
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.
allDataOnEmptySearch boolean false Search results behave as a .filter, returning all data when the input is an empty string.

Usage

  • Use a ref to show and hide the search bar and set the text input valueref={(ref) => this.searchBar = ref}

    • this.searchBar.show()
    • this.searchBar.hide()
    • this.searchBar.setValue("text to set")
  • Write your own search logic with handleSearch or provide some data and use the results handed back from handleResults.

  • Use your powers for good!

Notes for Android
  • Render the search bar component after the component it is supposed to display over. iOS handles this nicely with a zIndex of 10. Android elevation is set to 2.
  • The bottom of the search bar will have a thin border instead of a shadow.

Example

Full example at example/

import SearchBar from 'react-native-searchbar';

const items = [
  1337,
  'janeway',
  {
    lots: 'of',
    different: {
      types: 0,
      data: false,
      that: {
        can: {
          be: {
            quite: {
              complex: {
                hidden: [ 'gold!' ],
              },
            },
          },
        },
      },
    },
  },
  [ 4, 2, 'tree' ],
];

...
_handleResults(results) {
  this.setState({ results });
}
...

...
<SearchBar
  ref={(ref) => this.searchBar = ref}
  data={items}
  handleResults={this._handleResults}
  showOnLoad
/>
...

Contributing

Contributing to react-native-searchbar is easy! With four simple steps:

Create a branch

  1. Fork the repository
  2. git clone <your-repo-url> to clone your GitHub repo to your local one
  3. git pull origin master to pull the latest code
  4. npm install to install the project's dependencies
  5. git checkout -b the-name-of-my-branch to create a branch (use something short and comprehensible, such as: fix-styling-of-search-bar).

Make the change

Test the change

  1. Run npm run fix from the project root (This will run Prettier and ESLint and automatically fix any issues).
  2. If possible, test any visual changes in Android and iOS.

Push the change!

  1. git add -A && git commit -m "My message" (replacing My message with a commit message, such as Fixed styling on search bar) to stage and commit your changes
  2. git push my-fork-name the-name-of-my-branch
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].