-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimerCollectionView.tsx
More file actions
65 lines (59 loc) · 2.05 KB
/
Copy pathTimerCollectionView.tsx
File metadata and controls
65 lines (59 loc) · 2.05 KB
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
import React from "react";
import { ScrollView, Text, TouchableOpacity, View } from "react-native";
import { styles } from "./Shared";
import { useTimerContext } from "./timerContext";
import { RootStackParamList } from "./Types";
import { TimerCollectionItemView } from "./TimerCollectionItemView";
import { StackScreenProps } from "@react-navigation/stack";
import "react-native-get-random-values";
import { v4 as uuidv4 } from "uuid";
import { LinearGradient } from "expo-linear-gradient";
type TimerCollectionViewProps = StackScreenProps<
RootStackParamList,
"TimerCollections"
>;
export function TimerCollectionView({ navigation }: TimerCollectionViewProps) {
console.log(`timerCollectionView rendered`);
const { timerCollectionList, addTimerCollection } = useTimerContext();
const handleViewTimerCollection = (id: string) => {
navigation.navigate("TimerSetView", {
TimerCollectionId: id,
});
};
return (
<View style={[styles.screenBackground]}>
<LinearGradient
colors={["#140B35", "#3f0072"]}
start={{ x: 0, y: 0 }}
end={{ x: 1, y: 1 }}
style={styles.screenBackground}
>
<View style={[styles.backgroundContainer]}>
<ScrollView contentContainerStyle={styles.scrollContainer}>
{timerCollectionList.map((timerCollection) => (
<TimerCollectionItemView
key={timerCollection.collectionId}
timerCollectionData={timerCollection}
onView={handleViewTimerCollection}
/>
))}
</ScrollView>
<TouchableOpacity
onPress={() =>
addTimerCollection({
collectionId: uuidv4(),
collectionName: "New Collection",
timerCollection: [],
})
}
>
<View style={[styles.standardButton]}>
<Text style={styles.standardTimerText}>Add</Text>
</View>
</TouchableOpacity>
<View />
</View>
</LinearGradient>
</View>
);
}