-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
74 lines (65 loc) · 1.67 KB
/
main.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
import Expo from 'expo';
import React, { Component } from 'react';
import { StyleSheet, Text, View, TouchableHighlight } from 'react-native';
import { Card, Button } from 'react-native-elements';
import Deck from './src/Deck';
// Dummy array of card items for testing.
const CARDDATA = [
{ id: 1, text: '#1', uri: 'https://unsplash.com/?photo=5EVrQKXPa5g' },
{ id: 2, text: '#2', uri: 'https://unsplash.com/?photo=2h_i_BB_X2E' },
// { id: 3, text: '#3', uri: 'https://unsplash.com/?photo=DxAV6se7QPM' },
// { id: 4, text: '#4', uri: 'https://unsplash.com/?photo=trvP9JiYC1E' }
];
class App extends Component {
renderCard(item, color) {
const { id, text, uri } = item;
return (
<Card
key={id}
containerStyle={{ borderRadius: 10 }}
title={text}
image={{ uri }}
>
<Button
icon={{ name: 'autorenew'}}
backgroundColor="#03A9F4"
title="Button"
/>
</Card>
);
}
renderNoMoreCards() {
return (
<Card
title="No More Cards"
containerStyle={{ borderRadius: 10 }}
>
<Text style={{ marginBottom: 10 }}>
We are all done here!
</Text>
<Button
backgroundColor="#03A9F4"
title="Show More"
/>
</Card>
);
}
render() {
return (
<View style={styles.container}>
<Deck
cardData={CARDDATA}
renderCard={this.renderCard}
renderNoMoreCards={this.renderNoMoreCards}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff'
}
});
Expo.registerRootComponent(App);