Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import { View, Text } from 'react-native';
  3. import { Card, CardItem, Button } from 'native-base';
  4.  
  5. class Training extends Component {
  6. //nuevo
  7. static navigationOptions = ({ navigation }) => {
  8. return {
  9. title: 'Repaso'
  10. }
  11.  
  12. };
  13. //nuevo
  14. constructor(props) {
  15. super(props);
  16. this.state = {
  17. currentIndex: 0,//<--nuevo
  18. cards: props.navigation.getParam('cards')//<--nuevo
  19. }
  20. }
  21. render() {
  22. console.log('cards tra : ' + JSON.stringify(this.state.cards))//<--para testear
  23. return (<View>
  24. <Card>
  25. <CardItem>
  26. <Text style={{ fontSize: 30 }}>
  27. {this.state.cards[this.state.currentIndex].value}
  28. </Text>
  29. </CardItem>
  30. </Card>
  31. <Button
  32. onPress={() => this.setState({
  33. currentIndex: this.state.currentIndex + 1
  34. })}
  35. disabled={
  36. this.state.currentIndex == this.state.cards.length - 1
  37. }
  38. >
  39. <Text>Siguiente</Text>
  40.  
  41. </Button>
  42. </View>);
  43. }
  44. }
  45.  
  46. export default Training;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement