-
Notifications
You must be signed in to change notification settings - Fork 1
/
todoItem.js
69 lines (52 loc) · 1.47 KB
/
todoItem.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
import React from 'react'
import {StyleSheet, View, Animated, Text, Pressable, Vibration} from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
/** Adapted from CS455 University of Regina; Dr. Trevor M. Tomesh
* TodoItem()
* Purpose: click photos, and flip camera option
* Parameter(s):
* <1>pressHandler
* <2>item
*
* Precondition(s):
* Item input
*
* Returns: Item button
*
* Side effect:
* <1> onPress adds a new screen (push)
* <2> onLongPress removes the item with a vibration feedback
*
*/
export default function TodoItem({pressHandler, item}){
const navigation2 = useNavigation();
return (
<Pressable onPress={() =>{navigation2.push('Details')}} onLongPress={() => {Vibration.vibrate(); pressHandler(item.key)}}>
<View style={styles.button}>
<Animated.View style={styles.bgFill} />
<Text style = {styles.item}>{item.text}</Text>
</View>
</Pressable>
)
}
/**
* styles
* Purpose: styling the items
*/
const styles = StyleSheet.create({
button: {
padding: 10,
borderWidth: 3,
borderColor: "#111",
},
item: {
padding: 16,
marginTop: 16,
borderColor: '#822',
borderWidth: 1,
borderStyle: "dashed",
borderRadius: 10,
}
});