Socket
Socket
Sign inDemoInstall

react-native-form-inputs

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-form-inputs

Status : Pending work with defining style object structure # 📜React Native Inputs A customisable input library to quickly build complex forms in React Native ## Install ```npm install react-native-inputs``` ## Usage ```import { ParentComponent, Fie


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Install size
638 kB
Created
Weekly downloads
 

Readme

Source

Status : Pending work with defining style object structure

📜React Native Inputs

A customisable input library to quickly build complex forms in React Native

Install

npm install react-native-inputs

Usage

import { ParentComponent, FieldInput, DatePickerInput, OptionInput } from ‘react-native-inputs’;

Passing text props and state handling

These components are built with the Formik API in mind and we recommend they are used as such. Support for other form-related APIs is more than welcome, just submit a PR! A short example for the formik-based use cases

<FieldInput 
    label="Email" 
    value={formik.values.email} 
    onChangeText={formik.handleChange('email')} 
    />
<FieldInput 
    label="First name" 
    value={formik.values.firstName} 
    onChangeText={formik.handleChange('firstName')} 
    />
<FieldInput 
    label="Last name" 
    value={formik.values.lastName} 
    onChangeText={formik.handleChange('lastName')} 
    />
<FieldInput 
    label="Phone number" 
    value={formik.values.phoneNumber} 
    editable={false}  
    inputStyle={{ marginBottom: 0 }} />
<DateTimeInput 
    value={formik.values.birthdate} 
    onChangeValue={handleChange('birthdate')}
      />
<OptionInput
        value={formik.values.relationship}
        label="Relationship"
        extraNote="(optional)"
        onChangeValue={handleChange('relationship')}
        options={relationshipOptions}
      />

Styling via Context

This library implements styles through the React Context API. Any component you want to provide custom styles to should be a child component of a <ParentComponent value={customStyleObject}> with the customStyleObject attribute fed to the value prop.

The components will catch style attributes only meant for them, for eg. if we want to style the a FieldInput instance

    <ParentComponent value={{fieldInputStyle:{ fontSize : 20}}>
         <FieldInput
            onBlur={onFocusChange('email', false)}
            onFocus={onFocusChange('email', true)}
            placeholder={'Email'}
            value={formik.values.email}
            keyboardType="email-address"
            autoCapitalize="none"
            autoCorrect={false}
            returnKeyType="go"
            contextMenuHidden
            onSubmitEditing={() => passwordInputRef.current.focus()}
            onChangeText={formik.handleChange('email')}
            label={'Email'}
            editable={!formik.isSubmitting}>
    </ParentComponent>

Keywords

FAQs

Last updated on 30 Nov 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc