diff --git a/package.json b/package.json index 3e39fe9..8340c09 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "dependencies": { "react": "16.0.0-alpha.12", "react-native": "0.47.0", - "react-native-deck-swiper": "^1.3.8" + "react-native-deck-swiper": "^1.3.8", + "react-native-progress": "^3.4.0" }, "devDependencies": { "babel-jest": "21.0.2", diff --git a/src/components/LessonItem.js b/src/components/LessonItem.js index 167999e..e1a7210 100644 --- a/src/components/LessonItem.js +++ b/src/components/LessonItem.js @@ -1,6 +1,7 @@ import React from 'react'; import { View, Text, Image } from 'react-native'; import Swiper from 'react-native-deck-swiper'; +import * as Progress from 'react-native-progress'; const renderCard = (card) => { return ( @@ -14,25 +15,68 @@ const renderCard = (card) => { ) } -const LessonItem = ({cards}) => { - const {defaultStyle} = styles; +export default class LessonItem extends React.Component { + constructor (props) { + super(props) + this.state = { + cardIndex: 0 + } + } - return ( - - - + render () { + const {cards} = this.props + const {defaultStyle} = styles; + + const onSwiped = (index) => { + this.setState({ + cardIndex: index + 1 + }) + } + + const progress = this.state.cardIndex > 0 ? this.state.cardIndex / cards.length : 0 + return ( + + + + + + + + + + - ); -}; + ); + } +} const styles = { + + top: { + flexDirection: 'column', + backgroundColor: '#7270a8', + flex: 1 + }, defaultStyle: { flexDirection: 'column', justifyContent: 'center', @@ -56,5 +100,3 @@ const styles = { lineHeight: 18 }, }; - -export default LessonItem;