create-100x-mobile 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
StyleSheet,
|
|
13
13
|
StatusBar,
|
|
14
14
|
} from "react-native";
|
|
15
|
-
import Animated, { LinearTransition } from "react-native-reanimated";
|
|
16
15
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
17
16
|
import { AddTodoForm } from "@/components/AddTodoForm";
|
|
18
17
|
import { TodoItem } from "@/components/TodoItem";
|
|
@@ -32,8 +31,6 @@ export interface Todo {
|
|
|
32
31
|
|
|
33
32
|
type FilterType = "all" | "active" | "completed";
|
|
34
33
|
|
|
35
|
-
const AnimatedFlatList = Animated.createAnimatedComponent(FlatList<Todo>);
|
|
36
|
-
|
|
37
34
|
export default function TodosScreen() {
|
|
38
35
|
const [filter, setFilter] = useState<FilterType>("all");
|
|
39
36
|
|
|
@@ -119,14 +116,13 @@ export default function TodosScreen() {
|
|
|
119
116
|
}}
|
|
120
117
|
/>
|
|
121
118
|
|
|
122
|
-
<
|
|
119
|
+
<FlatList
|
|
123
120
|
data={filteredTodos}
|
|
124
121
|
renderItem={renderItem}
|
|
125
122
|
keyExtractor={keyExtractor}
|
|
126
123
|
style={styles.todosContainer}
|
|
127
124
|
contentContainerStyle={styles.todosContent}
|
|
128
125
|
showsVerticalScrollIndicator={false}
|
|
129
|
-
itemLayoutAnimation={LinearTransition.springify()}
|
|
130
126
|
ListEmptyComponent={<EmptyState filter={filter} />}
|
|
131
127
|
keyboardShouldPersistTaps="handled"
|
|
132
128
|
/>
|
|
@@ -2,13 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addTodoFormTemplate = addTodoFormTemplate;
|
|
4
4
|
function addTodoFormTemplate() {
|
|
5
|
-
return `import React, { useState } from "react";
|
|
6
|
-
import { View, TextInput, TouchableOpacity, StyleSheet } from "react-native";
|
|
7
|
-
import Animated, {
|
|
8
|
-
useSharedValue,
|
|
9
|
-
useAnimatedStyle,
|
|
10
|
-
withSpring,
|
|
11
|
-
} from "react-native-reanimated";
|
|
5
|
+
return `import React, { useState, useRef } from "react";
|
|
6
|
+
import { View, TextInput, TouchableOpacity, StyleSheet, Animated } from "react-native";
|
|
12
7
|
import * as Haptics from "expo-haptics";
|
|
13
8
|
import { Plus } from "lucide-react-native";
|
|
14
9
|
|
|
@@ -18,17 +13,20 @@ interface AddTodoFormProps {
|
|
|
18
13
|
|
|
19
14
|
export function AddTodoForm({ onAddTodo }: AddTodoFormProps) {
|
|
20
15
|
const [text, setText] = useState("");
|
|
21
|
-
const buttonScale =
|
|
22
|
-
|
|
23
|
-
const buttonAnimatedStyle = useAnimatedStyle(() => ({
|
|
24
|
-
transform: [{ scale: buttonScale.value }],
|
|
25
|
-
}));
|
|
16
|
+
const buttonScale = useRef(new Animated.Value(1)).current;
|
|
26
17
|
|
|
27
18
|
const handleSubmit = () => {
|
|
28
19
|
if (text.trim()) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
Animated.sequence([
|
|
21
|
+
Animated.spring(buttonScale, {
|
|
22
|
+
toValue: 0.9,
|
|
23
|
+
useNativeDriver: true,
|
|
24
|
+
}),
|
|
25
|
+
Animated.spring(buttonScale, {
|
|
26
|
+
toValue: 1,
|
|
27
|
+
useNativeDriver: true,
|
|
28
|
+
}),
|
|
29
|
+
]).start();
|
|
32
30
|
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
|
|
33
31
|
onAddTodo(text);
|
|
34
32
|
setText("");
|
|
@@ -48,7 +46,7 @@ export function AddTodoForm({ onAddTodo }: AddTodoFormProps) {
|
|
|
48
46
|
returnKeyType="done"
|
|
49
47
|
multiline={false}
|
|
50
48
|
/>
|
|
51
|
-
<Animated.View style={
|
|
49
|
+
<Animated.View style={{ transform: [{ scale: buttonScale }] }}>
|
|
52
50
|
<TouchableOpacity
|
|
53
51
|
style={[styles.addButton, !text.trim() && styles.addButtonDisabled]}
|
|
54
52
|
onPress={handleSubmit}
|
|
@@ -2,14 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.todoItemTemplate = todoItemTemplate;
|
|
4
4
|
function todoItemTemplate() {
|
|
5
|
-
return `import React from "react";
|
|
6
|
-
import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
|
|
7
|
-
import Animated, {
|
|
8
|
-
FadeInDown,
|
|
9
|
-
useSharedValue,
|
|
10
|
-
useAnimatedStyle,
|
|
11
|
-
withSpring,
|
|
12
|
-
} from "react-native-reanimated";
|
|
5
|
+
return `import React, { useRef } from "react";
|
|
6
|
+
import { View, Text, TouchableOpacity, StyleSheet, Animated } from "react-native";
|
|
13
7
|
import * as Haptics from "expo-haptics";
|
|
14
8
|
import { Check, X } from "lucide-react-native";
|
|
15
9
|
import type { Todo } from "@/app/(tabs)/index";
|
|
@@ -22,16 +16,28 @@ interface TodoItemProps {
|
|
|
22
16
|
}
|
|
23
17
|
|
|
24
18
|
export function TodoItem({ todo, onToggle, onDelete }: TodoItemProps) {
|
|
25
|
-
const checkboxScale =
|
|
19
|
+
const checkboxScale = useRef(new Animated.Value(1)).current;
|
|
20
|
+
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
26
21
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
Animated.timing(fadeAnim, {
|
|
24
|
+
toValue: 1,
|
|
25
|
+
duration: 300,
|
|
26
|
+
useNativeDriver: true,
|
|
27
|
+
}).start();
|
|
28
|
+
}, []);
|
|
30
29
|
|
|
31
30
|
const handleToggle = () => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
Animated.sequence([
|
|
32
|
+
Animated.spring(checkboxScale, {
|
|
33
|
+
toValue: 0.85,
|
|
34
|
+
useNativeDriver: true,
|
|
35
|
+
}),
|
|
36
|
+
Animated.spring(checkboxScale, {
|
|
37
|
+
toValue: 1,
|
|
38
|
+
useNativeDriver: true,
|
|
39
|
+
}),
|
|
40
|
+
]).start();
|
|
35
41
|
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
|
|
36
42
|
onToggle(todo._id);
|
|
37
43
|
};
|
|
@@ -42,7 +48,7 @@ export function TodoItem({ todo, onToggle, onDelete }: TodoItemProps) {
|
|
|
42
48
|
};
|
|
43
49
|
|
|
44
50
|
return (
|
|
45
|
-
<Animated.View
|
|
51
|
+
<Animated.View style={{ opacity: fadeAnim }}>
|
|
46
52
|
<View style={styles.container}>
|
|
47
53
|
<TouchableOpacity
|
|
48
54
|
style={styles.checkboxHitArea}
|
|
@@ -53,7 +59,7 @@ export function TodoItem({ todo, onToggle, onDelete }: TodoItemProps) {
|
|
|
53
59
|
style={[
|
|
54
60
|
styles.checkbox,
|
|
55
61
|
todo.completed && styles.checkboxCompleted,
|
|
56
|
-
|
|
62
|
+
{ transform: [{ scale: checkboxScale }] },
|
|
57
63
|
]}
|
|
58
64
|
>
|
|
59
65
|
{todo.completed && (
|
|
@@ -37,7 +37,7 @@ function packageJsonTemplate(appName) {
|
|
|
37
37
|
"react-dom": "19.1.0",
|
|
38
38
|
"react-native": "0.81.5",
|
|
39
39
|
"react-native-gesture-handler": "~2.28.0",
|
|
40
|
-
"react-native-reanimated": "~
|
|
40
|
+
"react-native-reanimated": "~3.16.1",
|
|
41
41
|
"react-native-safe-area-context": "~5.6.0",
|
|
42
42
|
"react-native-screens": "~4.16.0",
|
|
43
43
|
"react-native-svg": "15.12.1",
|