Skip to content

Instantly share code, notes, and snippets.

@kawnayeen
Created December 12, 2017 12:05
Show Gist options
  • Save kawnayeen/21d97bb4bdd23047124040d6ac740082 to your computer and use it in GitHub Desktop.
Save kawnayeen/21d97bb4bdd23047124040d6ac740082 to your computer and use it in GitHub Desktop.
Card and CardSection component
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;
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;
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