Changeset View
Changeset View
Standalone View
Standalone View
native/chat/settings/add-users-modal.react.js
Show First 20 Lines • Show All 204 Lines • ▼ Show 20 Lines | (text: string) => { | ||||
if (!isLoading) { | if (!isLoading) { | ||||
setUsernameInputText(text); | setUsernameInputText(text); | ||||
} | } | ||||
}, | }, | ||||
[isLoading], | [isLoading], | ||||
); | ); | ||||
const onUserSelect = React.useCallback( | const onUserSelect = React.useCallback( | ||||
(userID: string) => { | ({ id }: AccountUserInfo) => { | ||||
if (isLoading) { | if (isLoading) { | ||||
return; | return; | ||||
} | } | ||||
if (userInfoInputIDs.some(existingUserID => userID === existingUserID)) { | if (userInfoInputIDs.some(existingUserID => id === existingUserID)) { | ||||
return; | return; | ||||
} | } | ||||
setUserInfoInputArray(oldUserInfoInputArray => [ | setUserInfoInputArray(oldUserInfoInputArray => [ | ||||
...oldUserInfoInputArray, | ...oldUserInfoInputArray, | ||||
otherUserInfos[userID], | otherUserInfos[id], | ||||
]); | ]); | ||||
setUsernameInputText(''); | setUsernameInputText(''); | ||||
}, | }, | ||||
[isLoading, userInfoInputIDs, otherUserInfos], | [isLoading, userInfoInputIDs, otherUserInfos], | ||||
); | ); | ||||
const inputProps = React.useMemo( | const inputProps = React.useMemo( | ||||
() => ({ | () => ({ | ||||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |