-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
174 lines (168 loc) · 4.1 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
169
170
171
172
173
174
import React, { Component } from "react";
import icon from "./assets/icon.png";
import blue from "./assets/blue.png";
import red from "./assets/red.png";
import green from "./assets/green.png";
import yellow from "./assets/yellow.png";
import {
View,
Text,
StyleSheet,
SafeAreaView,
ScrollView,
StatusBar,
Image,
ImageBackground,
} from "react-native";
import Carousel from "react-native-snap-carousel";
class App extends Component {
state = {
categories: [
{
id: 1,
name: "Tab 1",
},
{
id: 2,
name: "Tab 2",
},
{
id: 3,
name: "Tab 3",
},
{
id: 4,
name: "Tab 4",
},
{
id: 5,
name: "Tab 5",
},
],
cards: [
{
image: yellow,
id: 1,
title: "walking like a king down the hallways",
},
{
image: blue,
id: 2,
title: "blue oil paint",
},
{
image: green,
id: 3,
title: "green artist paint",
},
{
image: red,
id: 4,
title: "red blood",
},
],
};
_renderItem({ item, index }) {
return (
<View style={{ width: 300, height: 415 }}>
<ImageBackground
source={item.image}
style={styles.image}
imageStyle={{ borderRadius: 15 }}
resizeMode="cover"
></ImageBackground>
</View>
);
}
render() {
return (
<SafeAreaView style={{ flex: 1, backgroundColor: "white" }}>
<ScrollView
style={{ paddingTop: StatusBar.currentHeight, paddingHorizontal: 15 }}
>
<View style={{ paddinTop: 24 }}>
<View
style={{
paddingTop: 12,
flexDirection: "row",
justifyContent: "space-between",
}}
>
<Text style={{ fontSize: 20, fontWeight: "700" }}>
AWESOME PROJECT
</Text>
<View>
<Image
source={{
uri: "https://randomuser.me/api/portraits/thumb/men/24.jpg",
}}
style={{
height: 40,
width: 40,
borderRadius: 40 / 2,
borderColor: "red",
borderWidth: 2,
}}
/>
</View>
</View>
<ScrollView
scrollEnabled
showsHorizontalScrollIndicator={false}
horizontal
style={{ paddingTop: 30 }}
>
<View style={{ paddinTop: 10, flexDirection: "row" }}>
{this.state.categories.map((category) => (
<View
style={{
height: 32,
width: 89,
borderColor: "black",
borderRadius: 10,
borderWidth: 1,
justifyContent: "center",
alignItems: "center",
marginHorizontal: 5,
}}
>
<Text style={{ justifyContent: "center", fontSize: 17 }}>
{category.name}
</Text>
</View>
))}
</View>
</ScrollView>
<View style={{ paddingTop: 35 }}>
<View>
<Carousel
ref={(c) => {
this._carousel = c;
}}
renderItem={this._renderItem}
sliderWidth={350}
itemWidth={350}
layout={"stack"}
data={this.state.cards}
/>
</View>
</View>
</View>
</ScrollView>
</SafeAreaView>
);
}
}
export default App;
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
image: {
width: 292,
height: 411,
borderRadius: 15,
},
});