Created
July 4, 2019 01:50
-
-
Save lrlineroa/615fcd1cae20b7271c0edc4eb1a68303 to your computer and use it in GitHub Desktop.
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, { Component } from 'react'; | |
import { View, Text } from 'react-native'; | |
import { Card, CardItem, Button } from 'native-base'; | |
class Training extends Component { | |
//nuevo | |
static navigationOptions = ({ navigation }) => { | |
return { | |
title: 'Repaso' | |
} | |
}; | |
//nuevo | |
constructor(props) { | |
super(props); | |
this.state = { | |
currentIndex: 0,//<--nuevo | |
cards: props.navigation.getParam('cards')//<--nuevo | |
} | |
} | |
render() { | |
console.log('cards tra : ' + JSON.stringify(this.state.cards))//<--para testear | |
return (<View> | |
<Card> | |
<CardItem> | |
<Text style={{ fontSize: 30 }}> | |
{this.state.cards[this.state.currentIndex].value} | |
</Text> | |
</CardItem> | |
</Card> | |
<Button | |
onPress={() => this.setState({ | |
currentIndex: this.state.currentIndex + 1 | |
})} | |
disabled={ | |
this.state.currentIndex == this.state.cards.length - 1 | |
} | |
> | |
<Text>Siguiente</Text> | |
</Button> | |
</View>); | |
} | |
} | |
export default Training; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment