/
temp.js
110 lines (97 loc) · 2.37 KB
/
temp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import SwipeCards from './SwipeCards.js'
import { StatusBar } from 'expo-status-bar'
import { StyleSheet, Text, View } from 'react-native'
import FlipCard from 'react-native-flip-card'
class Card extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
)
}
}
class NoMoreCards extends Component {
constructor(props) {
super(props);
}
render() {
return (
<View>
<Text style={styles.noMoreCardsText}>No more cards</Text>
</View>
)
}
}
export default class extends React.Component {
constructor(props) {
super(props);
this.state = {
cards: [
{text: 'Tomato', backgroundColor: 'red'},
{text: 'Aubergine', backgroundColor: 'purple'},
{text: 'Courgette', backgroundColor: 'green'},
{text: 'Blueberry', backgroundColor: 'blue'},
{text: 'Umm...', backgroundColor: 'cyan'},
{text: 'orange', backgroundColor: 'orange'},
]
};
}
handleYup (card) {
console.log(`Yup for ${card.text}`)
}
handleNope (card) {
console.log(`Nope for ${card.text}`)
}
handleMaybe (card) {
console.log(`Maybe for ${card.text}`)
}
render() {
// If you want a stack of cards instead of one-per-one view, activate stack mode
// stack={true}
return (
<SwipeCards
cards={this.state.cards}
renderCard={(cardData) => <Card {...cardData} />}
renderNoMoreCards={() => <NoMoreCards />}
handleYup={this.handleYup}
handleNope={this.handleNope}
handleMaybe={this.handleMaybe}
hasMaybeAction
/>
)
}
}
const styles = StyleSheet.create({
cardContent: {
height: '100%',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center'
},
cardText:{
fontSize:32,
},
face: {
marginTop: 20,
backgroundColor: 'white',
borderWidth: 1,
borderColor: '#ccccc',
borderRadius: 16,
},
back: {
marginTop: 20,
backgroundColor: 'white',
borderWidth: 1,
borderColor: '#ccccc',
borderRadius: 16,
},
container: {
paddingVertical: 50,
paddingHorizontal: 16,
backgroundColor: '#edf8ff',
flex: 1,
flexDirection: 'column',
justifyContent: 'flex-start',
},
});