From e2a8d1309b7988196cf14642c50bfc2b149a80e8 Mon Sep 17 00:00:00 2001 From: amir Date: Fri, 30 Nov 2018 00:37:51 +0500 Subject: [PATCH] Added sample deck card --- App.js | 68 +++++++++++++++++++------------------ Components/Button/Button.js | 30 ++++++++++++++++ Components/Button/index.js | 1 + Components/Card/Card.js | 30 ++++++++++++++++ Components/Card/index.js | 1 + Components/Swiper/Swiper.js | 32 +++++++++++++++++ Components/Swiper/index.js | 1 + package.json | 5 +-- yarn.lock | 15 ++++++++ 9 files changed, 148 insertions(+), 35 deletions(-) create mode 100644 Components/Button/Button.js create mode 100644 Components/Button/index.js create mode 100644 Components/Card/Card.js create mode 100644 Components/Card/index.js create mode 100644 Components/Swiper/Swiper.js create mode 100644 Components/Swiper/index.js diff --git a/App.js b/App.js index 171d0f0..70ad4f2 100644 --- a/App.js +++ b/App.js @@ -1,29 +1,42 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - * - * @format - * @flow - */ - import React, {Component} from 'react'; -import {Platform, StyleSheet, Text, View} from 'react-native'; +import Swiper from './Components/Swiper' +import {StyleSheet, View} from 'react-native'; -const instructions = Platform.select({ - ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', - android: - 'Double tap R on your keyboard to reload,\n' + - 'Shake or press menu button for dev menu', -}); +import Button from './Components/Button' + + +export default class App extends Component { + state = { + cards: [ + '1', + '2', + '3', + '4', + '5', + ], + }; + + handleChange = (cardIndex) => { + console.log('CardChanged', cardIndex) + }; + + resetDeck = () => { + this.swiper.resetDeck() + }; -type Props = {}; -export default class App extends Component { render() { + const { cards } = this.state; + return ( - Welcome to React Native! - To get started, edit App.js - {instructions} + { + this.swiper = swiper + }} + cards={cards} + onChange={this.handleChange} + /> +