diff --git a/src/components/Card.js b/src/components/Card.js index 62ed520..03937b2 100644 --- a/src/components/Card.js +++ b/src/components/Card.js @@ -3,6 +3,7 @@ import { Text, Image, StyleSheet, + TouchableOpacity, View } from 'react-native'; @@ -11,7 +12,8 @@ const defaultProps = { subTitle: '', image: '', imagePosition: 'left', - backgroundColor: 'rgb(238, 219, 214)' + backgroundColor: 'rgb(238, 219, 214)', + onPress: () => {}, }; const propTypes = { @@ -19,6 +21,7 @@ const propTypes = { image: PropTypes.object, subTitle: PropTypes.string, imagePosition: PropTypes.string, + onPress: PropTypes.func, }; const styles = StyleSheet.create({ @@ -55,13 +58,16 @@ const styles = StyleSheet.create({ const Card = (props) => { let flexDirection = props.imagePosition === 'left' ? 'row' : 'row-reverse'; return( - + {props.title} {props.subTitle} - + ); } diff --git a/src/containers/Detail.js b/src/containers/Detail.js new file mode 100644 index 0000000..cf21c3f --- /dev/null +++ b/src/containers/Detail.js @@ -0,0 +1,25 @@ +import React, { Component, PropTypes } from 'react'; +import { + StyleSheet, + View, +} from 'react-native'; +import Card from '../components/Card' + +const styles = StyleSheet.create({ + container: { + paddingTop: 64, + flex: 1, + }, +}); + +export default class Detail extends Component { + static propTypes = {}; + + render() { + return ( + + + + ); + } +} diff --git a/src/containers/Home.js b/src/containers/Home.js index 104ae76..0ac0a5a 100644 --- a/src/containers/Home.js +++ b/src/containers/Home.js @@ -3,10 +3,11 @@ import { StyleSheet, Text, View, + ListView, } from 'react-native'; import Banner from '../components/Banner' import Card from '../components/Card' - +import { Actions } from 'react-native-router-flux'; const styles = StyleSheet.create({ container: { paddingTop: 64, @@ -27,23 +28,51 @@ const ad = [{ textPosition: 'topLeft', }]; -export default class Login extends Component { +const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }); +const dataSource = ds.cloneWithRows([{ + title: 'Beautiful wave', + subTitle: 'Curated looks for creatives, pioneers, and individuals!', + image: { uri: 'https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/AOOC3CJARN.jpg' }, + backgroundColor: '#fff', +}, { + title: 'Beautiful wave', + subTitle: 'Curated looks for creatives, pioneers, and individuals!', + image: { uri: 'https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/B23METEB9K.jpg' }, + imagePosition: 'right', +}, { + title: 'Beautiful wave', + subTitle: 'Curated looks for creatives, pioneers, and individuals!', + image: { uri: 'https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/AOOC3CJARN.jpg' }, + backgroundColor: '#fff', +}, { + title: 'Beautiful wave', + subTitle: 'Curated looks for creatives, pioneers, and individuals!', + image: { uri: 'https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/B23METEB9K.jpg' }, +}, { + title: 'Beautiful wave', + subTitle: 'Curated looks for creatives, pioneers, and individuals!', + image: { uri: 'https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/AOOC3CJARN.jpg' }, + backgroundColor: '#fff', +}, { + title: 'Beautiful wave', + subTitle: 'Curated looks for creatives, pioneers, and individuals!', + image: { uri: 'https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/B23METEB9K.jpg' }, +}]); + +export default class Home extends Component { static propTypes = {}; + render() { return ( - - Actions.cardDetail({ ...rowData })} + />} /> ); diff --git a/src/containers/Router.js b/src/containers/Router.js index c12f66b..1945bcb 100644 --- a/src/containers/Router.js +++ b/src/containers/Router.js @@ -3,6 +3,7 @@ import { Router, Scene } from 'react-native-router-flux'; import { connect } from 'react-redux'; import Login from './Login'; import Home from './Home'; +import Detail from './Detail'; const RouterWithRedux = connect()(Router); @@ -11,8 +12,9 @@ export default class AppRoute extends React.Component { return ( - - + + + );