feat: replace native alerts with custom dialog modals
This commit is contained in:
@@ -1,25 +1,8 @@
|
||||
import React from 'react';
|
||||
import { Alert, Pressable, Text, View } from 'react-native';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { styles } from '../styles';
|
||||
|
||||
export default function HistoryTab({
|
||||
selectedTrip,
|
||||
selectedTripCheckups,
|
||||
selectedCheckupId,
|
||||
setSelectedCheckupId,
|
||||
onDeleteCheckup,
|
||||
}) {
|
||||
function askDelete(checkup) {
|
||||
Alert.alert('Delete check-up?', 'This snapshot will be removed from history.', [
|
||||
{ text: 'Cancel', style: 'cancel' },
|
||||
{
|
||||
text: 'Delete',
|
||||
style: 'destructive',
|
||||
onPress: () => onDeleteCheckup(checkup.id),
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
export default function HistoryTab({ selectedTrip, selectedTripCheckups, selectedCheckupId, setSelectedCheckupId, onDeleteCheckup }) {
|
||||
return (
|
||||
<View style={styles.section}>
|
||||
<Text style={styles.sectionTitle}>History</Text>
|
||||
@@ -32,7 +15,7 @@ export default function HistoryTab({
|
||||
<View key={checkup.id} style={styles.cardSoft}>
|
||||
<Pressable
|
||||
onPress={() => setSelectedCheckupId((prev) => (prev === checkup.id ? null : checkup.id))}
|
||||
onLongPress={() => askDelete(checkup)}
|
||||
onLongPress={() => onDeleteCheckup(checkup.id)}
|
||||
delayLongPress={280}
|
||||
>
|
||||
<Text style={styles.cardTitle}>{new Date(checkup.createdAt).toLocaleString()}</Text>
|
||||
|
||||
Reference in New Issue
Block a user