Skip to content

Instantly share code, notes, and snippets.

@gHashTag
Last active October 17, 2019 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gHashTag/4a152da47b6150d3e39d8e6ead03dc17 to your computer and use it in GitHub Desktop.
Save gHashTag/4a152da47b6150d3e39d8e6ead03dc17 to your computer and use it in GitHub Desktop.
import React, { memo } from 'react'
import { StyleSheet, TextInput, KeyboardAvoidingView } from 'react-native'
const styles = StyleSheet.create({
container: {
width: 300,
height: 50,
margin: 5,
backgroundColor: '#ddd'
}
})
const Input = memo(({ value, placeholder, secureTextEntry, onChange, autoCapitalize = '' }) => {
const { container } = styles
return (
<KeyboardAvoidingView behavior="padding">
<TextInput
placeholder={placeholder}
value={value}
autoCapitalize={autoCapitalize}
style={container}
secureTextEntry={secureTextEntry}
onChangeText={text => onChange(text)}
/>
</KeyboardAvoidingView>
)
})
export { Input }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment