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)
Sat, Dec 7, 8:38 PM
Unknown Object (File)
Sat, Dec 7, 8:38 PM
Unknown Object (File)
Sat, Dec 7, 8:38 PM
Unknown Object (File)
Wed, Nov 27, 3:03 PM
Unknown Object (File)
Nov 16 2024, 8:26 AM
Unknown Object (File)
Nov 8 2024, 5:05 PM
Unknown Object (File)
Nov 8 2024, 5:05 PM
Unknown Object (File)
Nov 8 2024, 5:05 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 ↗(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