@@ -29,9 +29,12 @@ A simple search bar component for React Native.
2929
3030[ ![ NPM] ( https://nodei.co/npm/react-native-input-search-bar.png?downloads=true&downloadRank=true&stars=true )] ( https://nodei.co/npm/react-native-input-search-bar/ )
3131
32- - 1.Run ` npm i react-native-input-search-bar --save `
33- - or ` yarn add react-native-input-search-bar `
32+ - 1.Run ` npm i react-native-svg react-native- input-search-bar --save `
33+ - or ` yarn add react-native-svg react-native- input-search-bar `
3434- 2.` import ReactNativeInputSearchBar from 'react-native-input-search-bar' `
35+ - 3 . Run ` npx pod-install ` if you are using iOS, and ` react-native link ` if you are using Android. (this step is for ` react-native-svg ` )
36+
37+ ** Notes:** You need to install ` react-native-svg ` first, because this component depends on it to render the search icon.
3538
3639## Getting Started
3740
@@ -61,11 +64,11 @@ Inside your component's render method, use ReactNativeInputSearchBar:
6164
6265``` javascript
6366import ReactNativeInputSearchBar from ' react-native-input-search-bar'
64- import React , { useState } from ' react'
67+ import { useState } from ' react'
6568
6669const SearchBar = () => {
67- const [query , setQuery ] = useState < string > defQuery
68- const [activeSearch , setActiveSearch ] = useState < boolean > false
70+ const [query , setQuery ] = useState< string> ( ' ' )
71+ const [activeSearch , setActiveSearch ] = useState< boolean> ( false )
6972
7073 const onSubmitSearch = (val : string ) => {
7174 setQuery (val)
@@ -82,7 +85,7 @@ const SearchBar = () => {
8285 buttonTextStyle= {{}}
8386 searchToolContainerStyle= {{ height: 40 }}
8487 inputContainerStyle= {{
85- backgroundColor: theme . colors . white ,
88+ backgroundColor: ' #ffffff ' ,
8689 borderWidth: 0.3 ,
8790 borderRadius: 20
8891 }}
0 commit comments