-
Notifications
You must be signed in to change notification settings - Fork 198
/
Copy pathSearchScreen.js
196 lines (188 loc) · 5.45 KB
/
SearchScreen.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/* eslint-disable react/display-name */
import React from "react";
import { Image, View, StatusBar, TouchableOpacity, ScrollView, FlatList } from "react-native";
import LargeHeading from "../components/LargeHeading";
import HorizontalScrollFeed from "../components/HorizontalScrollFeed";
import { Avatar, UserCard } from "expo-activity-feed";
import GroupCard from "../components/GroupCard";
import SearchBox from "../components/SearchBox";
import PostIcon from "../images/icons/post.png";
export const navigationOptions = ({ navigation }) => ({
title: "DISCOVER",
headerTitleStyle: {
fontWeight: "500",
fontSize: 13
},
headerLeft: () => (
<View style={{ paddingLeft: 15 }}>
<Image
source={require("../images/icons/categories.png")}
style={{ width: 23, height: 23 }}
/>
</View>
),
headerRight: () => (
<TouchableOpacity
onPress={() => navigation.navigate("NewPost")}
style={{ paddingRight: 15 }}
>
<Image source={PostIcon} style={{ width: 23, height: 23 }} />
</TouchableOpacity>
)
});
// TODO: Convert to FC
export default class SearchScreen extends React.Component {
constructor(props) {
super(props);
this.state = {
interestingUsers: [
{
id: 1235,
user_image: "https://randomuser.me/api/portraits/women/65.jpg"
},
{
id: 2345,
user_image: "https://randomuser.me/api/portraits/men/24.jpg"
},
{
id: 3456,
user_image: "https://randomuser.me/api/portraits/women/45.jpg"
},
{
id: 4567,
user_image: "https://randomuser.me/api/portraits/men/45.jpg"
},
{
id: 6789,
user_image: "https://randomuser.me/api/portraits/women/23.jpg"
},
{
id: 7890,
user_image: "https://randomuser.me/api/portraits/men/67.jpg"
},
{
id: 2456,
user_image: "https://randomuser.me/api/portraits/women/12.jpg"
}
],
trendingGroups: [
{
id: 1234,
name: "Beer",
image:
"https://cdn.britannica.com/700x450/72/186972-049-26ACDCBE.jpg",
icon: ""
},
{
id: 2345,
name: "Arcade",
image: "http://www.thebasementarcade.com/gameroom/0516/1.jpg",
icon: ""
},
{
id: 3456,
name: "Nature",
image:
"https://images.pexels.com/photos/459225/pexels-photo-459225.jpeg?auto=compress&cs=tinysrgb&h=350",
icon: ""
},
{ id: 4567, image: "", icon: "" },
{ id: 6789, image: "", icon: "" },
{ id: 7890, image: "", icon: "" },
{ id: 8909, image: "", icon: "" }
],
users: [
{
id: 1235,
name: "Danny",
user_image: "https://randomuser.me/api/portraits/women/65.jpg",
followed: false
},
{
id: 2345,
name: "James",
user_image: "https://randomuser.me/api/portraits/men/24.jpg",
followed: true
},
{
id: 3456,
name: "Jennifer",
user_image: "https://randomuser.me/api/portraits/women/45.jpg",
followed: false
},
{
id: 4567,
name: "hello world",
user_image: "https://randomuser.me/api/portraits/men/45.jpg",
followed: false
},
{
id: 6789,
name: "hello world",
user_image: "https://randomuser.me/api/portraits/women/23.jpg",
followed: false
},
{
id: 7890,
name: "hello world",
user_image: "https://randomuser.me/api/portraits/men/67.jpg",
followed: false
},
{
id: 2456,
name: "hello world",
user_image: "https://randomuser.me/api/portraits/women/12.jpg",
followed: false
}
]
};
}
componentDidMount() {
this._navListener = this.props.navigation.addListener("didFocus", () => {
StatusBar.setBarStyle("dark-content");
});
}
render() {
return (
<ScrollView style={{ flex: 1, backgroundColor: "#fff" }}>
<SearchBox />
<LargeHeading>Trending Groups</LargeHeading>
<HorizontalScrollFeed
data={this.state.trendingGroups}
renderItem={({ item }) => (
<View style={{ marginRight: 6 }}>
<GroupCard item={item} />
</View>
)}
keyExtractor={item => `item-${item.id}`}
/>
<LargeHeading>Interesting Users</LargeHeading>
<HorizontalScrollFeed
data={this.state.interestingUsers}
renderItem={({ item }) => (
<View style={{ marginRight: 6 }}>
<Avatar size={60} noShadow source={item.user_image} />
</View>
)}
keyExtractor={item => `item-${item.id}`}
/>
<LargeHeading>People you may know</LargeHeading>
<FlatList
style={{ marginTop: 15 }}
data={this.state.users}
renderItem={({ item }) => (
<View style={{ marginLeft: 15, marginRight: 15, marginBottom: 15 }}>
<UserCard
username={"UserName"}
subtitle={"@subtitle"}
user={item}
follow
/>
</View>
)}
keyExtractor={item => `item-${item.id}`}
/>
</ScrollView>
);
}
};