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.

59 lines
2.0 KiB

2 weeks ago
import TodoList from "@/components/todo-list";
2 weeks ago
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, View } from "react-native";
2 weeks ago
import { SafeAreaView } from "react-native-safe-area-context";
export default function ActiveTab() {
2 weeks ago
const { todos, activeTodos, leftCount, add, toggle, completeAll, clearDone } =
useTodosCtx();
2 weeks ago
const [title, setTitle] = useState("");
const onAdd = () => {
add(title);
setTitle("");
};
return (
2 weeks ago
<SafeAreaView className="flex-1 px-4 py-1 bg-white dark:bg-neutral-900">
<VStack className="flex-1 gap-3">
<HStack className="flex justify-between">
<Text className="text-2xl font-bold"> </Text>
</HStack>
{/* 입력 창 */}
<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>
{/* 확인 창 */}
<TodoList data={todos} onToggle={toggle} />
<Button
variant={GS.variant.outline}
action={GS.action.secondary}
onPress={clearDone}
>
<ButtonText> </ButtonText>
</Button>
</VStack>
2 weeks ago
</SafeAreaView>
);
2 weeks ago
}