1.0.3 • Published 4 years ago

react-native-text-input-material-swift-ui v1.0.3

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

react-native-text-input-material-swift-ui

A TextInput component customized to appear in material design on android e swift ui in ios

Installation

npm install react-native-text-input-material-swift-ui

Usage

Container

Creates a container for the screen and it will adapt the background color to the OS

import  *  as  React  from  'react'
   import { Container} from  "react-native-text-input-material-swift-ui"

   export  default () => {
    return (
	    <Container>
		    {/* Content of the form screen goes here */}
	    </Container>
	)
}

Props

KeyTypeDesctriprionExample
isDarkModebooleanif true the container uses the dark color schemeisDarkMode={true}
styleStyleSheetPropTypeallow to add styles to the ScrollView componentstyle={{paddingVertical: 35}}

TextInput

This componet is a standard React Native text input that will have different styles applied dipending on the OS: on an android device it will obey the matirial design guidelines and in ios it will obay the Swift UI guidelines.

import  *  as  React  from  'react'
import TextInput, { Container } from  "react-native-text-input-material-swift-ui"

export  default () => {
	// State
	const [nome, setNome] = React.useState('');
	
	return (
	    <Container>
		    <TextInput
				onChangeText={name => setName(name)}
				label='Name'
				defaultValue={name}
			/>
			{/* Other input components */}
	    </Container>
	)
}

Props

KeyTypeDesctriprionExample
isDarkModebooleanIf true the container uses the dark color schemeisDarkMode={true}
labelstringCreate a float label on android and an input placeholed in ioslabel='Name'
tintColorcolorThe color of the floating android labeltintColor='red'
fontFamilystringThe font of placeholder and labelfontFamily='open-sans-regular'
isFirstbooleanIf true provide the top border on the iOS inputisFirst={true}
isLastbooleanIf true provide the bottom border on the iOS inputisLast={tue}
stylesContainerStyleSheetPropTypeallow to add styles to the container View component on Androidstyle={{paddingBottom: 10}}
stylesLabelStyleSheetPropTypeallow to add styles to the label component on Androidstyle={{left: 10}}
styleStyleSheetPropTypeallow to add styles to the textInput componentstyle={{left: paddingBottom: 20}}

it also accept all the React Native TextInput props

InputGroupLabel

This is a label that can be used to divide groups of input. This will also fallow OS design guidelines.

import  *  as  React  from  'react'
import TextInput, { Container, InputGroupLabel } from  "react-native-text-input-material-swift-ui"

export  default () => {
	// State
	const [nome, setNome] = React.useState('');
	const [email, setEmail] = React.useState('');
	
	return (
	    <Container>
		    <InputGroupLabel isTop>
			    User information
			</InputGroupLabel>
		    <TextInput
				onChangeText={name => setName(name)}
				label='Name'
				defaultValue={name}
			/>
			<TextInput
				onChangeText={email => setEmail(email)}
				label='E-mail'
				defaultValue={email}
			/>
			{/* Other input groups */}
	    </Container>
	)
}

Props

KeyTypeDesctriprionExample
isDarkModebooleanIf true the container uses the dark color schemeisDarkMode={true}
fontFamilystringThe font of placeholder and labelfontFamily='open-sans-regular'
isTopbooleanif true set the top margin to 0fontFamily='open-sans-regular'
styleStyleSheetPropTypeallow to add styles to the label componentstyle={{left: paddingBottom: 20}}