Skip to content

Latest commit

 

History

History
executable file
·
173 lines (166 loc) · 6.5 KB

Form.md

File metadata and controls

executable file
·
173 lines (166 loc) · 6.5 KB

Form

NativeBase makes use of List to design Forms that include group of related input components. Include any combination of NativeBase components to make up your form.
Input is a NativeBase component built on top of React Native's TextInput. Item component is wrap around it apply the specific styles.
A foundational component for inputting text into the app via a keyboard. Props provide configurability for several features, such as auto-correction, auto-capitalization, placeholder text, and different keyboard types, such as a numeric keypad.
Provides a number of attributes that follows styling and interaction guidelines for each platform, so that they are intuitive for users to interact with.
Replacing Component:

Contents:

Preview ios Form Preview android Form

Syntax

import React, { Component } from 'react';
import { Container, Header, Content, Form, Item, Input } from 'native-base';
export default class FormExample extends Component {
  render() {
    return (
      <Container>
        <Header />
        <Content>
          <Form>
            <Item>
              <Input placeholder="Username" />
            </Item>
            <Item last>
              <Input placeholder="Password" />
            </Item>
          </Form>
        </Content>
      </Container>
    );
  }
}

Configuration

Property Default Option Description
fixedLabel true boolean Label is Fixed to the left of the Input and does not hide when text is entered.
floatingLabel true boolean Label that animates upwards when the input is selected and animates downward when input is erased.
inlineLabel - boolean Label placed to the left of the input element. When the user enters text, the label does not hide. This can also be used along with placeholder.
stackedLabel - - Places the label on top of the input element which appears like a stack. This can also be used along with placeholder.
bordered - - Includes border with the textbox.
rounded - - Includes rounded border with the textbox.
underline true - Includes underline border with the textbox.
disabled - - Disables inputting data.
placeholderLabel - - Renders the same way the TextInput does with the form styling of NativeBase.
placeholder - - The string that will be rendered before text input has been entered. Optional user-defined placeholder for textbox.
last - - Style the Form Item for the last Item of the Form.
error - - The border color of textbox for invalid input.
success - - The border color of textbox for valid input.

**Note:** Form in NativeBase is just a wrapper around the inputs and hence has no onSubmit function.