Page MenuHomePhabricator

D7346.id24959.diff
No OneTemporary

D7346.id24959.diff

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
@@ -60,13 +60,19 @@
const { item } = route.params;
const { messageInfo } = item;
- const onPressEdit = () => {
+ const onPressEdit = React.useCallback(() => {
invariant(
inputState,
'inputState should be set in TextMessageTooltipModal.onPressEdit',
);
- inputState.setEditedMessageID(messageInfo.id);
- };
+ const updateInputBar = () => {
+ inputState.editInputMessage({
+ message: text,
+ mode: 'replace',
+ });
+ };
+ inputState.setEditedMessageID(messageInfo.id, updateInputBar);
+ }, [inputState, messageInfo.id, text]);
const renderEditIcon = React.useCallback(
style => <SWMansionIcon name="edit-1" style={style} size={16} />,
[],
diff --git a/native/input/input-state-container.react.js b/native/input/input-state-container.react.js
--- a/native/input/input-state-container.react.js
+++ b/native/input/input-state-container.react.js
@@ -1210,10 +1210,13 @@
this.editInputBarCallbacks.push(callbackEditInputBar);
};
- setEditedMessageID = (messageID: ?string) => {
- this.setState({
- editState: { editedMessageID: messageID },
- });
+ setEditedMessageID = (messageID: ?string, callback?: () => void) => {
+ this.setState(
+ {
+ editState: { editedMessageID: messageID },
+ },
+ callback,
+ );
};
removeEditInputMessageListener = (
diff --git a/native/input/input-state.js b/native/input/input-state.js
--- a/native/input/input-state.js
+++ b/native/input/input-state.js
@@ -64,7 +64,10 @@
pendingThreadUpdateHandler: ?(ThreadInfo) => mixed,
) => void,
+editState: EditState,
- +setEditedMessageID: (editedMessageID: ?string) => void,
+ +setEditedMessageID: (
+ editedMessageID: ?string,
+ callback?: () => void,
+ ) => void,
};
const InputStateContext: React.Context<?InputState> =

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 8:26 PM (11 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2703090
Default Alt Text
D7346.id24959.diff (2 KB)

Event Timeline