0.1.4 • Published 2 years ago

@computools/react-native-material-text-input v0.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@computools/react-native-material-text-input

npm version

Common material input for react native

Installation

npm install @computools/react-native-material-text-input
yarn add @computools/react-native-material-text-input

Usage

import * as React from 'react';
import { StyleSheet, View, Keyboard, TextInput } from 'react-native';
import {
  FilledTextInput,
  OutlinedTextInput,
} from '@computools/react-native-material-text-input';

export const App = () => {
  const usernameRef = React.useRef<TextInput>(null);
  const [email, setEmail] = React.useState('');
  const [username, setUsername] = React.useState('');

  return (
    <View onTouchStart={Keyboard.dismiss} style={styles.container}>
      <FilledTextInput
        label="Email"
        autoFocus
        value={email}
        onChangeText={setEmail}
        onSubmitEditing={() => usernameRef.current.focus()}
      />
      <OutlinedTextInput
        label="Username"
        ref={usernameRef}
        containerStyle={{ backgroundColor: styles.container.backgroundColor }}
        value={username}
        onChangeText={setUsername}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: '#FFFFFF',
  },
});

Example

Snapshot

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

0.1.4

2 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago