Page MenuHomePhabricator

[native] Copy the edited message content to ChatInputBar when entering edit mode
ClosedPublic

Authored by kuba on Apr 7 2023, 7:19 AM.
Tags
None
Referenced Files
F3187791: D7346.id24959.diff
Fri, Nov 8, 5:05 PM
F3187777: D7346.id24963.diff
Fri, Nov 8, 5:05 PM
F3187769: D7346.id24795.diff
Fri, Nov 8, 5:05 PM
F3187765: D7346.id25665.diff
Fri, Nov 8, 5:05 PM
F3187719: D7346.id.diff
Fri, Nov 8, 5:04 PM
F3187616: D7346.diff
Fri, Nov 8, 4:42 PM
F3185555: D7346.id24963.diff
Fri, Nov 8, 12:59 PM
F3185552: D7346.id25665.diff
Fri, Nov 8, 12:59 PM
Subscribers

Details

Summary

We want to set the content of the edited message in the ChatInputBar when entering edit mode. We need a callback, to always have the latest state.

Test Plan

Run the app on iOS. Checked if when entering the edit mode the content of the message is copied to the InputBar.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

kuba added inline comments.
native/input/input-state-container.react.js
1213

I had to add the callback, to have the updated state when editing the ChatInputBar. It is necessary, especially for later diffs, where I store the message draft when entering edit mode.

native/chat/text-message-tooltip-modal.react.js
68–73

Shouldn't this be inside React.useCallback?
Although I suppose if you wrap onPressEdit then there is no need, because they have the same dependencies.

kuba marked an inline comment as done.
This comment was removed by kuba.

Moved useCallback change to the earlier diff

native/chat/text-message-tooltip-modal.react.js
68–73

I wrapped the whole onPressEdit with React.useCallback in earlier diff.

This revision is now accepted and ready to land.Apr 12 2023, 5:16 AM