1.0.4 • Published 7 years ago

rn-search-bar v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

RN-Search-Bar

  • npm install react-native-vector-icons --save
  • react-native link react-native-vector-icons
  • npm install rn-search-bar --save

Example One

Props

PropTypeDescriptionRequired
containerStyleobjectstyles applied to the search bar containerYES
onChangefunctionfunction called when text input changesYES
textStyleobjectstyles applied to the text inputno
clearTextOnPressbooleanclear the text when the search button is pressedno
renderLeftIconbooleanrender the left side search iconno
leftIconColorstringcolor of the leftno
leftIconSizenumbersize of the left iconno
renderSearchIconbooleanrender the search icon on the right side which functions as a buttonno
searchIconSizenumbersize of the search iconno
searchIconColorstringcolor of the search iconno
searchIconBackgroundColorstringbackgroundColor for the search icon buttonno
onPressfunctionfunction called when search icon button is pressed, called with text inputif search icon is rendered
import React, { Component } from 'react';

import SearchBar from 'rn-search-bar';

class SearchBarExampleOne extends Component {
  render(){
    return(
      <SearchBar
        onPress={
          (text) => console.log('You typed + ' text)
        }
        onChange={
          (text) => console.log(text)
        }
        containerStyle={{
          height:50,
          borderTopWidth:1,
          borderBottomWidth:1
        }}
        renderSearchIcon={true}
        clearTextOnPress={true}
        renderLeftIcon={true}
        searchIconSize={15}
        searchIconColor={'deeppink'}
        searchIconBackgroundColor={'aqua'}
        leftIconColor={'rgba(152,152,152,.7)'}
        leftIconSize={12}
        textStyle={{
          color: 'cyan'
        }}
      />
    )
  };

class SearchBarExampleTwo extends Component {
  render(){
    return(
      <SearchBar
        onPress={
          (text) => console.log('You typed ' + text )
        }
        onChange={
          (text) => console.log(text)
        }
        containerStyle={{
          height:50,
          marginHorizontal: 10,
          borderRadius: 5,
          borderColor: 'purple',
          borderWidth: 1
        }}
        renderSearchIcon={true}
        clearTextOnPress={false}
        renderLeftIcon={false}
        searchIconSize={20}
        searchIconColor={'deeppink'}
        searchIconBackgroundColor={'aqua'}
        textStyle={{
          color: 'cyan',
          paddingLeft: 10
        }}
      />
    )
  };
}
1.0.4

7 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago