2.0.0 • Published 9 months ago

@dev-kd/react-native-animated-search-bar v2.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

Animated Search Bar

An animated-search-bar is a customizable and interactive React Native component for creating animated search bars with smooth transitions and advanced features. It is designed to enhance the user experience with a sleek UI and various configuration options.

Features

  • 🔍 Animated Search Bar: Expands and collapses smoothly.
  • 💬 Dynamic Messages: Displays scrolling messages in the placeholder area.
  • ✨ Highly Customizable: Supports custom styles, icons, fonts, and more.
  • 🎛️ Advanced Options: Includes clear buttons, callbacks, keyboard types, and return key handling.

npm.io

Installation

npm i @dev-kd/react-native-animated-search-bar

or

yarn add @dev-kd/react-native-animated-search-bar

How to Use

import React, { useState } from 'react';
import { View } from 'react-native';
import AnimatedSearchBar from 'animated-search-bar';

const App = () => {
  const [searchedText, setSearchedText] = useState('');

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <AnimatedSearchBar
        messageData={[
              'Flights',
              'Trains',
              'Hotels',
              'Rooms',
              'Cabs',
              'Bus',
              'etc..',
            ]}
        onChangeText={v => {
        setSearchedText(v);
        }}
      Value={searchedText}
      />
    </View>
  );
};

export default App;

Customise

viewStyle={{
              width: '100%',
              height: scale(40),
              height: scale(40),
              alignItems: 'center',
              flexDirection: 'row',
              borderRadius: scale(5),
              borderColor: '#E0E0E0',
              borderWidth: scale(1),
              paddingVertical: scale(8),
              backgroundColor: '#fff',
              paddingHorizontal: scale(12),
            }}
            SearchLabelTextStyle={{
              color: '#999999',
              fontSize: normalizeText(14),
              fontFamily: FONTS.myFontRegular || 'default-font-family',
            }}
            TextMessageStyle={{
              maxWidth: '90%',
              color: '#6C6C6C',
              fontSize: scale(14),
              fontFamily: FONTS.myFontRegular || 'default-font-family',
            }}
            TextMessageStyleBold={{
              maxWidth: '90%',
              color: '#6C6C6C',
              fontWeight: 'bold',
              fontSize: scale(14),
              fontFamily: FONTS.myFontBold || 'default-font-family',
            }}
            customTextInputStyle={{height: scale(35)}}
Prop NameTypeDefaultDescription
SearchImgSourcestringassets/search.pngPath to a custom search icon image.
SearchImgStyleStylePropundefinedCustom styles for the search icon.
messageDatastring[ ][ ]Array of messages to display as scrolling placeholder text.
messageDelaynumber200Time delay (ms) between each character of a message.
messageTimeoutnumber1000Time delay (ms) before transitioning to the next message.
viewStyleStylePropundefinedCustom styles for the main search bar container.
onChangeText(text: string) => void() => {}Callback triggered when the text input value changes.
multilinebooleanfalseEnables multiline text input.
keyboardTypeKeyboardTypeOptions'default'Type of keyboard to use for text input.
ValuestringundefinedCurrent value of the search input.
labelstringEnter ${label}Placeholder text label.
returnKeyTypeReturnKeyTypeOptions'done'Specifies the return key type on the keyboard.
hideClearButtonbooleanfalseHides or shows the clear button.
autoFocusbooleantrueAutomatically focuses the text input when it is rendered.
onReturnPress() => voidundefinedCallback triggered when the return key is pressed.
callBackFunction(arg: any) => void() => {}Callback triggered after enabling search with non-empty input.
onPressSearchBar() => voidundefinedCallback triggered when the search bar is pressed.
editablebooleantrueSpecifies if the input is editable.
clearButtonContainerStyleStylePropundefinedCustom styles for the clear button container.
clearImageSourcestringassets/close.pngPath to a custom clear button icon image.
clearBtnImgStyleStylePropundefinedCustom styles for the clear button icon.
fontFamilystring''Custom font family for text input and messages.
TextMessageStyleBoldStylePropundefinedCustom styles for bold message text.
customTextInputStyleStylePropundefinedCustom styles for the text input.
2.0.0

9 months ago

1.1.7

11 months ago

1.1.6

12 months ago

1.1.5

12 months ago

1.1.4

12 months ago

1.1.3

12 months ago

1.1.2

12 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.0.0

12 months ago