0.0.1 • Published 3 years ago

rn-floating-label-input-component v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

rn-floating-label-input-component

A cross-platform react-native floating label input component.

Under the hood, this library is using TextInput.

Installation

Install the library using npm or yarn:

# using npm
$ npm i rn-floating-label-input-component

# using yarn
$ yarn add rn-floating-label-input-component

Usage

import React, { useState } from "react";
import { View } from "react-native";
import FloatingLabeleInput from "rn-floating-label-input-component";

const Example = () => {
  const [userName, setUserName] = useState("");
  return (
    <View>
      <FloatingLabeleInput
        label="User Name"
        value={userName}
        onChange={setUserName}
        autoCapitalize="none"
        returnKeyType="next"
        required={false}
        blurredBorderWidth={1}
      />
    </View>
  );
};

export default Example;

Available props

All the TextInput props are supported as well!

NameTypeDefaultDescription
autoCapitalizestring?Tells TextInput to automatically capitalize certain characters. This property is not supported by some keyboard types such as name-phone-pad
blurredBorderWidthfloat?0Border width of the blurred component
blurredFontSizefloat?16Label font size of the burred component
blurredPositionfloat?android: 25, ios: 10Label position of the burred component
colorsobject?{}Overrides the default colors of the compoent
customStylesstyle?{}The style of the parent container
disabledbool?falseIf true, text is not editable. The default value is false
focusedBorderWidthfloat?1.3Border width of the focused component
focusedFontSizefloat?13Label font size of the focused component
focusedPositionfloat?android: -4, ios: -5Label position of the focused component
inputFontSizefloat?16Input font size of the component
isSecureFieldbool?falseIf true, the text input obscures the text entered so that sensitive text like passwords stay secure. The default value is false. Does not work with multiline={true}
keyboardTypestring?'default'Determines which keyboard to open, e.g.numeric
labelstringThe label of the field
labelLeftPositionfloat?showLeftIcon === true ? 32 : 5Label left position
leftIconcomponent?Left Component
messagestring?''Help text
multilinebool?falseIf true, the text input can be multiple lines
onBlurfunc?() => nullCallback that is called when the text input is blurred
onChangefuncREQUIRED () => nullCallback that is called when the text input's text changes. Changed text is passed as a single string argument to the callback handler
onFocusfunc?() => nullCallback that is called when the text input is focused
onLeftIconPressfunc?() => nullCallback that is called when the left icon is clicked
onRightIconPressfunc?() => nullCallback that is called when the right icon is clicked
onSubmitEditingfunc?() => nullCallback that is called when the text input's submit button is pressed
placeholderstring?''The string that will be rendered before text input has been entered
requiredbool?falseIf true, displays the * symbol next to label
returnKeyTypestring?Determines how the return key should look.
rightActiveIconcomponent?Right Active Component
rightInactiveIconcomponent?Right Inactive Component
showLeftIconbool?falseIf true, reder leftIcon
showRightIconbool?falseIf true, reder rightActiveIcon and rightInactiveIcon
valuestringREQUIREDThe value of the text input

Contributing

Pull requests, feedbacks and suggestions are welcome!

License

The library is released under the Folio3 X-Platform Engineering Group.