All Projects → esbenp → React Native Clean Form

esbenp / React Native Clean Form

Licence: mit
Easy react-native forms using bootstrap-like syntax with redux-form+immutablejs integration. Styled using styled-components

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Clean Form

Typescript Plugin Styled Components
TypeScript transformer for improving the debugging experience of styled-components
Stars: ✭ 330 (-29.49%)
Mutual labels:  styled-components
Css In Js Benchmarks
Stars: ✭ 360 (-23.08%)
Mutual labels:  styled-components
Styled Breakpoints
Simple and powerful tool for creating breakpoints in styled components and emotion. 💅
Stars: ✭ 428 (-8.55%)
Mutual labels:  styled-components
Rock Paper Scissors React
Challenge #5 from Frontend Mentor
Stars: ✭ 339 (-27.56%)
Mutual labels:  styled-components
React Stripe Menu
A clone of Stripe's animated menu using React, Styled Components and React-Flip-Toolkit
Stars: ✭ 352 (-24.79%)
Mutual labels:  styled-components
Mxstbr.com
The source for my personal website
Stars: ✭ 370 (-20.94%)
Mutual labels:  styled-components
Styled Reset
Eric Meyer's Reset CSS for styled-components
Stars: ✭ 305 (-34.83%)
Mutual labels:  styled-components
React Firebase Starter
Boilerplate (seed) project for creating web apps with React.js, GraphQL.js and Relay
Stars: ✭ 4,366 (+832.91%)
Mutual labels:  styled-components
Rimble Ui
React components that implement Rimble's Design System.
Stars: ✭ 357 (-23.72%)
Mutual labels:  styled-components
Styled Normalize
normalize.css for styled-components
Stars: ✭ 391 (-16.45%)
Mutual labels:  styled-components
Webstorm Styled Components
styled-components highlighting support in IntelliJ editors
Stars: ✭ 342 (-26.92%)
Mutual labels:  styled-components
Handycontrols
Contains some simple and commonly used WPF controls based on HandyControl
Stars: ✭ 347 (-25.85%)
Mutual labels:  styled-components
Glamorous
DEPRECATED: 💄 Maintainable CSS with React
Stars: ✭ 3,681 (+686.54%)
Mutual labels:  styled-components
File System React
File System UI in Web using react
Stars: ✭ 331 (-29.27%)
Mutual labels:  styled-components
Simple Trello
📋
Stars: ✭ 431 (-7.91%)
Mutual labels:  styled-components
Coderplanets web
the most sexiest community for developers, build with React, Mobx/MST, GraphQL, Styled-Components, Rxjs, Ramda ... and ❤️
Stars: ✭ 314 (-32.91%)
Mutual labels:  styled-components
Revalidate
Elegant and composable validations
Stars: ✭ 363 (-22.44%)
Mutual labels:  redux-form
Design System Utils
👩‍🎨 Access your design tokens with ease
Stars: ✭ 465 (-0.64%)
Mutual labels:  styled-components
React95
🌈🕹 Refreshed Windows 95 style UI components for your React app
Stars: ✭ 4,877 (+942.09%)
Mutual labels:  styled-components
Twin.macro
🦹‍♂️ Twin blends the magic of Tailwind with the flexibility of css-in-js (emotion, styled-components, stitches and goober) at build time.
Stars: ✭ 5,137 (+997.65%)
Mutual labels:  styled-components

react-native-clean-form

npm Dependency Status devDependency Status

Easy react-native forms using bootstrap-like syntax with redux-form+immutablejs integration. Styled using styled-components

Big kudos to Artyom Khamitov

The look of the form was inspired by this shot by Artyom Khamitov. Check out his profile on Dribbble.

















Installation

Run npm install --save react-native-clean-form

The form uses react-native-vector-icons so it is important the fonts are linked by using react-native link or one of the other options available.

Example

I have written an article on my blog about React Native and redux-form

For a complete example check out the example folder

Usage

import {
  ActionsContainer,
  Button,
  FieldsContainer,
  Fieldset,
  Form,
  FormGroup,
  Input,
  Label,
  Switch
} from 'react-native-clean-form'

const FormView = props => (
  <Form>
    <FieldsContainer>
      <Fieldset label="Contact details">
        <FormGroup>
          <Label>First name</Label>
          <Input placeholder="Esben" onChangeText={this.onFirstNameChange} />
        </FormGroup>
        <FormGroup>
          <Label>Email</Label>
          <Input placeholder="[email protected]" onChangeText={this.onEmailChange} />
        </FormGroup>
      </Fieldset>
      <Fieldset label="Password" last>
        <FormGroup>
          <Label>Password</Label>
          <Input placeholder="Enter a password" onChangeText={this.onPasswordChange} />
        </FormGroup>
        <FormGroup>
          <Label>Repeat password</Label>
          <Input placeholder="Repeat your password" onChangeText={this.onRepeatPasswordChange} />
        </FormGroup>
        <FormGroup border={false}>
          <Label>Save my password</Label>
          <Switch onValueChange={this.toggleSaveMyPassword} />
        </FormGroup>     
      </Fieldset>
    </FieldsContainer>
    <ActionsContainer>
      <Button icon="md-checkmark" iconPlacement="right" onPress={this.save}>Save</Button>
    </ActionsContainer>
  </Form>
)

Usage with redux-form

import React from 'react'
import { reduxForm } from 'redux-form'
import {
  ActionsContainer,
  Button,
  FieldsContainer,
  Fieldset,
  Form,
  FormGroup,
  Label,
} from 'react-native-clean-form'
import {
  Input,
  Switch
} from 'react-native-clean-form/redux-form'
import { View,Text } from 'react-native'

const onSubmit = (values, dispatch) => {
  return new Promise((resolve) => {
    setTimeout(() => {
      console.log(values)
      resolve()
    }, 1500)
  })
}

const FormView = props => {
  const { handleSubmit, submitting } = this.props

  return (
    <Form>
      <FieldsContainer>
        <Fieldset label="Contact details">
          <Input name="first_name" label="First name" placeholder="John" />
          <Input name="email" label="Email" placeholder="[email protected]" />
        </Fieldset>
        <Fieldset label="Shipping details" last>
          <Input name="password" label="Address" placeholder="Hejrevej 33" />
          <Input name="password_repeat" label="City" placeholder="Copenhagen" />
          <Switch label="Save my details" border={false} name="save_details" />
        </Fieldset>
      </FieldsContainer>
      <ActionsContainer>
        <Button icon="md-checkmark" iconPlacement="right" onPress={handleSubmit(onSubmit)} submitting={submitting}>Save</Button>
      </ActionsContainer>
    </Form>
  )
}

export default reduxForm({
  form: 'Form'
})(FormView)

Usage with redux-form and Immutable.js

To make it work with Immutable.js import Input, Select, and Switch from react-native-clean-form/redux-form-immutable instead of react-native-clean-form/redux-form. Also, check out the included example

Validation

If integrating with redux-form validation is supported right out of the box. Just add a validation key to reduxForm your normally would.

If not using redux-form, there is an error prop on FormGroup which will display the error if used.





Async feedback

The Button component has a submitting prop. If true, a spinner will be displayed.





Run the example

Clone the repo first.

git clone https://github.com/esbenp/react-native-clean-form && cd react-native-clean-form

Install dependencies.

cd example
npm install

Run the simulator.

react-native run-ios
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].