Compare commits
1 Commits
luggage-li
...
luggage-li
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e45261354 |
9
app.json
9
app.json
@@ -34,6 +34,15 @@
|
|||||||
"eas": {
|
"eas": {
|
||||||
"projectId": "1275f90e-33c6-4af1-942e-ca29a309f8c8"
|
"projectId": "1275f90e-33c6-4af1-942e-ca29a309f8c8"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"expo-image-picker",
|
||||||
|
{
|
||||||
|
"photosPermission": "Allow Luggage List to access your photos for trip and item images.",
|
||||||
|
"cameraPermission": "Allow Luggage List to use your camera to take trip and item photos."
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,6 +169,23 @@ export default function AppRoot() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function takeImage(onPicked) {
|
||||||
|
const perm = await ImagePicker.requestCameraPermissionsAsync();
|
||||||
|
if (!perm.granted) {
|
||||||
|
Alert.alert('Permission needed', 'Allow camera access to take photos.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await ImagePicker.launchCameraAsync({
|
||||||
|
allowsEditing: false,
|
||||||
|
quality: 0.85,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!result.canceled && result.assets?.[0]?.uri) {
|
||||||
|
onPicked(result.assets[0].uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function createTrip() {
|
function createTrip() {
|
||||||
if (!tripForm.name.trim()) {
|
if (!tripForm.name.trim()) {
|
||||||
Alert.alert('Missing name', 'Trip name is required.');
|
Alert.alert('Missing name', 'Trip name is required.');
|
||||||
@@ -526,6 +543,7 @@ export default function AppRoot() {
|
|||||||
tripForm={tripForm}
|
tripForm={tripForm}
|
||||||
updateTripForm={updateTripForm}
|
updateTripForm={updateTripForm}
|
||||||
pickTripImage={() => pickImage((uri) => updateTripForm('imageUri', uri))}
|
pickTripImage={() => pickImage((uri) => updateTripForm('imageUri', uri))}
|
||||||
|
takeTripImage={() => takeImage((uri) => updateTripForm('imageUri', uri))}
|
||||||
templateTrip={templateTrip}
|
templateTrip={templateTrip}
|
||||||
createTrip={createTrip}
|
createTrip={createTrip}
|
||||||
trips={data.trips}
|
trips={data.trips}
|
||||||
@@ -587,6 +605,7 @@ export default function AppRoot() {
|
|||||||
setItemModalVisible={setItemModalVisible}
|
setItemModalVisible={setItemModalVisible}
|
||||||
updateItemForm={updateItemForm}
|
updateItemForm={updateItemForm}
|
||||||
pickItemImage={() => pickImage((uri) => updateItemForm('imageUri', uri))}
|
pickItemImage={() => pickImage((uri) => updateItemForm('imageUri', uri))}
|
||||||
|
takeItemImage={() => takeImage((uri) => updateItemForm('imageUri', uri))}
|
||||||
saveItemFromModal={saveItemFromModal}
|
saveItemFromModal={saveItemFromModal}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export default function ItemModal({
|
|||||||
setItemModalVisible,
|
setItemModalVisible,
|
||||||
updateItemForm,
|
updateItemForm,
|
||||||
pickItemImage,
|
pickItemImage,
|
||||||
|
takeItemImage,
|
||||||
saveItemFromModal,
|
saveItemFromModal,
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
@@ -81,9 +82,14 @@ export default function ItemModal({
|
|||||||
</Field>
|
</Field>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<Pressable style={styles.secondaryBtn} onPress={pickItemImage}>
|
<View style={styles.actionRow}>
|
||||||
<Text style={styles.secondaryBtnText}>{itemForm.imageUri ? 'Change image' : 'Add image'}</Text>
|
<Pressable style={[styles.secondaryBtnTight, styles.flex]} onPress={takeItemImage}>
|
||||||
|
<Text style={styles.secondaryBtnText}>Take photo</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
|
<Pressable style={[styles.secondaryBtnTight, styles.flex]} onPress={pickItemImage}>
|
||||||
|
<Text style={styles.secondaryBtnText}>{itemForm.imageUri ? 'From gallery (change)' : 'From gallery'}</Text>
|
||||||
|
</Pressable>
|
||||||
|
</View>
|
||||||
{!!itemForm.imageUri && <Image source={{ uri: itemForm.imageUri }} style={styles.previewImageSmall} />}
|
{!!itemForm.imageUri && <Image source={{ uri: itemForm.imageUri }} style={styles.previewImageSmall} />}
|
||||||
|
|
||||||
<Pressable style={styles.primaryBtn} onPress={saveItemFromModal}>
|
<Pressable style={styles.primaryBtn} onPress={saveItemFromModal}>
|
||||||
|
|||||||
@@ -211,6 +211,11 @@ export const styles = StyleSheet.create({
|
|||||||
color: '#dbeafe',
|
color: '#dbeafe',
|
||||||
fontWeight: '700',
|
fontWeight: '700',
|
||||||
},
|
},
|
||||||
|
actionRow: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
gap: 8,
|
||||||
|
marginTop: 4,
|
||||||
|
},
|
||||||
|
|
||||||
inlineToggle: {
|
inlineToggle: {
|
||||||
marginTop: 2,
|
marginTop: 2,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export default function TripsTab({
|
|||||||
tripForm,
|
tripForm,
|
||||||
updateTripForm,
|
updateTripForm,
|
||||||
pickTripImage,
|
pickTripImage,
|
||||||
|
takeTripImage,
|
||||||
templateTrip,
|
templateTrip,
|
||||||
createTrip,
|
createTrip,
|
||||||
trips,
|
trips,
|
||||||
@@ -58,9 +59,14 @@ export default function TripsTab({
|
|||||||
<DateField label="Start Date" value={tripForm.startDate} onPress={() => openDatePicker('startDate')} />
|
<DateField label="Start Date" value={tripForm.startDate} onPress={() => openDatePicker('startDate')} />
|
||||||
<DateField label="End Date" value={tripForm.endDate} onPress={() => openDatePicker('endDate')} />
|
<DateField label="End Date" value={tripForm.endDate} onPress={() => openDatePicker('endDate')} />
|
||||||
|
|
||||||
<Pressable style={styles.secondaryBtn} onPress={pickTripImage}>
|
<View style={styles.actionRow}>
|
||||||
<Text style={styles.secondaryBtnText}>{tripForm.imageUri ? 'Change trip image' : 'Add trip image'}</Text>
|
<Pressable style={[styles.secondaryBtnTight, styles.flex]} onPress={takeTripImage}>
|
||||||
|
<Text style={styles.secondaryBtnText}>Take photo</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
|
<Pressable style={[styles.secondaryBtnTight, styles.flex]} onPress={pickTripImage}>
|
||||||
|
<Text style={styles.secondaryBtnText}>{tripForm.imageUri ? 'From gallery (change)' : 'From gallery'}</Text>
|
||||||
|
</Pressable>
|
||||||
|
</View>
|
||||||
|
|
||||||
{tripForm.imageUri ? <Image source={{ uri: tripForm.imageUri }} style={styles.previewImage} /> : null}
|
{tripForm.imageUri ? <Image source={{ uri: tripForm.imageUri }} style={styles.previewImage} /> : null}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user