Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Allow to change custom field type after creation, reusing create modal in mobile app (#2362)
Leendert de Borst488150d3eab1
diff --git a/apps/mobile-app/app/(tabs)/items/add-edit.tsx b/apps/mobile-app/app/(tabs)/items/add-edit.tsxindex 865f14e55..31be3b13b 100644--- a/apps/mobile-app/app/(tabs)/items/add-edit.tsx+++ b/apps/mobile-app/app/(tabs)/items/add-edit.tsx@@ -53,6 +53,12 @@ const VALID_ITEM_TYPES: ItemType[] = [ItemTypes.Login, ItemTypes.Alias, ItemType// Default item type for new itemsconst DEFAULT_ITEM_TYPE: ItemType = ItemTypes.Login;+/**+ * Whether a custom field of the given type should be masked in the UI.+ */+const isMaskedFieldType = (fieldType: FieldType): boolean =>+ fieldType === FieldTypes.Password || fieldType === FieldTypes.Hidden;+/*** Add or edit an item screen.*/@@ -670,7 +676,7 @@ export default function AddEditItemScreen(): React.ReactNode {tempId,label,fieldType,- isHidden: false,+ isHidden: isMaskedFieldType(fieldType),displayOrder: applicableSystemFields.length + customFields.length + 1};@@ -692,11 +698,11 @@ export default function AddEditItemScreen(): React.ReactNode {}, []);/**- * Update custom field label handler.+ * Update custom field handler. Both the label and the field type can be changed.*/- const handleUpdateCustomFieldLabel = useCallback((tempId: string, newLabel: string) => {+ const handleUpdateCustomField = useCallback((tempId: string, label: string, fieldType: FieldType) => {setCustomFields(prev => prev.map(f =>- f.tempId === tempId ? { ...f, label: newLabel } : f+ f.tempId === tempId ? { ...f, label, fieldType, isHidden: isMaskedFieldType(fieldType) } : f));setHasUnsavedChanges(true);}, []);@@ -1588,7 +1594,7 @@ export default function AddEditItemScreen(): React.ReactNode {fieldValues={fieldValues}onFieldsReorder={handleCustomFieldsReorder}onFieldValueChange={(tempId, value) => handleFieldChange(tempId, value)}- onFieldLabelChange={handleUpdateCustomFieldLabel}+ onFieldUpdate={handleUpdateCustomField}onFieldDelete={handleDeleteCustomField}/></FormSection>diff --git a/apps/mobile-app/components/form/AddFieldMenu.tsx b/apps/mobile-app/components/form/AddFieldMenu.tsxindex d315364e9..8760f8997 100644--- a/apps/mobile-app/components/form/AddFieldMenu.tsx+++ b/apps/mobile-app/components/form/AddFieldMenu.tsx@@ -5,8 +5,6 @@ import {View,StyleSheet,Modal,- TextInput,- ScrollView,TouchableOpacity,TouchableWithoutFeedback,} from 'react-native';@@ -18,7 +16,8 @@ import { useColors } from '@/hooks/useColorScheme';import { ThemedText } from '@/components/themed/ThemedText';import { RobustPressable } from '@/components/ui/RobustPressable';-import { ModalWrapper } from '@/components/common/ModalWrapper';++import { CustomFieldModal } from './CustomFieldModal';/*** Configuration for an optional section (not field-based).@@ -104,21 +103,6 @@ const getSectionIcon = (key: string): keyof typeof MaterialIcons.glyphMap => {}};-/**- * Available field types for custom fields.- */-const FIELD_TYPE_OPTIONS: { value: FieldType; labelKey: string }[] = [- { value: 'Text', labelKey: 'itemTypes.fieldTypes.text' },- { value: 'Password', labelKey: 'itemTypes.fieldTypes.password' },- { value: 'Hidden', labelKey: 'itemTypes.fieldTypes.hidden' },- { value: 'Email', labelKey: 'itemTypes.fieldTypes.email' },- { value: 'URL', labelKey: 'itemTypes.fieldTypes.url' },- { value: 'Phone', labelKey: 'itemTypes.fieldTypes.phone' },- { value: 'Number', labelKey: 'itemTypes.fieldTypes.number' },- { value: 'Date', labelKey: 'itemTypes.fieldTypes.date' },- { value: 'TextArea', labelKey: 'itemTypes.fieldTypes.textArea' },-];-/*** A dropdown menu for adding optional fields and sections to an item.* Dynamically determines which options to show based on system field registry@@ -134,8 +118,6 @@ export const AddFieldMenu: React.FC<AddFieldMenuProps> = ({const colors = useColors();const [isOpen, setIsOpen] = useState(false);const [showCustomFieldModal, setShowCustomFieldModal] = useState(false);- const [customFieldLabel, setCustomFieldLabel] = useState('');- const [customFieldType, setCustomFieldType] = useState<FieldType>('Text');const styles = StyleSheet.create({addButton: {@@ -154,78 +136,6 @@ export const AddFieldMenu: React.FC<AddFieldMenuProps> = ({fontWeight: '600',marginLeft: 8,},- customFieldModalButtons: {- flexDirection: 'row',- gap: 12,- marginTop: 16,- },- customFieldModalButton: {- alignItems: 'center',- borderRadius: 8,- flex: 1,- paddingVertical: 12,- },- customFieldModalButtonPrimary: {- backgroundColor: colors.primary,- },- customFieldModalButtonSecondary: {- backgroundColor: colors.accentBackground,- borderColor: colors.accentBorder,- borderWidth: 1,- },- customFieldModalButtonText: {- fontWeight: '600',- },- customFieldModalButtonTextPrimary: {- color: colors.primarySurfaceText,- },- customFieldModalButtonTextSecondary: {- color: colors.text,- },- customFieldModalInput: {- backgroundColor: colors.accentBackground,- borderColor: colors.accentBorder,- borderRadius: 8,- borderWidth: 1,- color: colors.text,- fontSize: 16,- marginBottom: 16,- paddingHorizontal: 12,- paddingVertical: 10,- },- customFieldModalLabel: {- color: colors.text,- fontSize: 14,- fontWeight: '600',- marginBottom: 8,- },- fieldTypeChip: {- backgroundColor: colors.accentBackground,- borderColor: colors.accentBorder,- borderRadius: 16,- borderWidth: 1,- marginRight: 8,- paddingHorizontal: 14,- paddingVertical: 8,- },- fieldTypeChipSelected: {- backgroundColor: colors.primary,- borderColor: colors.primary,- },- fieldTypeChipText: {- color: colors.text,- fontSize: 14,- },- fieldTypeChipTextSelected: {- color: colors.primarySurfaceText,- },- fieldTypeContainer: {- flexDirection: 'row',- paddingBottom: 16,- },- fieldTypeScrollView: {- marginBottom: 0,- },menuContainer: {backgroundColor: colors.background,borderColor: colors.accentBorder,@@ -281,29 +191,6 @@ export const AddFieldMenu: React.FC<AddFieldMenuProps> = ({setIsOpen(false);}, []);- /**- * Handle adding the custom field.- */- const handleAddCustomField = useCallback((): void => {- if (!customFieldLabel.trim()) {- return;- }-- callbacks.onAddCustomField(customFieldLabel, customFieldType);- setCustomFieldLabel('');- setCustomFieldType('Text');- setShowCustomFieldModal(false);- }, [customFieldLabel, customFieldType, callbacks]);-- /**- * Handle closing the custom field modal.- */- const handleCloseCustomFieldModal = useCallback((): void => {- setCustomFieldLabel('');- setCustomFieldType('Text');- setShowCustomFieldModal(false);- }, []);-/*** Build menu options based on optional system fields and sections.*/@@ -337,79 +224,6 @@ export const AddFieldMenu: React.FC<AddFieldMenuProps> = ({return options;}, [optionalSystemFields, visibleFieldKeys, optionalSections, t, handleAddSystemField, handleAddSection]);- const customFieldModalContent = (- <>- <ThemedText style={styles.customFieldModalLabel}>- {t('itemTypes.fieldLabel')}- </ThemedText>- <TextInput- style={styles.customFieldModalInput}- value={customFieldLabel}- onChangeText={setCustomFieldLabel}- placeholder={t('itemTypes.enterFieldName')}- placeholderTextColor={colors.textMuted}- autoFocus- />-- <ThemedText style={styles.customFieldModalLabel}>- {t('itemTypes.fieldType')}- </ThemedText>- <ScrollView- horizontal- showsHorizontalScrollIndicator={false}- style={styles.fieldTypeScrollView}- contentContainerStyle={styles.fieldTypeContainer}- >- {FIELD_TYPE_OPTIONS.map(option => (- <TouchableOpacity- key={option.value}- style={[- styles.fieldTypeChip,- customFieldType === option.value && styles.fieldTypeChipSelected,- ]}- onPress={() => setCustomFieldType(option.value as FieldType)}- activeOpacity={0.7}- >- <ThemedText- style={[- styles.fieldTypeChipText,- customFieldType === option.value && styles.fieldTypeChipTextSelected,- ]}- >- {t(option.labelKey)}- </ThemedText>- </TouchableOpacity>- ))}- </ScrollView>-- <View style={styles.customFieldModalButtons}>- <TouchableOpacity- style={[styles.customFieldModalButton, styles.customFieldModalButtonSecondary]}- onPress={handleCloseCustomFieldModal}- activeOpacity={0.7}- >- <ThemedText style={[styles.customFieldModalButtonText, styles.customFieldModalButtonTextSecondary]}>- {t('common.cancel')}- </ThemedText>- </TouchableOpacity>- <TouchableOpacity- style={[- styles.customFieldModalButton,- styles.customFieldModalButtonPrimary,- !customFieldLabel.trim() && { opacity: 0.5 },- ]}- onPress={handleAddCustomField}- disabled={!customFieldLabel.trim()}- activeOpacity={0.7}- >- <ThemedText style={[styles.customFieldModalButtonText, styles.customFieldModalButtonTextPrimary]}>- {t('common.add')}- </ThemedText>- </TouchableOpacity>- </View>- </>- );-return (<><RobustPressable@@ -475,16 +289,11 @@ export const AddFieldMenu: React.FC<AddFieldMenuProps> = ({</Modal>{/* Custom Field Modal - Uses ModalWrapper for centered dialog */}- <ModalWrapper+ <CustomFieldModalisOpen={showCustomFieldModal}- onClose={handleCloseCustomFieldModal}- title={t('itemTypes.addCustomField')}- keyboardAvoiding- showHeaderBorder={false}- showFooterBorder={false}- >- {customFieldModalContent}- </ModalWrapper>+ onClose={() => setShowCustomFieldModal(false)}+ onSubmit={callbacks.onAddCustomField}+ /></>);};diff --git a/apps/mobile-app/components/form/CustomFieldLabel.tsx b/apps/mobile-app/components/form/CustomFieldLabel.tsxnew file mode 100644index 000000000..b03292f34--- /dev/null+++ b/apps/mobile-app/components/form/CustomFieldLabel.tsx@@ -0,0 +1,82 @@+import { MaterialIcons } from '@expo/vector-icons';+import React from 'react';+import { View, StyleSheet, TouchableHighlight } from 'react-native';++import { useColors } from '@/hooks/useColorScheme';++import { ThemedText } from '@/components/themed/ThemedText';++type CustomFieldLabelProps = {+ label: string;+ onEdit: () => void;+ onDelete?: () => void;+ drag?: () => void;+}++/** Label row for a custom field with edit and delete buttons. */+export const CustomFieldLabel: React.FC<CustomFieldLabelProps> = ({+ label,+ onEdit,+ onDelete,+ drag+}) => {+ const colors = useColors();++ const styles = StyleSheet.create({+ actionButton: {+ borderRadius: 4,+ marginLeft: 4,+ padding: 2,+ },+ container: {+ alignItems: 'center',+ flexDirection: 'row',+ },+ deleteButton: {+ marginLeft: 4,+ },+ dragHandle: {+ marginLeft: 'auto',+ padding: 2,+ },+ editButton: {+ marginLeft: 4,+ padding: 2,+ },+ label: {+ color: colors.textMuted,+ fontSize: 12,+ },+ });++ return (+ <View style={styles.container}>+ <ThemedText style={styles.label}>{label}</ThemedText>+ <TouchableHighlight+ style={styles.editButton}+ onPress={onEdit}+ underlayColor={colors.accentBackground}+ >+ <MaterialIcons name="edit" size={14} color={colors.textMuted} />+ </TouchableHighlight>+ {onDelete && (+ <TouchableHighlight+ style={[styles.actionButton, styles.deleteButton]}+ onPress={onDelete}+ underlayColor={colors.accentBackground}+ >+ <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>+ );+};diff --git a/apps/mobile-app/components/form/CustomFieldModal.tsx b/apps/mobile-app/components/form/CustomFieldModal.tsxnew file mode 100644index 000000000..34b64e602--- /dev/null+++ b/apps/mobile-app/components/form/CustomFieldModal.tsx@@ -0,0 +1,237 @@+import React, { useCallback, useLayoutEffect, useState } from 'react';+import { useTranslation } from 'react-i18next';+import {+ View,+ StyleSheet,+ TextInput,+ ScrollView,+ TouchableOpacity,+} from 'react-native';++import type { FieldType } from '@/utils/dist/core/models/vault';+import { FieldTypes } from '@/utils/dist/core/models/vault';++import { useColors } from '@/hooks/useColorScheme';++import { ThemedText } from '@/components/themed/ThemedText';+import { ModalWrapper } from '@/components/common/ModalWrapper';++/**+ * Available field types for custom fields.+ */+const FIELD_TYPE_OPTIONS: { value: FieldType; labelKey: string }[] = [+ { value: FieldTypes.Text, labelKey: 'itemTypes.fieldTypes.text' },+ { value: FieldTypes.Password, labelKey: 'itemTypes.fieldTypes.password' },+ { value: FieldTypes.Hidden, labelKey: 'itemTypes.fieldTypes.hidden' },+ { value: FieldTypes.TextArea, labelKey: 'itemTypes.fieldTypes.textArea' },+ { value: FieldTypes.URL, labelKey: 'itemTypes.fieldTypes.url' },+ { value: FieldTypes.Email, labelKey: 'itemTypes.fieldTypes.email' },+ { value: FieldTypes.Phone, labelKey: 'itemTypes.fieldTypes.phone' },+ { value: FieldTypes.Number, labelKey: 'itemTypes.fieldTypes.number' },+ { value: FieldTypes.Date, labelKey: 'itemTypes.fieldTypes.date' },+];++type CustomFieldModalProps = {+ isOpen: boolean;+ /** Existing field values when editing, omitted when adding a new field */+ initialValues?: { label: string; fieldType: FieldType };+ onClose: () => void;+ onSubmit: (label: string, fieldType: FieldType) => void;+};++/**+ * Modal for creating and editing a custom field. Both the label and the field+ * type can be changed, so an existing field is edited through the same form+ * that created it.+ */+export const CustomFieldModal: React.FC<CustomFieldModalProps> = ({+ isOpen,+ initialValues,+ onClose,+ onSubmit,+}) => {+ const { t } = useTranslation();+ const colors = useColors();+ const isEditMode = initialValues !== undefined;+ const [label, setLabel] = useState('');+ const [fieldType, setFieldType] = useState<FieldType>(FieldTypes.Text);++ /**+ * Reset the form to the field being edited (or to defaults) whenever the modal opens.+ */+ useLayoutEffect(() => {+ if (isOpen) {+ setLabel(initialValues?.label ?? '');+ setFieldType(initialValues?.fieldType ?? FieldTypes.Text);+ }+ }, [isOpen, initialValues]);++ /**+ * Submit the form and close the modal.+ */+ const handleSubmit = useCallback((): void => {+ if (!label.trim()) {+ return;+ }++ onSubmit(label.trim(), fieldType);+ onClose();+ }, [label, fieldType, onSubmit, onClose]);++ const styles = StyleSheet.create({+ buttons: {+ flexDirection: 'row',+ gap: 12,+ marginTop: 16,+ },+ button: {+ alignItems: 'center',+ borderRadius: 8,+ flex: 1,+ paddingVertical: 12,+ },+ buttonPrimary: {+ backgroundColor: colors.primary,+ },+ buttonSecondary: {+ backgroundColor: colors.accentBackground,+ borderColor: colors.accentBorder,+ borderWidth: 1,+ },+ buttonText: {+ fontWeight: '600',+ },+ buttonTextPrimary: {+ color: colors.primarySurfaceText,+ },+ buttonTextSecondary: {+ color: colors.text,+ },+ input: {+ backgroundColor: colors.accentBackground,+ borderColor: colors.accentBorder,+ borderRadius: 8,+ borderWidth: 1,+ color: colors.text,+ fontSize: 16,+ marginBottom: 16,+ paddingHorizontal: 12,+ paddingVertical: 10,+ },+ inputLabel: {+ color: colors.text,+ fontSize: 14,+ fontWeight: '600',+ marginBottom: 8,+ },+ fieldTypeChip: {+ backgroundColor: colors.accentBackground,+ borderColor: colors.accentBorder,+ borderRadius: 16,+ borderWidth: 1,+ marginRight: 8,+ paddingHorizontal: 14,+ paddingVertical: 8,+ },+ fieldTypeChipSelected: {+ backgroundColor: colors.primary,+ borderColor: colors.primary,+ },+ fieldTypeChipText: {+ color: colors.text,+ fontSize: 14,+ },+ fieldTypeChipTextSelected: {+ color: colors.primarySurfaceText,+ },+ fieldTypeContainer: {+ flexDirection: 'row',+ paddingBottom: 16,+ },+ fieldTypeScrollView: {+ marginBottom: 0,+ },+ });++ return (+ <ModalWrapper+ isOpen={isOpen}+ onClose={onClose}+ title={isEditMode ? t('itemTypes.editCustomField') : t('itemTypes.addCustomField')}+ keyboardAvoiding+ showHeaderBorder={false}+ showFooterBorder={false}+ >+ <ThemedText style={styles.inputLabel}>+ {t('itemTypes.fieldLabel')}+ </ThemedText>+ <TextInput+ style={styles.input}+ value={label}+ onChangeText={setLabel}+ onSubmitEditing={handleSubmit}+ placeholder={t('itemTypes.enterFieldName')}+ placeholderTextColor={colors.textMuted}+ returnKeyType="done"+ autoFocus={!isEditMode}+ />++ <ThemedText style={styles.inputLabel}>+ {t('itemTypes.fieldType')}+ </ThemedText>+ <ScrollView+ horizontal+ showsHorizontalScrollIndicator={false}+ style={styles.fieldTypeScrollView}+ contentContainerStyle={styles.fieldTypeContainer}+ >+ {FIELD_TYPE_OPTIONS.map(option => (+ <TouchableOpacity+ key={option.value}+ style={[+ styles.fieldTypeChip,+ fieldType === option.value && styles.fieldTypeChipSelected,+ ]}+ onPress={() => setFieldType(option.value)}+ activeOpacity={0.7}+ >+ <ThemedText+ style={[+ styles.fieldTypeChipText,+ fieldType === option.value && styles.fieldTypeChipTextSelected,+ ]}+ >+ {t(option.labelKey)}+ </ThemedText>+ </TouchableOpacity>+ ))}+ </ScrollView>++ <View style={styles.buttons}>+ <TouchableOpacity+ style={[styles.button, styles.buttonSecondary]}+ onPress={onClose}+ activeOpacity={0.7}+ >+ <ThemedText style={[styles.buttonText, styles.buttonTextSecondary]}>+ {t('common.cancel')}+ </ThemedText>+ </TouchableOpacity>+ <TouchableOpacity+ style={[+ styles.button,+ styles.buttonPrimary,+ !label.trim() && { opacity: 0.5 },+ ]}+ onPress={handleSubmit}+ disabled={!label.trim()}+ activeOpacity={0.7}+ >+ <ThemedText style={[styles.buttonText, styles.buttonTextPrimary]}>+ {isEditMode ? t('common.save') : t('common.add')}+ </ThemedText>+ </TouchableOpacity>+ </View>+ </ModalWrapper>+ );+};diff --git a/apps/mobile-app/components/form/DraggableCustomFieldsList.tsx b/apps/mobile-app/components/form/DraggableCustomFieldsList.tsxindex 2b49c5dfd..a8379e6cb 100644--- a/apps/mobile-app/components/form/DraggableCustomFieldsList.tsx+++ b/apps/mobile-app/components/form/DraggableCustomFieldsList.tsx@@ -1,5 +1,5 @@import * as Haptics from 'expo-haptics';-import React, { useCallback } from 'react';+import React, { useCallback, useMemo, useState } from 'react';import { View, StyleSheet } from 'react-native';import DraggableFlatList, {RenderItemParams,@@ -12,7 +12,8 @@ import { HapticsUtility } from '@/utils/HapticsUtility';import { useColors } from '@/hooks/useColorScheme';import { AdvancedPasswordField } from './AdvancedPasswordField';-import { EditableFieldLabel } from './EditableFieldLabel';+import { CustomFieldLabel } from './CustomFieldLabel';+import { CustomFieldModal } from './CustomFieldModal';import { FormField } from './FormField';import { HiddenField } from './HiddenField';import { ResizableTextArea } from './ResizableTextArea';@@ -32,7 +33,7 @@ type CustomFieldItemProps = {field: CustomFieldDefinition;value: string;onValueChange: (value: string) => void;- onLabelChange: (newLabel: string) => void;+ onEdit: () => void;onDelete: () => void;drag: () => void;};@@ -44,7 +45,7 @@ const CustomFieldItem: React.FC<CustomFieldItemProps> = ({field,value,onValueChange,- onLabelChange,+ onEdit,onDelete,drag,}) => {@@ -108,9 +109,9 @@ const CustomFieldItem: React.FC<CustomFieldItemProps> = ({<View style={styles.container}>{/* Label row with inline, right-aligned drag handle */}<View style={styles.labelContainer}>- <EditableFieldLabel+ <CustomFieldLabellabel={field.label}- onLabelChange={onLabelChange}+ onEdit={onEdit}onDelete={onDelete}drag={drag}/>@@ -126,7 +127,7 @@ type DraggableCustomFieldsListProps = {fieldValues: Record<string, string | string[]>;onFieldsReorder: (reorderedFields: CustomFieldDefinition[]) => void;onFieldValueChange: (tempId: string, value: string) => void;- onFieldLabelChange: (tempId: string, newLabel: string) => void;+ onFieldUpdate: (tempId: string, label: string, fieldType: FieldType) => void;onFieldDelete: (tempId: string) => void;};@@ -139,9 +140,16 @@ export const DraggableCustomFieldsList: React.FC<DraggableCustomFieldsListProps>fieldValues,onFieldsReorder,onFieldValueChange,- onFieldLabelChange,+ onFieldUpdate,onFieldDelete,}) => {+ const [editingFieldId, setEditingFieldId] = useState<string | null>(null);+ const editingField = customFields.find((f) => f.tempId === editingFieldId);+ const editingValues = useMemo(+ () => editingField ? { label: editingField.label, fieldType: editingField.fieldType } : undefined,+ [editingField]+ );+/*** Handle drag begin*/@@ -172,33 +180,51 @@ export const DraggableCustomFieldsList: React.FC<DraggableCustomFieldsListProps>field={item}value={(fieldValues[item.tempId] as string) || ''}onValueChange={(value) => onFieldValueChange(item.tempId, value)}- onLabelChange={(newLabel) => onFieldLabelChange(item.tempId, newLabel)}+ onEdit={() => setEditingFieldId(item.tempId)}onDelete={() => onFieldDelete(item.tempId)}drag={drag}/></View>);- }, [fieldValues, onFieldValueChange, onFieldLabelChange, onFieldDelete]);+ }, [fieldValues, onFieldValueChange, onFieldDelete]);/*** Key extractor for FlatList*/const keyExtractor = useCallback((item: CustomFieldDefinition) => item.tempId, []);+ /**+ * Apply the edits made in the custom field modal to the field being edited.+ */+ const handleEditSubmit = useCallback((label: string, fieldType: FieldType) => {+ if (editingFieldId) {+ onFieldUpdate(editingFieldId, label, fieldType);+ }+ }, [editingFieldId, onFieldUpdate]);+if (customFields.length === 0) {return null;}return (- <DraggableFlatList- data={customFields}- onDragBegin={handleDragBegin}- onDragEnd={handleDragEnd}- keyExtractor={keyExtractor}- renderItem={renderItem}- containerStyle={styles.container}- scrollEnabled={false}- />+ <>+ <DraggableFlatList+ data={customFields}+ onDragBegin={handleDragBegin}+ onDragEnd={handleDragEnd}+ keyExtractor={keyExtractor}+ renderItem={renderItem}+ containerStyle={styles.container}+ scrollEnabled={false}+ />++ <CustomFieldModal+ isOpen={editingValues !== undefined}+ initialValues={editingValues}+ onClose={() => setEditingFieldId(null)}+ onSubmit={handleEditSubmit}+ />+ </>);};diff --git a/apps/mobile-app/components/form/EditableFieldLabel.tsx b/apps/mobile-app/components/form/EditableFieldLabel.tsxdeleted file mode 100644index 7c7fd7c82..000000000--- a/apps/mobile-app/components/form/EditableFieldLabel.tsx+++ /dev/null@@ -1,173 +0,0 @@-import { MaterialIcons } from '@expo/vector-icons';-import React, { useState, useRef, useEffect } from 'react';-import { View, TextInput, StyleSheet, TouchableHighlight, Keyboard } from 'react-native';--import { useColors } from '@/hooks/useColorScheme';--import { ThemedText } from '@/components/themed/ThemedText';--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;-}--/**- * Editable field label component with edit button.- * Shows label text with a small edit icon. When clicked, shows an input field.- */-export const EditableFieldLabel: React.FC<EditableFieldLabelProps> = ({- label,- onLabelChange,- onDelete,- drag-}) => {- const colors = useColors();- const [isEditing, setIsEditing] = useState(false);- const [editValue, setEditValue] = useState(label);- const inputRef = useRef<TextInput>(null);-- // Focus input when entering edit mode- useEffect(() => {- if (isEditing && inputRef.current) {- inputRef.current.focus();- }- }, [isEditing]);-- /**- * Handle the save action.- */- const handleSave = (): void => {- if (editValue.trim()) {- onLabelChange(editValue.trim());- setIsEditing(false);- Keyboard.dismiss();- }- };-- /**- * Handle the cancel action.- */- const handleCancel = (): void => {- setEditValue(label);- setIsEditing(false);- Keyboard.dismiss();- };-- const styles = StyleSheet.create({- actionButton: {- borderRadius: 4,- marginLeft: 4,- padding: 2,- },- cancelButton: {- marginLeft: 4,- },- container: {- alignItems: 'center',- flexDirection: 'row',- },- deleteButton: {- marginLeft: 4,- },- dragHandle: {- marginLeft: 'auto',- padding: 2,- },- editButton: {- marginLeft: 4,- padding: 2,- },- editContainer: {- alignItems: 'center',- flex: 1,- flexDirection: 'row',- },- editInput: {- backgroundColor: colors.background,- borderColor: colors.primary,- borderRadius: 4,- borderWidth: 1,- color: colors.text,- flex: 1,- fontSize: 12,- paddingHorizontal: 8,- paddingVertical: 4,- },- label: {- color: colors.textMuted,- fontSize: 12,- },- saveButton: {- marginLeft: 4,- },- });-- if (isEditing) {- return (- <View style={styles.container}>- <View style={styles.editContainer}>- <TextInput- ref={inputRef}- style={styles.editInput}- value={editValue}- onChangeText={setEditValue}- onSubmitEditing={handleSave}- placeholder="Field label"- placeholderTextColor={colors.textMuted}- autoCapitalize="none"- autoCorrect={false}- returnKeyType="done"- />- <TouchableHighlight- style={[styles.actionButton, styles.saveButton]}- onPress={handleSave}- underlayColor={colors.accentBackground}- >- <MaterialIcons name="check" size={18} color={colors.success} />- </TouchableHighlight>- <TouchableHighlight- style={[styles.actionButton, styles.cancelButton]}- onPress={handleCancel}- underlayColor={colors.accentBackground}- >- <MaterialIcons name="close" size={18} color={colors.textMuted} />- </TouchableHighlight>- </View>- </View>- );- }-- return (- <View style={styles.container}>- <ThemedText style={styles.label}>{label}</ThemedText>- <TouchableHighlight- style={styles.editButton}- onPress={() => setIsEditing(true)}- underlayColor={colors.accentBackground}- >- <MaterialIcons name="edit" size={14} color={colors.textMuted} />- </TouchableHighlight>- {onDelete && (- <TouchableHighlight- style={[styles.actionButton, styles.deleteButton]}- onPress={onDelete}- underlayColor={colors.accentBackground}- >- <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>- );-};diff --git a/apps/mobile-app/i18n/locales/en.json b/apps/mobile-app/i18n/locales/en.jsonindex 95f3bddb6..99f04ba96 100644--- a/apps/mobile-app/i18n/locales/en.json+++ b/apps/mobile-app/i18n/locales/en.json@@ -360,6 +360,7 @@},"addField": "Add Field","addCustomField": "Add Custom Field",+ "editCustomField": "Edit Custom Field","customFields": "Custom Fields","fieldLabel": "Field Label","fieldType": "Field Type",