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 => , [], 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 =