Stabilize mobile auth session handling
This commit is contained in:
@@ -3,6 +3,7 @@ import { Pressable, StyleSheet, Text, TextInput, View } from "react-native";
|
||||
|
||||
import { CompactDateField } from "@/components/ui/CompactDateField";
|
||||
import { CompactStepperInput } from "@/components/ui/CompactStepperInput";
|
||||
import { SwipeableRow } from "@/components/SwipeableRow";
|
||||
import { fonts, radii, spacing } from "@/constants/theme";
|
||||
import { useAppTheme } from "@/contexts/ThemeContext";
|
||||
import { formatCurrency, formatShortDate } from "@/lib/format";
|
||||
@@ -21,6 +22,7 @@ type LineItemEditorProps = {
|
||||
currency: string;
|
||||
onChange: (patch: Partial<EditableLineItem>) => void;
|
||||
onRemove: () => void;
|
||||
onDuplicate?: () => void;
|
||||
readOnly?: boolean;
|
||||
isLast?: boolean;
|
||||
};
|
||||
@@ -38,6 +40,7 @@ export function LineItemEditor({
|
||||
currency,
|
||||
onChange,
|
||||
onRemove,
|
||||
onDuplicate,
|
||||
readOnly = false,
|
||||
isLast = false,
|
||||
}: LineItemEditorProps) {
|
||||
@@ -70,7 +73,7 @@ export function LineItemEditor({
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
const content = (
|
||||
<View
|
||||
style={[
|
||||
styles.editBlock,
|
||||
@@ -156,6 +159,35 @@ export function LineItemEditor({
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
||||
const swipeActions = [
|
||||
...(onDuplicate
|
||||
? [
|
||||
{
|
||||
key: "duplicate",
|
||||
label: "Copy",
|
||||
icon: "copy-outline" as const,
|
||||
color: "#fff",
|
||||
backgroundColor: colors.primary,
|
||||
onPress: onDuplicate,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
key: "delete",
|
||||
label: "Delete",
|
||||
icon: "trash-outline" as const,
|
||||
color: "#fff",
|
||||
backgroundColor: colors.destructive,
|
||||
onPress: onRemove,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<SwipeableRow actions={swipeActions} backgroundColor={colors.card}>
|
||||
{content}
|
||||
</SwipeableRow>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
|
||||
Reference in New Issue
Block a user