-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
168 lines (154 loc) · 4.31 KB
/
App.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/* @flow */
import React, { Component } from 'react';
import {
Alert,
ScrollView,
StyleSheet,
View,
Text,
} from 'react-native';
import {
Card,
Icon,
} from 'react-native-material-design';
import CardMedia from 'react-native-card-media';
const path = 'https://raw.githubusercontent.com/dondoko-susumu/react-native-card-media-example/master/media/';
const files1 = [
`${path}kids_play_640.jpeg`,
];
const files2 = [
`${path}kids_play_640.jpeg`,
`${path}sea_kids_640.jpeg`,
];
const files3 = [
`${path}kids_play_640.jpeg`,
`${path}temple_640.jpeg`,
`${path}road_640.jpg`,
];
const files4 = [
`${path}kids_play_640.jpeg`,
`${path}road_640.jpg`,
`${path}women_640.jpeg`,
`${path}sea_kids_640.jpeg`,
];
const files5 = [
`${path}kids_play_640.jpeg`,
`${path}road_640.jpg`,
`${path}women_640.jpeg`,
`${path}sea_kids_640.jpeg`,
`${path}temple_640.jpeg`,
];
export default class App extends Component<{}> {
onPress() {
Alert.alert('onPress');
}
renderImageIconView() {
return (
<Icon
name="image"
color="#fafafa"
size={24}
style={{ top: 6 }}
/>
);
}
render() {
return (
<View style={styles.scene}>
<ScrollView>
<View style={styles.container}>
<Card style={styles.cardStyle}>
<CardMedia
style={{ height: 200 }}
title="Title"
titleStyle={{ fontSize: 24, fontWeight: '400', lineHeight: 32, color: '#fafafa' }}
files={files1}
onPress={() => this.onPress()}
/>
<Card.Body>
<Text>
Multiple image component for React Native
</Text>
</Card.Body>
</Card>
<Card style={styles.cardStyle}>
<CardMedia
style={{ height: 200 }}
title="Title"
titleStyle={{ fontSize: 24, fontWeight: '400', lineHeight: 32, color: '#fafafa' }}
files={files2}
onPress={() => this.onPress()}
titleTouchable={false}
imageTouchable={false}
/>
<Card.Body>
<Text>
disabled titleTouchable & imageTouchable
</Text>
</Card.Body>
</Card>
<Card style={styles.cardStyle}>
<CardMedia
style={{ height: 200 }}
title="Title"
titleStyle={{ fontSize: 24, fontWeight: '400', lineHeight: 32, color: '#fafafa' }}
files={files3}
onPress={() => this.onPress()}
imageTouchable={false}
/>
<Card.Body>
<Text>
disabled imageTouchable.
</Text>
</Card.Body>
</Card>
<Card style={styles.cardStyle}>
<CardMedia
style={{ height: 200 }}
title="Title"
titleStyle={{ fontSize: 24, fontWeight: '400', lineHeight: 32, color: '#fafafa' }}
files={files4}
onPress={() => this.onPress()}
/>
<Card.Body>
<Text>
Multiple image component for React Native
</Text>
</Card.Body>
</Card>
<Card style={styles.cardStyle}>
<CardMedia
style={{ height: 200 }}
title="Title"
titleStyle={{ fontSize: 24, fontWeight: '400', lineHeight: 32, color: '#fafafa' }}
files={files5}
onPress={() => this.onPress()}
imageIconView={this.renderImageIconView}
imageCountStyle={{ fontSize: 20, fontWeight: '500', lineHeight: 28, color: '#fafafa' }}
/>
<Card.Body>
<Text>
Multiple image component for React Native.
</Text>
</Card.Body>
</Card>
</View>
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
scene: {
marginTop: 20,
},
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
cardStyle: {
width: 320,
},
});