Created
December 12, 2017 12:05
-
-
Save kawnayeen/21d97bb4bdd23047124040d6ac740082 to your computer and use it in GitHub Desktop.
Card and CardSection component
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 { View } from 'react-native'; | |
const Card = (props) => ( | |
<View style={styles.containerStyle}> | |
{props.children} | |
</View> | |
); | |
const styles = { | |
containerStyle: { | |
borderWidth: 1, | |
borderRadius: 2, | |
borderColor: '#ddd', | |
borderBottomWidth: 0, | |
shadowColor: '#000', | |
shadowOffset: { width: 0, height: 2 }, | |
shadowOpacity: 0.1, | |
shadowRadius: 2, | |
elevation: 1, | |
marginLeft: 5, | |
marginRight: 5, | |
marginTop: 10 | |
} | |
}; | |
export default Card; |
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 { View } from 'react-native'; | |
const CardSection = (props) => ( | |
<View style={[styles.containerStyle, props.style]}> | |
{props.children} | |
</View> | |
); | |
const styles = { | |
containerStyle: { | |
borderBottomWidth: 1, | |
padding: 5, | |
backgroundColor: '#fff', | |
justifyContent: 'flex-start', | |
flexDirection: 'row', | |
borderColor: '#ddd', | |
position: 'relative' | |
} | |
}; | |
export default CardSection; |
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
render() { | |
if (this.props.visible) { | |
return ( | |
<Card> | |
<CardSection> | |
<Text>Email</Text> | |
</CardSection> | |
<CardSection> | |
<Text>Password</Text> | |
</CardSection> | |
<CardSection> | |
<Text>Login Btn</Text> | |
</CardSection> | |
</Card> | |
); | |
} else { | |
return <View/>; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment