Support group chats across other surfaces (#10266)
This commit is contained in:
@@ -77,6 +77,15 @@ export function NewChat({
|
||||
[control, createGroupChat],
|
||||
)
|
||||
|
||||
const onSelectExistingChat = useCallback(
|
||||
(chatId: string) => {
|
||||
control.close(() => {
|
||||
onNewChat(chatId)
|
||||
})
|
||||
},
|
||||
[control, onNewChat],
|
||||
)
|
||||
|
||||
const onPress = useCallback(() => {
|
||||
control.open()
|
||||
}, [control])
|
||||
@@ -112,7 +121,13 @@ export function NewChat({
|
||||
) : (
|
||||
<SearchablePeopleList
|
||||
title={l`Start a new chat`}
|
||||
onSelectChat={onCreateChat}
|
||||
onSelectChat={chat => {
|
||||
if (chat.kind === 'user') {
|
||||
onCreateChat(chat.did)
|
||||
} else {
|
||||
onSelectExistingChat(chat.id)
|
||||
}
|
||||
}}
|
||||
sortByMessageDeclaration
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -53,6 +53,13 @@ function SendViaChatDialogInner({
|
||||
},
|
||||
})
|
||||
|
||||
const onSelectExistingChat = useCallback(
|
||||
(chatId: string) => {
|
||||
control.close(() => onSelectChat(chatId))
|
||||
},
|
||||
[control, onSelectChat],
|
||||
)
|
||||
|
||||
const onCreateChat = useCallback(
|
||||
(did: string) => {
|
||||
control.close(() => createChat([did]))
|
||||
@@ -63,7 +70,13 @@ function SendViaChatDialogInner({
|
||||
return (
|
||||
<SearchablePeopleList
|
||||
title={_(msg`Send post to...`)}
|
||||
onSelectChat={onCreateChat}
|
||||
onSelectChat={chat => {
|
||||
if (chat.kind === 'user') {
|
||||
onCreateChat(chat.did)
|
||||
} else {
|
||||
onSelectExistingChat(chat.id)
|
||||
}
|
||||
}}
|
||||
showRecentConvos
|
||||
sortByMessageDeclaration
|
||||
/>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export {BottomSheetTextInput as TextInput} from '@discord/bottom-sheet/src'
|
||||
@@ -1 +0,0 @@
|
||||
export {TextInput} from 'react-native'
|
||||
Reference in New Issue
Block a user