Created
March 23, 2017 00:10
-
-
Save ssomnoremac/bb4d8e6ef242276ad777c8a904d1af83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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