Page MenuHomePhabricator

[native] Move isExitingDuringEditMode in ChatInputBar to a ref in function component
ClosedPublic

Authored by angelika on Nov 22 2024, 4:33 AM.
Tags
None
Referenced Files
F3520286: D14008.id46112.diff
Sun, Dec 22, 11:54 PM
Unknown Object (File)
Thu, Dec 19, 6:36 PM
Unknown Object (File)
Wed, Dec 18, 7:13 PM
Unknown Object (File)
Mon, Dec 16, 2:54 PM
Unknown Object (File)
Sat, Dec 14, 2:34 PM
Unknown Object (File)
Fri, Dec 13, 7:25 PM
Unknown Object (File)
Mon, Dec 9, 1:13 PM
Unknown Object (File)
Mon, Dec 9, 12:35 PM
Subscribers

Details

Summary
Test Plan

Tested this diff stack by playing around with ChatInputBar on both iOS simulator and Android device:

  • focus the text input and verify the keyboard is up and the camera buttons are animated correctly
  • try to send the message, verify the send button is animated correctly
  • verify the text input can be unfocused and keyboard is hidden
  • verify the draft works: write text, navigate from the chat, navigate into the chat again, verify the text is kept and the $
  • verify the edit mode works by editing a message
  • try to close the chat while editing a message - the alert should be shown
  • try to join a thread
  • try to select typed text

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This diff migrates a state to a ref, so I did some additional reading to see if that makes sense. I wondered if there might be some reason why isExitingDuringEditMode was originally implemented as React component state instead of an instance variable, and in particular I was trying to see if it's used during render anywhere.

I wasn't able to find any places where isExitingDuringEditMode is used during render. It appears to only be used for "spot checks" in various callbacks, so I think it makes sense to migrate it to a ref.

This revision is now accepted and ready to land.Sat, Nov 23, 9:45 AM