1.0.20 • Published 4 years ago

react-native-chainable v1.0.20

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

react-native-chainable

Chain through your React Native forms with ease

Installation

npm i react-native-chainable

Usage

class SignUpScreen extends Component {
  // ...

  render() {
    return (
      <Chainable>
        {(chain) => (
          <>
            <Chainable.Input
              value={this.state.email}
              onChangeText={(text) => this.setState({ email: text })}
              onSubmitEditing={() => chain('password')}
            />
            <Chainable.Input
              value={this.state.password}
              onChangeText={(text) => this.setState({ password: text })}
              secureTextEntry
              onSubmitEditing={() => chain('confirm')}
              name="password"
            />
            <Chainable.Input
              value={this.state.confirm}
              onChangeText={(text) => this.setState({ confirm: text })}
              secureTextEntry
              name="confirm"
              isLast
            />
          </>
        )}
      </Chainable>
    );
  }
}

API

Chainable

Render prop (function as children)

The function you pass as a child will be called with a function that allows you to chain to (i.e. set focus on) the next input by name

TypeDescription
(name: string) => voidFunction to chain to the next input by name

Chainable.Input

Props

NameTypeDescription
namestring (optional)A name for the input
isLastboolean (optional, defaults to false)When true, the input should be considered as the last one
1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.0.6

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago