Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Reapply "Update mobile app custom fields draggable UI (#2186)"

Leendert de Borst78e7773a2bdc
diff --git a/apps/mobile-app/components/form/AdvancedPasswordField.tsx b/apps/mobile-app/components/form/AdvancedPasswordField.tsx
index 514f4ffae..029c2b16a 100644
--- a/apps/mobile-app/components/form/AdvancedPasswordField.tsx
+++ b/apps/mobile-app/components/form/AdvancedPasswordField.tsx
@@ -274,6 +274,7 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, Adva
flexDirection: 'row',
justifyContent: 'space-between',
marginBottom: 20,
+ marginTop: 10,
},
modalTitle: {
color: colors.text,
diff --git a/apps/mobile-app/components/form/DraggableCustomFieldsList.tsx b/apps/mobile-app/components/form/DraggableCustomFieldsList.tsx
index 020d2760c..ff1679252 100644
--- a/apps/mobile-app/components/form/DraggableCustomFieldsList.tsx
+++ b/apps/mobile-app/components/form/DraggableCustomFieldsList.tsx
@@ -1,4 +1,3 @@
-import { MaterialIcons } from '@expo/vector-icons';
import * as Haptics from 'expo-haptics';
import React, { useCallback } from 'react';
import { View, StyleSheet } from 'react-native';
@@ -100,51 +99,26 @@ const CustomFieldItem: React.FC<CustomFieldItemProps> = ({
container: {
backgroundColor: colors.accentBackground,
borderRadius: 8,
- },
- contentContainer: {
- flex: 1,
- },
- dragHandle: {
- alignItems: 'center',
- justifyContent: 'center',
- paddingLeft: 4,
- paddingRight: 0,
- paddingVertical: 12,
+ padding: 8,
},
labelContainer: {
marginBottom: 4,
},
- outerContainer: {
- flexDirection: 'row',
- padding: 8,
- paddingRight: 4,
- },
});
return (
<View style={styles.container}>
- <View style={styles.outerContainer}>
- {/* Field content */}
- <View style={styles.contentContainer}>
- {/* Label row */}
- <View style={styles.labelContainer}>
- <EditableFieldLabel
- label={field.label}
- onLabelChange={onLabelChange}
- onDelete={onDelete}
- />
- </View>
- {/* Input field */}
- {renderFieldInput()}
- </View>
- {/* Drag handle on right side */}
- <View
- style={styles.dragHandle}
- onTouchStart={drag}
- >
- <MaterialIcons name="drag-indicator" size={20} color={colors.textMuted} />
- </View>
+ {/* Label row with inline, right-aligned drag handle */}
+ <View style={styles.labelContainer}>
+ <EditableFieldLabel
+ label={field.label}
+ onLabelChange={onLabelChange}
+ onDelete={onDelete}
+ drag={drag}
+ />
</View>
+ {/* Input field */}
+ {renderFieldInput()}
</View>
);
};
diff --git a/apps/mobile-app/components/form/EditableFieldLabel.tsx b/apps/mobile-app/components/form/EditableFieldLabel.tsx
index 33a5a68f3..7c7fd7c82 100644
--- a/apps/mobile-app/components/form/EditableFieldLabel.tsx
+++ b/apps/mobile-app/components/form/EditableFieldLabel.tsx
@@ -10,6 +10,8 @@ type EditableFieldLabelProps = {
label: string;
onLabelChange: (newLabel: string) => void;
onDelete?: () => void;
+ /** When provided, shows a right-aligned drag handle on the label line that starts reordering. */
+ drag?: () => void;
}
/**
@@ -19,7 +21,8 @@ type EditableFieldLabelProps = {
export const EditableFieldLabel: React.FC<EditableFieldLabelProps> = ({
label,
onLabelChange,
- onDelete
+ onDelete,
+ drag
}) => {
const colors = useColors();
const [isEditing, setIsEditing] = useState(false);
@@ -69,6 +72,10 @@ export const EditableFieldLabel: React.FC<EditableFieldLabelProps> = ({
deleteButton: {
marginLeft: 4,
},
+ dragHandle: {
+ marginLeft: 'auto',
+ padding: 2,
+ },
editButton: {
marginLeft: 4,
padding: 2,
@@ -152,6 +159,15 @@ export const EditableFieldLabel: React.FC<EditableFieldLabelProps> = ({
<MaterialIcons name="delete" size={14} color={colors.destructive} />
</TouchableHighlight>
)}
+ {drag && (
+ <TouchableHighlight
+ style={[styles.actionButton, styles.dragHandle]}
+ onPressIn={drag}
+ underlayColor={colors.accentBackground}
+ >
+ <MaterialIcons name="drag-indicator" size={18} color={colors.textMuted} />
+ </TouchableHighlight>
+ )}
</View>
);
};