@@ -4,49 +4,30 @@ import { TouchableOpacity } from 'react-native-gesture-handler';
44import { useNavigation } from '@react-navigation/core' ;
55
66import {
7- DefaultAttachmentType ,
8- DefaultChannelType ,
9- DefaultCommandType ,
10- DefaultEventType ,
11- DefaultMessageType ,
12- DefaultReactionType ,
13- DefaultUserType ,
7+ DefaultStreamChatGenerics ,
148 MessageInputContextValue ,
159 Search ,
1610 SendRight ,
1711 SendUp ,
18- UnknownType ,
1912 useChannelContext ,
2013 useMessageInputContext ,
2114 useTheme ,
2215} from 'stream-chat-react-native' ;
2316
2417import { NewDirectMessagingScreenNavigationProp } from '../screens/NewDirectMessagingScreen' ;
2518
26- import { StreamChatGenerics } from '../types' ;
19+ import { StreamChatGenerics as LocalStreamChatGenerics } from '../types' ;
2720
2821type NewDirectMessagingSendButtonPropsWithContext <
29- At extends UnknownType = DefaultAttachmentType ,
30- Ch extends UnknownType = DefaultChannelType ,
31- Co extends string = DefaultCommandType ,
32- Ev extends UnknownType = DefaultEventType ,
33- Me extends UnknownType = DefaultMessageType ,
34- Re extends UnknownType = DefaultReactionType ,
35- Us extends UnknownType = DefaultUserType ,
36- > = Pick < MessageInputContextValue < At , Ch , Co , Ev , Me , Re , Us > , 'giphyActive' | 'sendMessage' > & {
22+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
23+ > = Pick < MessageInputContextValue < StreamChatGenerics > , 'giphyActive' | 'sendMessage' > & {
3724 /** Disables the button */ disabled : boolean ;
3825} ;
3926
4027const SendButtonWithContext = <
41- At extends UnknownType = DefaultAttachmentType ,
42- Ch extends UnknownType = DefaultChannelType ,
43- Co extends string = DefaultCommandType ,
44- Ev extends UnknownType = DefaultEventType ,
45- Me extends UnknownType = DefaultMessageType ,
46- Re extends UnknownType = DefaultReactionType ,
47- Us extends UnknownType = DefaultUserType ,
28+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
4829> (
49- props : NewDirectMessagingSendButtonPropsWithContext < At , Ch , Co , Ev , Me , Re , Us > ,
30+ props : NewDirectMessagingSendButtonPropsWithContext < StreamChatGenerics > ,
5031) => {
5132 const { disabled = false , giphyActive, sendMessage } = props ;
5233 const {
@@ -70,17 +51,9 @@ const SendButtonWithContext = <
7051 ) ;
7152} ;
7253
73- const areEqual = <
74- At extends UnknownType = DefaultAttachmentType ,
75- Ch extends UnknownType = DefaultChannelType ,
76- Co extends string = DefaultCommandType ,
77- Ev extends UnknownType = DefaultEventType ,
78- Me extends UnknownType = DefaultMessageType ,
79- Re extends UnknownType = DefaultReactionType ,
80- Us extends UnknownType = DefaultUserType ,
81- > (
82- prevProps : NewDirectMessagingSendButtonPropsWithContext < At , Ch , Co , Ev , Me , Re , Us > ,
83- nextProps : NewDirectMessagingSendButtonPropsWithContext < At , Ch , Co , Ev , Me , Re , Us > ,
54+ const areEqual = < StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics > (
55+ prevProps : NewDirectMessagingSendButtonPropsWithContext < StreamChatGenerics > ,
56+ nextProps : NewDirectMessagingSendButtonPropsWithContext < StreamChatGenerics > ,
8457) => {
8558 const {
8659 disabled : prevDisabled ,
@@ -117,23 +90,17 @@ const MemoizedNewDirectMessagingSendButton = React.memo(
11790) as typeof SendButtonWithContext ;
11891
11992export type SendButtonProps <
120- At extends UnknownType = DefaultAttachmentType ,
121- Ch extends UnknownType = DefaultChannelType ,
122- Co extends string = DefaultCommandType ,
123- Ev extends UnknownType = DefaultEventType ,
124- Me extends UnknownType = DefaultMessageType ,
125- Re extends UnknownType = DefaultReactionType ,
126- Us extends UnknownType = DefaultUserType ,
127- > = Partial < NewDirectMessagingSendButtonPropsWithContext < At , Ch , Co , Ev , Me , Re , Us > > ;
93+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
94+ > = Partial < NewDirectMessagingSendButtonPropsWithContext < StreamChatGenerics > > ;
12895
12996/**
13097 * UI Component for send button in MessageInput component.
13198 */
132- export const NewDirectMessagingSendButton = ( props : SendButtonProps < StreamChatGenerics > ) => {
99+ export const NewDirectMessagingSendButton = ( props : SendButtonProps < LocalStreamChatGenerics > ) => {
133100 const navigation = useNavigation < NewDirectMessagingScreenNavigationProp > ( ) ;
134- const { channel } = useChannelContext < StreamChatGenerics > ( ) ;
101+ const { channel } = useChannelContext < LocalStreamChatGenerics > ( ) ;
135102
136- const { giphyActive, text } = useMessageInputContext < StreamChatGenerics > ( ) ;
103+ const { giphyActive, text } = useMessageInputContext < LocalStreamChatGenerics > ( ) ;
137104
138105 const sendMessage = async ( ) => {
139106 if ( ! channel ) {
@@ -152,7 +119,7 @@ export const NewDirectMessagingSendButton = (props: SendButtonProps<StreamChatGe
152119 } ;
153120
154121 return (
155- < MemoizedNewDirectMessagingSendButton < StreamChatGenerics >
122+ < MemoizedNewDirectMessagingSendButton < LocalStreamChatGenerics >
156123 { ...{ giphyActive, sendMessage } }
157124 { ...props }
158125 { ...{ disabled : props . disabled || false } }
0 commit comments