Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rn-credit-card-textinput

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rn-credit-card-textinput

A fully customizable react native Credit card TextInput

  • 1.1.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rn-credit-card-textinput

A Fully customizable react-native credit card TextInput

Hi, I'm Orji! 👋

🚀 About Me

I'm a full stack developer but I'm more Front-end inclined... I build awesome react and react-native apps!

Demo

Demo

Installation

To deploy this project run

  npm install rn-credit-card-textinput
   or

   yarn add rn-credit-card-textinput

Features

  • Credit card validation
  • Supports cards like VISA, Master card, Amex, Discover,Maestro,VisaElectron etc
  • Works on Expo and bare react-native projects
  • Cross-platform

Screenshots

App Screenshot

Props

inherits all React-native TextInput Props

PropTypeRequired
inputStyleTextStyleno
labelStyleTextStyleno
inputWrapStyleViewStyleno
cardInputContainerStyleViewStyleno
cardInputContainerStyleViewStyleno
errorColorstringno
labelColorstringno
focusColorstringno
defaultBorderColorstringno
placeholderstringno
errorstringno
touchedbooleanno
labelstringno
valuestringno
updateTextValfuncyes
updateCardDateTextfuncyes

Usage/Examples


import {useState} from "react";
import {KeyboardAvoidingView, Platform, StyleSheet, View} from 'react-native';
import {CardNumberTextInput, CardDateTextInput} from "../src/index";


export default function App() {
    const [cardValue, setCardValue] = useState('');
    const [focusCardNum, setFocusCardNum] = useState<boolean>(false);

    const [cardDateValue, setCardDateValue] = useState('');
    const [focusCardDateNum, setFocusCardDateNum] = useState<boolean>(false);


    const updateText = (cardNum: string) => {
        setCardValue(cardNum)
    }
    const updateCardDate = (cardNum: string) => {
        setCardDateValue(cardNum)
    }


    return (
        <View style={styles.container}>
            <KeyboardAvoidingView behavior={Platform.OS === "ios" ? "padding" : "height"} style={{
                width: '90%',
            }}>
                <CardNumberTextInput
                    autoFocus={true}
                    focus={focusCardNum}
                    onFocus={() => setFocusCardNum(true)}
                    onBlur={(e) => {
                        setFocusCardNum(false);
                    }}
                    label="Card number"
                    errorColor={"red"}
                    defaultBorderColor={"#ddd"}
                    inputWrapStyle={{
                        width:'100%',
                        height:60
                    }}
                    inputStyle={{
                        fontFamily: 'GT-medium',
                        color: '#333'
                    }}
                    defaultValue={cardValue}
                    focusColor={"blue"}
                    placeholder={"Credit card"}
                    updateTextVal={(text) => {
                        updateText(text)
                    }}/>

                <CardDateTextInput
                    errorColor={"red"}
                    labelColor={"#ddd"}
                    focusColor={"#1c32a0"}
                    defaultBorderColor={"#ddd"}
                    placeholder={"MM/YY"}
                    label={"Expiry date"}
                    focus={focusCardDateNum}
                    updateCardDateText={(t) => {
                        updateCardDate(t)
                    }}
                    onFocus={() => setFocusCardDateNum(true)}
                    labelStyle={{
                        color: '#333',
                        fontWeight: '400'
                    }}
                    inputWrapStyle={{
                        borderRadius: 10,
                        borderWidth: 1,

                    }}
                    placeholderTextColor={"#ccc"}
                    value={cardDateValue}
                    defaultValue={cardDateValue}
                    inputStyle={{
                        color: '#333',
                        fontWeight: 'bold',
                    }}/>


            </KeyboardAvoidingView>
        </View>
    );
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        width: '100%',
        backgroundColor: '#fff',
        alignItems: 'center',
        justifyContent: 'center',
    },
});


Keywords

FAQs

Package last updated on 27 Jan 2022

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