fix: disable KeyboardAvoidingView on Android, sync widget on app start (#6, #9)

- Set KeyboardAvoidingView behavior to undefined on Android to avoid
  conflict with native adjustResize (was causing double-resize)
- Call syncWidgetData() at app startup to populate subtasks in widget cache
- Keyboard.addListener + adjustResize handles scroll correctly on Android

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
le king fu 2026-03-01 12:07:34 -05:00
parent 3efb7a1cb0
commit fe7bda4747
3 changed files with 4 additions and 2 deletions

View file

@ -12,6 +12,7 @@ import migrations from '@/src/db/migrations/migrations';
import { ensureInbox } from '@/src/db/repository/lists';
import { useSettingsStore } from '@/src/stores/useSettingsStore';
import { initNotifications } from '@/src/services/notifications';
import { syncWidgetData } from '@/src/services/widgetSync';
import '@/src/i18n';
import '@/src/global.css';
@ -66,6 +67,7 @@ export default function RootLayout() {
if (fontsLoaded && migrationsReady) {
ensureInbox().then(async () => {
await initNotifications();
syncWidgetData().catch(() => {});
SplashScreen.hideAsync();
});
}

View file

@ -223,7 +223,7 @@ export default function TaskDetailScreen() {
</View>
</View>
<KeyboardAvoidingView className="flex-1" behavior={Platform.OS === 'ios' ? 'padding' : 'height'}>
<KeyboardAvoidingView className="flex-1" behavior={Platform.OS === 'ios' ? 'padding' : undefined}>
<ScrollView ref={scrollRef} className="flex-1 px-4 pt-4" keyboardShouldPersistTaps="handled">
{/* Title */}
<TextInput

View file

@ -150,7 +150,7 @@ export default function NewTaskScreen() {
</Pressable>
</View>
<KeyboardAvoidingView className="flex-1" behavior={Platform.OS === 'ios' ? 'padding' : 'height'}>
<KeyboardAvoidingView className="flex-1" behavior={Platform.OS === 'ios' ? 'padding' : undefined}>
<ScrollView ref={scrollRef} className="flex-1 px-4 pt-4" keyboardShouldPersistTaps="handled">
{/* Title */}
<TextInput