Skip to content

Instantly share code, notes, and snippets.

@ssomnoremac
Last active March 23, 2017 01:50
Show Gist options
  • Save ssomnoremac/33d51f42debc4b139d9c3b8fbabd26eb to your computer and use it in GitHub Desktop.
Save ssomnoremac/33d51f42debc4b139d9c3b8fbabd26eb to your computer and use it in GitHub Desktop.
import React from 'react'
import { TextInput, View } from 'react-native'
import theme from './theme'
const Input = (props) => (
const styles = {
inlineWrapper: {
flex: inlineLabel ? .5 : 1,
height: inlineLabel ? theme.FormGroup.height - theme.FormGroup.borderWidth*2 : theme.FormGroup.height,
},
input: {
color: theme.Input.color,
fontSize: theme.BaseInput.fontSize,
height: inlineLabel ? theme.FormGroup.height - theme.FormGroup.borderWidth*2 : theme.FormGroup.height,
lineHeight: inlineLabel ? theme.FormGroup.height - theme.FormGroup.borderWidth*2 : theme.FormGroup.height,
}
}
return(
<View style={styles.inlineWrapper} inlineLabel={props.inlineLabel}>
<TextInput
style={styles.input}
inlineLabel={props.inlineLabel}
placeholderTextColor={theme.BaseInput.placeholderColor}
{...props}
/>
</View>
)
)
Input.PropTypes = {
inlineLabel: React.PropTypes.bool.isRequired
}
Input.defaultProps = {
inlineLabel: true,
}
export default Input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment