Skip to content

Commit 9294303

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 029184d + 5b3be98 commit 9294303

File tree

5 files changed

+310
-279
lines changed

5 files changed

+310
-279
lines changed

components/ServerList.tsx

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import React from "react";
22
import { Button, List, ListItem } from "@ui-kitten/components";
33
import { StyleSheet } from "react-native";
44
import { useTranslation } from "react-i18next";
5-
import { Entry } from "screens/ServerScreen";
5+
import { EvccInstance } from "types";
66

77
interface ServerListProps {
8-
entries: Array<{ title: string; url: string }>;
8+
entries: EvccInstance[];
99
onSelect: (url: string) => Promise<void>;
1010
}
1111

@@ -14,27 +14,34 @@ export default function ServerList({
1414
onSelect,
1515
}: ServerListProps): React.ReactElement {
1616
const { t } = useTranslation();
17-
const renderItemAccessory = (url: string) => (
18-
<Button
19-
size="small"
20-
onPress={() => {
21-
onSelect(url);
22-
}}
23-
>
24-
{t("servers.select")}
25-
</Button>
26-
);
2717

28-
const renderItem = ({ item }: { item: Entry }) => (
29-
<ListItem
30-
title={item.title}
31-
description={item.url}
32-
accessoryRight={() => renderItemAccessory(item.url)}
33-
/>
34-
);
18+
const renderItemAccessory = (url: string) => {
19+
return (
20+
<Button
21+
size="small"
22+
onPress={() => {
23+
onSelect(url);
24+
}}
25+
>
26+
{t("servers.select")}
27+
</Button>
28+
);
29+
};
3530

3631
return (
37-
<List style={styles.container} data={entries} renderItem={renderItem} />
32+
<List<EvccInstance>
33+
style={styles.container}
34+
data={entries}
35+
renderItem={({ item }) => {
36+
return (
37+
<ListItem
38+
title={item.title}
39+
description={item.url}
40+
accessoryRight={() => renderItemAccessory(item.url)}
41+
/>
42+
);
43+
}}
44+
/>
3845
);
3946
}
4047

0 commit comments

Comments
 (0)