Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix rename attachment does not work on iOS

Ammar Ahmed73c44d476b3c
diff --git a/apps/mobile/app/components/attachments/actions.tsx b/apps/mobile/app/components/attachments/actions.tsx
index d8b198d7e..17e95fc24 100644
--- a/apps/mobile/app/components/attachments/actions.tsx
+++ b/apps/mobile/app/components/attachments/actions.tsx
@@ -153,24 +153,32 @@ const Actions = ({
{
name: strings.rename(),
onPress: () => {
- presentDialog({
- input: true,
- title: strings.renameFile(),
- defaultValue: attachment.filename,
- positivePress: async (value) => {
- if (value && value.length > 0) {
- await db.attachments.add({
- hash: attachment.hash,
- filename: value
- });
- setFilename(value);
- setAttachments();
- eSendEvent(eDBItemUpdate, attachment.id);
- }
- return true;
- },
- positiveText: strings.rename()
- });
+ close?.();
+ setTimeout(() => {
+ presentDialog({
+ input: true,
+ inputPlaceholder: strings.enterTitle(),
+ title: strings.renameFile(),
+ defaultValue: attachment.filename,
+ positivePress: async (value) => {
+ if (value && value.length > 0) {
+ await db.attachments.add({
+ hash: attachment.hash,
+ filename: value
+ });
+ setFilename(value);
+ setAttachments();
+ eSendEvent(eDBItemUpdate, attachment.id);
+ ToastManager.show({
+ message: `Attachment renamed to ${value}`,
+ type: "success"
+ });
+ }
+ return true;
+ },
+ positiveText: strings.rename()
+ });
+ }, 500);
},
icon: "form-textbox"
},