New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@wezyy1/rn-floating-label-input

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wezyy1/rn-floating-label-input

A cross-platform Floating-Label-Input component for React Native.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

@wezyy1/rn-floating-label-input

Generic badge

This is a React-Native floating label input component, that visually combines an input label and the input itself into a single element. The floating label switches from placeholder mode to label when input is focused or has content in it.

Error message is included.

Installation

Installation can be done by using the npm install command:

$ npm install @wezyy1/rn-floating-label-input

Demo (Default Style)

demo

Basic Usage


import React from 'react';
import { View } from 'react-native';
import FloatingInput from '@wezyy1/rn-floating-label-input'

export default class App extends React.Component{

    state = {
        isInvalid:false,
        email:'',

    }

    emailChange = (text) => {
        this.setState({
            email: text,
            isInvalid: !this.isEmailRightFormat(text)
        })
    }

    isEmailRightFormat = (text) => {
        if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(text)){
            return true
        }
            return false
    }

    render(){
        return (
            <View style={{width:'100%'}}>
                <FloatingInput 
                    label="E-mail*" 
                    floatColor = "#187FC0" 
                    isInvalid={this.state.isInvalid} 
                    keyboardType="email-address" 
                    errorText="Please enter a correct email."
                    onChangeText={this.emailChange} 
                    value={this.state.email}
                />
            </View>
        )
    }
}

Try this example on Snack

API

Props

PropertyDescriptionTypeDefault
labelThe text of the input label.String
floatColorThe color when the input field is focused.String'#187FC0'
isInvalidIf true, the label will be displayed in an error state and show error message(if has).boolfalse
keyboardTypekeyboard type popup when the input is focused.'default', 'number-pad', 'decimal-pad', 'numeric', 'email-address', 'phone-pad''default'
errorTextThe error message shows up when the input is invalid.String
valueThe value displayed the input field.String
onChangeTextCallback fired when the value is changed. This function will get the value of the input.Function
labelStyleThe style of the lable.Style Object
inputStyleThe style of the text input.Style Object
containerStyleThe style of the container.Style Object

Keywords

FAQs

Package last updated on 27 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc