|
@@ -79,7 +79,7 @@ class ProfileScreen extends React.Component<Props, State> {
|
79
|
79
|
return this.getPersonalCard();
|
80
|
80
|
case '1':
|
81
|
81
|
return this.getClubCard();
|
82
|
|
- case '2':
|
|
82
|
+ default:
|
83
|
83
|
return this.getMembershipCar();
|
84
|
84
|
}
|
85
|
85
|
};
|
|
@@ -164,20 +164,39 @@ class ProfileScreen extends React.Component<Props, State> {
|
164
|
164
|
);
|
165
|
165
|
}
|
166
|
166
|
|
|
167
|
+ openClubDetailsScreen(id: number) {
|
|
168
|
+ this.props.navigation.navigate("club-information", {clubId: id});
|
|
169
|
+ }
|
|
170
|
+
|
|
171
|
+ clubListItem = ({item}: Object) => {
|
|
172
|
+ const onPress = () => this.openClubDetailsScreen(0); // TODO get club id
|
|
173
|
+ const isManager = false; // TODO detect if manager
|
|
174
|
+ let description = i18n.t("profileScreen.isMember");
|
|
175
|
+ let icon = (props) => <List.Icon {...props} icon="chevron-right"/>;
|
|
176
|
+ if (isManager) {
|
|
177
|
+ description = i18n.t("profileScreen.isManager");
|
|
178
|
+ icon = (props) => <List.Icon {...props} icon="star" color={this.colors.primary}/>;
|
|
179
|
+ }
|
|
180
|
+ return <List.Item
|
|
181
|
+ title={item.name}
|
|
182
|
+ description={description}
|
|
183
|
+ left={icon}
|
|
184
|
+ onPress={onPress}
|
|
185
|
+ />;
|
|
186
|
+ };
|
|
187
|
+
|
|
188
|
+ clubKeyExtractor = (item: Object) => item.name;
|
|
189
|
+
|
167
|
190
|
getClubList(list: Array<string>) {
|
168
|
191
|
let dataset = [];
|
169
|
192
|
for (let i = 0; i < list.length; i++) {
|
170
|
193
|
dataset.push({name: list[i]});
|
171
|
194
|
}
|
172
|
195
|
return (
|
|
196
|
+ //$FlowFixMe
|
173
|
197
|
<FlatList
|
174
|
|
- renderItem={({item}) =>
|
175
|
|
- <List.Item
|
176
|
|
- title={item.name}
|
177
|
|
- left={props => <List.Icon {...props} icon="chevron-right"/>}
|
178
|
|
- />
|
179
|
|
- }
|
180
|
|
- keyExtractor={item => item.name}
|
|
198
|
+ renderItem={this.clubListItem}
|
|
199
|
+ keyExtractor={this.clubKeyExtractor}
|
181
|
200
|
data={dataset}
|
182
|
201
|
/>
|
183
|
202
|
);
|