fix: keep recipe-name sheet above keyboard (KeyboardAvoidingView), gps diagnostic logs

This commit is contained in:
2026-09-08 11:01:15 +07:00
parent 358f9b0f2f
commit 7d77be5029
2 changed files with 12 additions and 4 deletions
+4
View File
@@ -242,6 +242,7 @@ export default function App() {
if (!result.canceled && result.assets && result.assets.length > 0) {
const asset = result.assets[0];
console.error(`[gps] picked uri=${asset.uri} assetId=${asset.assetId || 'null'} exifGPS=${asset.exif ? JSON.stringify(asset.exif.GPSLatitude ?? null) : 'no-exif'}`);
setLibraryImageUri(asset.uri);
setMode('library');
// Clear old GPS — will be replaced if the photo (or device) has location data
@@ -259,6 +260,9 @@ export default function App() {
if (permissionDenied) {
console.warn('Media library read permission denied — photo GPS unavailable.');
}
console.error(
`[gps] resolved ${gps ? `src=${gps.source} lat=${gps.latitude.toFixed(5)} lon=${gps.longitude.toFixed(5)} loc=${(gps.locality || '').slice(0, 40)}` : 'none'}`
);
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
}
+8 -4
View File
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { View, Text, TouchableOpacity, TextInput, Modal } from 'react-native';
import { View, Text, TouchableOpacity, TextInput, Modal, KeyboardAvoidingView, Platform } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { Plus } from 'lucide-react-native';
import * as Haptics from 'expo-haptics';
@@ -60,8 +60,12 @@ export default function TopBar({ mode, recipeName, onSaveRecipe }: TopBarProps)
visible={modalVisible}
onRequestClose={() => setModalVisible(false)}
>
<View className="flex-1 justify-end bg-black/60">
<View style={{ paddingBottom: insets.bottom + 16 }} className="bg-titan border-t border-zinc-800 rounded-t-3xl p-6">
<View className="absolute inset-0 bg-black/60" />
<KeyboardAvoidingView
style={{ flex: 1 }}
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
>
<View style={{ paddingBottom: insets.bottom + 16 }} className="mt-auto bg-titan border-t border-zinc-800 rounded-t-3xl p-6">
<Text className="text-white font-mono text-sm font-bold tracking-wider mb-4">
SAVE CURRENT AS RECIPE
</Text>
@@ -89,7 +93,7 @@ export default function TopBar({ mode, recipeName, onSaveRecipe }: TopBarProps)
</TouchableOpacity>
</View>
</View>
</View>
</KeyboardAvoidingView>
</Modal>
</>
);