1.0.5 • Published 2 years ago

@pnap/react-native-search-bar v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@pnap/react-native-search-bar

Animated search bar built with vanilla React Native.

showcase

Installation

Use npm or yarn to install the package.

npm install @pnap/react-native-search-bar

or

yarn add @pnap/react-native-search-bar

Usage

import {View, StyleSheet} from 'react-native'
import {CustomSearchIcon} from 'components/icons'
import SearchBar from '@pnap/react-native-search-bar'

// Create your component
const MyScreenComponent = () => {

  // Some business logic (functions, variables, etc)

  return (
     <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
        <SearchBar
          onSubmitSearch={onSubmitSearch}
          onActiveSearch={onActiveSearch}
          onToggleSearchBar={onToggleSearchBar}
          customIcon={CustomSearchIcon}
          inputTextStyle={styles.searchBarInput}
          buttonStyle={styles.searchButton}
          buttonTextStyle={styles.searchButtonText}
          underlineActiveColor={"#9f9ea4"}
          underlineInactiveColor={"#6d28d9"}
        />
     </View>
}

const styles = StyleSheet.create({
    ...
})

Availalable Props

NameTypeDefaultDescriptionRequired
onSubmitSearchfunction-Fires when user submits text input.Yes
onActiveSearchfunction-Fires when user focus text input.Yes
onToggleSearchBarfunction-Fires when user presses on search icon (or custom icon).Yes
customIconJSX componentregular search iconSvg to be rendered as search button.No
inputTextStyleTextStylesimple styleStyle value for TextInput text.No
buttonStyleViewStylesimple styleStyle value for search Pressable.No
buttonTextStyleTextStylesimple styleStyle value for search Pressable text.No
underlineActiveColorColorValue#6d28d9Color for bottom border of active TextInput.No
underlineInactiveColorColorValue#9f9ea4Color for bottom border of inactive TextInput.No
animationDurationNumber360Time in milliseconds for animations.No

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Authors

Piotr Napierala - author

License

@pnap/react-native-search-bar is released under MIT license.

1.0.5

2 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago