Skip to content

Instantly share code, notes, and snippets.

@ssomnoremac
Created March 23, 2017 00:10
Show Gist options
  • Save ssomnoremac/bb4d8e6ef242276ad777c8a904d1af83 to your computer and use it in GitHub Desktop.
Save ssomnoremac/bb4d8e6ef242276ad777c8a904d1af83 to your computer and use it in GitHub Desktop.
import React from 'react'
import { TextInput, View } from 'react-native'
import defaultTheme from './theme'
const Input = ({inlineLabel}) => (
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={props.theme.BaseInput.placeholderColor}
{...props}
/>
</View>
)
)
Input.PropTypes = {
inlineLabel: React.PropTypes.bool.isRequired
}
Input.defaultProps = {
inlineLabel: true,
theme: defaultTheme
}
export default Input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment