Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32216435
D8411.1765167219.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D8411.1765167219.diff
View Options
diff --git a/native/chat/chat-input-bar.react.js b/native/chat/chat-input-bar.react.js
--- a/native/chat/chat-input-bar.react.js
+++ b/native/chat/chat-input-bar.react.js
@@ -901,7 +901,9 @@
this.unblockNavigation();
navigation.dispatch(action);
};
- exitEditAlert(unblockAndDispatch);
+ exitEditAlert({
+ onDiscard: unblockAndDispatch,
+ });
return 'ignore_action';
};
@@ -946,7 +948,9 @@
this.exitEditMode();
return;
}
- exitEditAlert(this.exitEditMode);
+ exitEditAlert({
+ onDiscard: this.exitEditMode,
+ });
};
scrollToEditedMessage = () => {
@@ -1001,7 +1005,9 @@
saveExit();
return;
}
- exitEditAlert(saveExit);
+ exitEditAlert({
+ onDiscard: saveExit,
+ });
};
onPressJoin = () => {
diff --git a/native/chat/text-message-tooltip-modal.react.js b/native/chat/text-message-tooltip-modal.react.js
--- a/native/chat/text-message-tooltip-modal.react.js
+++ b/native/chat/text-message-tooltip-modal.react.js
@@ -83,7 +83,9 @@
};
const { editedMessage, isEditedMessageChanged } = inputState.editState;
if (isEditedMessageChanged && editedMessage) {
- exitEditAlert(enterEditMode);
+ exitEditAlert({
+ onDiscard: enterEditMode,
+ });
} else {
enterEditMode();
}
diff --git a/native/utils/edit-messages-utils.js b/native/utils/edit-messages-utils.js
--- a/native/utils/edit-messages-utils.js
+++ b/native/utils/edit-messages-utils.js
@@ -2,7 +2,13 @@
import Alert from 'react-native/Libraries/Alert/Alert.js';
-function exitEditAlert(onDiscard: () => void): void {
+type ExitAlertOptions = {
+ onDiscard: () => void,
+ onContinueEditing?: () => void,
+};
+
+function exitEditAlert(options: ExitAlertOptions): void {
+ const { onDiscard, onContinueEditing } = options;
Alert.alert(
'Discard changes?',
'You have unsaved changes which will be discarded if you navigate away.',
@@ -10,6 +16,7 @@
{
text: 'Continue editing',
style: 'cancel',
+ onPress: onContinueEditing,
},
{
text: 'Discard edit',
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 8, 4:13 AM (10 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5846997
Default Alt Text
D8411.1765167219.diff (2 KB)
Attached To
Mode
D8411: [native] Refactor exitEditAlert function
Attached
Detach File
Event Timeline
Log In to Comment