Skip to content

Commit

Permalink
UserStatusScreen [nfc]: Improve some variable names.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbobbe committed Aug 13, 2021
1 parent 3a3ba04 commit 124deaa
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/user-status/UserStatusScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ export default function UserStatusScreen(props: Props) {
const [statusText, setStatusText] = useState<string>(userStatusText);
const _ = useContext(TranslationContext);

const updateStatusText = useCallback(
const sendToServer = useCallback(
(_statusText: string) => {
dispatch(updateUserStatusText(_statusText));
NavigationService.dispatch(navigateBack());
},
[dispatch],
);

const handleStatusTextUpdate = useCallback(() => {
updateStatusText(statusText);
}, [statusText, updateStatusText]);
const handlePressUpdate = useCallback(() => {
sendToServer(statusText);
}, [statusText, sendToServer]);

const handleStatusTextClear = useCallback(() => {
const handlePressClear = useCallback(() => {
setStatusText('');
updateStatusText('');
}, [updateStatusText]);
sendToServer('');
}, [sendToServer]);

return (
<Screen title="User status">
Expand Down Expand Up @@ -88,13 +88,13 @@ export default function UserStatusScreen(props: Props) {
style={styles.button}
secondary
text="Clear"
onPress={handleStatusTextClear}
onPress={handlePressClear}
Icon={IconCancel}
/>
<ZulipButton
style={styles.button}
text="Update"
onPress={handleStatusTextUpdate}
onPress={handlePressUpdate}
Icon={IconDone}
/>
</View>
Expand Down

0 comments on commit 124deaa

Please sign in to comment.