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
Unknown Object (File)
Tue, Nov 5, 2:40 AM
Unknown Object (File)
Tue, Nov 5, 2:40 AM
Unknown Object (File)
Tue, Nov 5, 2:40 AM
Unknown Object (File)
Oct 8 2024, 10:02 AM
Unknown Object (File)
Sep 28 2024, 6:58 AM
Unknown Object (File)
Sep 28 2024, 6:58 AM
Unknown Object (File)
Sep 28 2024, 6:58 AM
Unknown Object (File)
Sep 28 2024, 6:58 AM
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 ↗(On Diff #24795)

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 ↗(On Diff #24795)

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 ↗(On Diff #24795)

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