Skip to content

Commit 8e516b6

Browse files
committed
UserStatusScreen [nfc]: Consistently represent "unset" in statusText state
We've *said* statusText is `string | null` (changed from `string | void` in our recent model rework, 2106381). I would like to make it `string`, to match the `value` prop of the `Input` component type. That seems like a responsible thing for UserStatusScreen to do, since it's using the Input as a controlled input: https://reactjs.org/docs/forms.html#controlled-components Before we do that, we should at least fix this inconsistency, where the value of the input corresponds to "unset" (empty string) but statusText doesn't represent "unset" the way it says it will (null). It hasn't been a live bug, and this is NFC, because it just so happens that api.updateUserStatus converts to the empty string anyway, to talk to the server.
1 parent e6e8f21 commit 8e516b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/user-statuses/UserStatusScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default function UserStatusScreen(props: Props): Node {
7171
style={styles.statusTextInput}
7272
placeholder="What’s your status?"
7373
value={statusText ?? ''}
74-
onChangeText={setStatusText}
74+
onChangeText={text => setStatusText(text || null)}
7575
/>
7676
<FlatList
7777
data={statusSuggestions}

0 commit comments

Comments
 (0)