You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.9 KiB

2 weeks ago
import TodoList from "@/components/TodoList";
import { Button, ButtonText } from "@/components/ui/button";
import { GS } from "@/components/ui/gluestack-ui-provider/gluestack-ui-token";
import { HStack } from "@/components/ui/hstack";
import { Input, InputField } from "@/components/ui/input";
2 weeks ago
import { Text } from "@/components/ui/text";
import { VStack } from "@/components/ui/vstack";
2 weeks ago
import { useTodosCtx } from "@/store/todoProvider";
2 weeks ago
import { useState } from "react";
2 weeks ago
import { KeyboardAvoidingView, Platform } from "react-native";
2 weeks ago
import { SafeAreaView } from "react-native-safe-area-context";
export default function ActiveTab() {
2 weeks ago
const { activeTodos, leftCount, add, toggle, completeAll } = useTodosCtx();
2 weeks ago
const [title, setTitle] = useState("");
const onAdd = () => {
add(title);
setTitle("");
};
return (
2 weeks ago
<SafeAreaView style={{ flex: 1 }} className="bg-white dark:bg-neutral-900">
<KeyboardAvoidingView
style={{ flex: 1 }}
behavior={Platform.OS === "ios" ? "padding" : "height"}
keyboardVerticalOffset={30}
>
<VStack className="flex-1 px-4 py-1 gap-3">
<Text className="text-2xl font-bold"></Text>
{/* 확인 창 */}
<TodoList data={activeTodos} onToggle={toggle} />
{/* 입력 창 */}
<HStack className="gap-2">
<Input className="flex-1">
<InputField
value={title}
onChangeText={setTitle}
placeholder="할 일을 입력하세요"
returnKeyType="done"
onSubmitEditing={onAdd}
/>
</Input>
<Button action={GS.action.primary} onPress={onAdd}>
<ButtonText></ButtonText>
</Button>
</HStack>
</VStack>
</KeyboardAvoidingView>
2 weeks ago
</SafeAreaView>
);
2 weeks ago
}