diff --git a/app/(tabs)/lists.tsx b/app/(tabs)/lists.tsx index af76a84..e789460 100644 --- a/app/(tabs)/lists.tsx +++ b/app/(tabs)/lists.tsx @@ -1,8 +1,9 @@ import { useEffect, useState, useCallback, useRef } from 'react'; import { View, Text, Pressable, useColorScheme, TextInput, Alert, - Modal, KeyboardAvoidingView, Platform, ScrollView, + Modal, Platform, ScrollView, } from 'react-native'; +import { KeyboardAvoidingView } from 'react-native-keyboard-controller'; import { useRouter } from 'expo-router'; import { Plus, ChevronRight, Check, GripVertical, @@ -249,8 +250,8 @@ export default function ListsScreen() { {/* Create/Edit Modal */} setShowModal(false)} className="flex-1 justify-center bg-black/40 px-6"> setShowTagModal(false)} className="flex-1 justify-center bg-black/40 px-6"> - - - - - - - - + + + + + + + + + + ); } diff --git a/app/task/[id].tsx b/app/task/[id].tsx index c01630b..ac5566b 100644 --- a/app/task/[id].tsx +++ b/app/task/[id].tsx @@ -1,15 +1,14 @@ -import { useEffect, useState, useRef } from 'react'; +import { useEffect, useState } from 'react'; import { View, Text, TextInput, Pressable, - ScrollView, useColorScheme, Alert, Platform, - Keyboard, } from 'react-native'; +import { KeyboardAwareScrollView } from 'react-native-keyboard-controller'; import { useRouter, useLocalSearchParams } from 'expo-router'; import { ArrowLeft, Plus, Trash2, Calendar, X, Repeat, Download, @@ -81,22 +80,6 @@ export default function TaskDetailScreen() { const [lists, setLists] = useState<{ id: string; name: string; color: string | null; icon: string | null; isInbox: boolean }[]>([]); const [selectedListId, setSelectedListId] = useState(''); const [saving, setSaving] = useState(false); - const scrollRef = useRef(null); - const subtaskFocused = useRef(false); - const [keyboardHeight, setKeyboardHeight] = useState(0); - - useEffect(() => { - const showSub = Keyboard.addListener('keyboardDidShow', (e) => { - setKeyboardHeight(e.endCoordinates.height); - if (subtaskFocused.current) { - setTimeout(() => scrollRef.current?.scrollToEnd({ animated: true }), 100); - } - }); - const hideSub = Keyboard.addListener('keyboardDidHide', () => { - setKeyboardHeight(0); - }); - return () => { showSub.remove(); hideSub.remove(); }; - }, []); useEffect(() => { if (!isValidUUID(id)) { @@ -226,7 +209,7 @@ export default function TaskDetailScreen() { - + {/* Title */} { subtaskFocused.current = true; }} - onBlur={() => { subtaskFocused.current = false; }} placeholder={t('task.addSubtask')} placeholderTextColor={isDark ? '#A0A0A0' : '#6B6B6B'} className={`ml-2 flex-1 text-base ${isDark ? 'text-[#F5F5F5]' : 'text-[#1A1A1A]'}`} @@ -424,8 +405,8 @@ export default function TaskDetailScreen() { /> - - + + ); } diff --git a/app/task/new.tsx b/app/task/new.tsx index d37aa95..2bc6457 100644 --- a/app/task/new.tsx +++ b/app/task/new.tsx @@ -1,14 +1,13 @@ -import { useState, useEffect, useRef } from 'react'; +import { useState, useEffect } from 'react'; import { View, Text, TextInput, Pressable, - ScrollView, useColorScheme, Platform, - Keyboard, } from 'react-native'; +import { KeyboardAwareScrollView } from 'react-native-keyboard-controller'; import { useRouter, useLocalSearchParams } from 'expo-router'; import { X, Calendar, Repeat, Plus, @@ -59,22 +58,6 @@ export default function NewTaskScreen() { const [saving, setSaving] = useState(false); const [pendingSubtasks, setPendingSubtasks] = useState([]); const [newSubtask, setNewSubtask] = useState(''); - const scrollRef = useRef(null); - const subtaskFocused = useRef(false); - const [keyboardHeight, setKeyboardHeight] = useState(0); - - useEffect(() => { - const showSub = Keyboard.addListener('keyboardDidShow', (e) => { - setKeyboardHeight(e.endCoordinates.height); - if (subtaskFocused.current) { - setTimeout(() => scrollRef.current?.scrollToEnd({ animated: true }), 100); - } - }); - const hideSub = Keyboard.addListener('keyboardDidHide', () => { - setKeyboardHeight(0); - }); - return () => { showSub.remove(); hideSub.remove(); }; - }, []); useEffect(() => { getAllLists().then(setLists); @@ -153,7 +136,7 @@ export default function NewTaskScreen() { - + {/* Title */} { subtaskFocused.current = true; }} - onBlur={() => { subtaskFocused.current = false; }} placeholder={t('task.addSubtask')} placeholderTextColor={isDark ? '#A0A0A0' : '#6B6B6B'} className={`ml-2 flex-1 text-base ${isDark ? 'text-[#F5F5F5]' : 'text-[#1A1A1A]'}`} @@ -394,8 +375,8 @@ export default function NewTaskScreen() { /> - - + + ); } diff --git a/package-lock.json b/package-lock.json index 7a24f3e..367a80c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "simpl-liste", - "version": "1.0.0", + "version": "1.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "simpl-liste", - "version": "1.0.0", + "version": "1.2.2", "dependencies": { "@expo-google-fonts/inter": "^0.4.2", "@expo/ngrok": "^4.1.3", @@ -43,6 +43,7 @@ "react-native-android-widget": "^0.20.1", "react-native-draggable-flatlist": "^4.0.3", "react-native-gesture-handler": "~2.28.0", + "react-native-keyboard-controller": "1.18.5", "react-native-reanimated": "~4.1.1", "react-native-safe-area-context": "~5.6.0", "react-native-screens": "~4.16.0", @@ -10395,6 +10396,20 @@ "react-native": "*" } }, + "node_modules/react-native-keyboard-controller": { + "version": "1.18.5", + "resolved": "https://registry.npmjs.org/react-native-keyboard-controller/-/react-native-keyboard-controller-1.18.5.tgz", + "integrity": "sha512-wbYN6Tcu3G5a05dhRYBgjgd74KqoYWuUmroLpigRg9cXy5uYo7prTMIvMgvLtARQtUF7BOtFggUnzgoBOgk0TQ==", + "license": "MIT", + "dependencies": { + "react-native-is-edge-to-edge": "^1.2.1" + }, + "peerDependencies": { + "react": "*", + "react-native": "*", + "react-native-reanimated": ">=3.0.0" + } + }, "node_modules/react-native-reanimated": { "version": "4.1.6", "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-4.1.6.tgz", diff --git a/package.json b/package.json index 19652d6..1e52e2a 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "react-native-android-widget": "^0.20.1", "react-native-draggable-flatlist": "^4.0.3", "react-native-gesture-handler": "~2.28.0", + "react-native-keyboard-controller": "1.18.5", "react-native-reanimated": "~4.1.1", "react-native-safe-area-context": "~5.6.0", "react-native-screens": "~4.16.0",