stream-chat-react-native-core 4.2.0 → 4.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Attachment/Giphy.js +57 -26
- package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +28 -13
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +6 -0
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +24 -21
- package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +50 -173
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/InputEditingStateHeader.js +138 -0
- package/lib/commonjs/components/MessageInput/components/InputEditingStateHeader.js.map +1 -0
- package/lib/commonjs/components/MessageInput/components/InputGiphySearch.js +179 -0
- package/lib/commonjs/components/MessageInput/components/InputGiphySearch.js.map +1 -0
- package/lib/commonjs/components/MessageInput/components/InputReplyStateHeader.js +138 -0
- package/lib/commonjs/components/MessageInput/components/InputReplyStateHeader.js.map +1 -0
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +2 -2
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +6 -0
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayContext.js +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +15 -12
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +8 -2
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Giphy.js +57 -26
- package/lib/module/components/Attachment/Giphy.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +28 -13
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +6 -0
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +24 -21
- package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +50 -173
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageInput/components/InputEditingStateHeader.js +138 -0
- package/lib/module/components/MessageInput/components/InputEditingStateHeader.js.map +1 -0
- package/lib/module/components/MessageInput/components/InputGiphySearch.js +179 -0
- package/lib/module/components/MessageInput/components/InputGiphySearch.js.map +1 -0
- package/lib/module/components/MessageInput/components/InputReplyStateHeader.js +138 -0
- package/lib/module/components/MessageInput/components/InputReplyStateHeader.js.map +1 -0
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +2 -2
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +6 -0
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayContext.js +1 -1
- package/lib/module/contexts/overlayContext/OverlayContext.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayProvider.js +15 -12
- package/lib/module/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +8 -2
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Giphy.d.ts +5 -3
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
- package/lib/typescript/components/ImageGallery/ImageGallery.d.ts +2 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
- package/lib/typescript/components/MessageInput/components/InputEditingStateHeader.d.ts +10 -0
- package/lib/typescript/components/MessageInput/components/InputGiphySearch.d.ts +10 -0
- package/lib/typescript/components/MessageInput/components/InputReplyStateHeader.d.ts +10 -0
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +7 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts +5 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +8 -2
- package/package.json +1 -1
- package/src/components/Attachment/Giphy.tsx +41 -12
- package/src/components/Channel/Channel.tsx +9 -0
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +6 -0
- package/src/components/ImageGallery/ImageGallery.tsx +11 -6
- package/src/components/MessageInput/MessageInput.tsx +28 -109
- package/src/components/MessageInput/__tests__/__snapshots__/MessageInput.test.js.snap +0 -2
- package/src/components/MessageInput/components/InputEditingStateHeader.tsx +102 -0
- package/src/components/MessageInput/components/InputGiphySearch.tsx +129 -0
- package/src/components/MessageInput/components/InputReplyStateHeader.tsx +102 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +9 -0
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +6 -0
- package/src/contexts/overlayContext/OverlayContext.tsx +5 -0
- package/src/contexts/overlayContext/OverlayProvider.tsx +2 -0
- package/src/contexts/themeContext/utils/theme.ts +16 -4
- package/src/version.json +1 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { ChannelContextValue } from '../../../contexts/channelContext/ChannelContext';
|
|
5
|
+
import {
|
|
6
|
+
MessageInputContextValue,
|
|
7
|
+
useMessageInputContext,
|
|
8
|
+
} from '../../../contexts/messageInputContext/MessageInputContext';
|
|
9
|
+
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
10
|
+
|
|
11
|
+
import { CircleClose, Lightning } from '../../../icons';
|
|
12
|
+
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
13
|
+
import { AutoCompleteInput } from '../../AutoCompleteInput/AutoCompleteInput';
|
|
14
|
+
import { useCountdown } from '../hooks/useCountdown';
|
|
15
|
+
|
|
16
|
+
const styles = StyleSheet.create({
|
|
17
|
+
autoCompleteInputContainer: {
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
flexDirection: 'row',
|
|
20
|
+
paddingLeft: 8,
|
|
21
|
+
paddingRight: 10,
|
|
22
|
+
},
|
|
23
|
+
giphyContainer: {
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
borderRadius: 12,
|
|
26
|
+
flexDirection: 'row',
|
|
27
|
+
height: 24,
|
|
28
|
+
marginRight: 8,
|
|
29
|
+
paddingHorizontal: 8,
|
|
30
|
+
},
|
|
31
|
+
giphyText: {
|
|
32
|
+
fontSize: 12,
|
|
33
|
+
fontWeight: 'bold',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export type InputGiphySearchPropsWithContext<
|
|
38
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
39
|
+
> = Pick<
|
|
40
|
+
MessageInputContextValue<StreamChatGenerics>,
|
|
41
|
+
'additionalTextInputProps' | 'cooldownEndsAt' | 'setGiphyActive' | 'setShowMoreOptions'
|
|
42
|
+
> &
|
|
43
|
+
Pick<ChannelContextValue<StreamChatGenerics>, 'disabled'>;
|
|
44
|
+
|
|
45
|
+
export const InputGiphySearchWithContext = <
|
|
46
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
47
|
+
>({
|
|
48
|
+
additionalTextInputProps,
|
|
49
|
+
cooldownEndsAt,
|
|
50
|
+
disabled,
|
|
51
|
+
setGiphyActive,
|
|
52
|
+
setShowMoreOptions,
|
|
53
|
+
}: InputGiphySearchPropsWithContext<StreamChatGenerics>) => {
|
|
54
|
+
const { seconds: cooldownRemainingSeconds } = useCountdown(cooldownEndsAt);
|
|
55
|
+
|
|
56
|
+
const {
|
|
57
|
+
theme: {
|
|
58
|
+
colors: { accent_blue, grey, white },
|
|
59
|
+
messageInput: {
|
|
60
|
+
autoCompleteInputContainer,
|
|
61
|
+
giphyCommandInput: { giphyContainer, giphyText },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
} = useTheme();
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<View style={[styles.autoCompleteInputContainer, autoCompleteInputContainer]}>
|
|
68
|
+
<View style={[styles.giphyContainer, { backgroundColor: accent_blue }, giphyContainer]}>
|
|
69
|
+
<Lightning height={16} pathFill={white} width={16} />
|
|
70
|
+
<Text style={[styles.giphyText, { color: white }, giphyText]}>GIPHY</Text>
|
|
71
|
+
</View>
|
|
72
|
+
|
|
73
|
+
<AutoCompleteInput<StreamChatGenerics>
|
|
74
|
+
additionalTextInputProps={additionalTextInputProps}
|
|
75
|
+
cooldownActive={!!cooldownRemainingSeconds}
|
|
76
|
+
/>
|
|
77
|
+
<TouchableOpacity
|
|
78
|
+
disabled={disabled}
|
|
79
|
+
onPress={() => {
|
|
80
|
+
setGiphyActive(false);
|
|
81
|
+
setShowMoreOptions(true);
|
|
82
|
+
}}
|
|
83
|
+
testID='close-button'
|
|
84
|
+
>
|
|
85
|
+
<CircleClose height={20} pathFill={grey} width={20} />
|
|
86
|
+
</TouchableOpacity>
|
|
87
|
+
</View>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(
|
|
92
|
+
prevProps: InputGiphySearchPropsWithContext<StreamChatGenerics>,
|
|
93
|
+
nextProps: InputGiphySearchPropsWithContext<StreamChatGenerics>,
|
|
94
|
+
) => {
|
|
95
|
+
const { disabled: prevDisabled } = prevProps;
|
|
96
|
+
const { disabled: nextDisabled } = nextProps;
|
|
97
|
+
|
|
98
|
+
const disabledEqual = prevDisabled === nextDisabled;
|
|
99
|
+
if (!disabledEqual) return false;
|
|
100
|
+
|
|
101
|
+
return true;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const MemoizedInputGiphySearch = React.memo(
|
|
105
|
+
InputGiphySearchWithContext,
|
|
106
|
+
areEqual,
|
|
107
|
+
) as typeof InputGiphySearchWithContext;
|
|
108
|
+
|
|
109
|
+
export type InputGiphySearchProps<
|
|
110
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
111
|
+
> = Partial<InputGiphySearchPropsWithContext<StreamChatGenerics>>;
|
|
112
|
+
|
|
113
|
+
export const InputGiphySearch = <
|
|
114
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
115
|
+
>(
|
|
116
|
+
props: InputGiphySearchProps<StreamChatGenerics>,
|
|
117
|
+
) => {
|
|
118
|
+
const { additionalTextInputProps, cooldownEndsAt, setGiphyActive, setShowMoreOptions } =
|
|
119
|
+
useMessageInputContext<StreamChatGenerics>();
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<MemoizedInputGiphySearch
|
|
123
|
+
{...{ additionalTextInputProps, cooldownEndsAt, setGiphyActive, setShowMoreOptions }}
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
InputGiphySearch.displayName = 'InputGiphySearch{messageInput}';
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { ChannelContextValue } from '../../../contexts/channelContext/ChannelContext';
|
|
5
|
+
import {
|
|
6
|
+
MessageInputContextValue,
|
|
7
|
+
useMessageInputContext,
|
|
8
|
+
} from '../../../contexts/messageInputContext/MessageInputContext';
|
|
9
|
+
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
10
|
+
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
|
|
11
|
+
|
|
12
|
+
import { CircleClose, CurveLineLeftUp } from '../../../icons';
|
|
13
|
+
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
14
|
+
|
|
15
|
+
const styles = StyleSheet.create({
|
|
16
|
+
replyBoxHeader: {
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
flexDirection: 'row',
|
|
19
|
+
justifyContent: 'space-between',
|
|
20
|
+
paddingBottom: 10,
|
|
21
|
+
},
|
|
22
|
+
replyBoxHeaderTitle: {
|
|
23
|
+
fontSize: 14,
|
|
24
|
+
fontWeight: 'bold',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export type InputReplyStateHeaderPropsWithContext<
|
|
29
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
30
|
+
> = Pick<MessageInputContextValue<StreamChatGenerics>, 'clearQuotedMessageState' | 'resetInput'> &
|
|
31
|
+
Pick<ChannelContextValue<StreamChatGenerics>, 'disabled'>;
|
|
32
|
+
|
|
33
|
+
export const InputReplyStateHeaderWithContext = <
|
|
34
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
35
|
+
>({
|
|
36
|
+
clearQuotedMessageState,
|
|
37
|
+
disabled,
|
|
38
|
+
resetInput,
|
|
39
|
+
}: InputReplyStateHeaderPropsWithContext<StreamChatGenerics>) => {
|
|
40
|
+
const { t } = useTranslationContext();
|
|
41
|
+
const {
|
|
42
|
+
theme: {
|
|
43
|
+
colors: { black, grey, grey_gainsboro },
|
|
44
|
+
messageInput: {
|
|
45
|
+
editingStateHeader: { editingBoxHeader, editingBoxHeaderTitle },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
} = useTheme();
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<View style={[styles.replyBoxHeader, editingBoxHeader]}>
|
|
52
|
+
<CurveLineLeftUp pathFill={grey_gainsboro} />
|
|
53
|
+
<Text style={[styles.replyBoxHeaderTitle, { color: black }, editingBoxHeaderTitle]}>
|
|
54
|
+
{t('Reply to Message')}
|
|
55
|
+
</Text>
|
|
56
|
+
<TouchableOpacity
|
|
57
|
+
disabled={disabled}
|
|
58
|
+
onPress={() => {
|
|
59
|
+
resetInput();
|
|
60
|
+
clearQuotedMessageState();
|
|
61
|
+
}}
|
|
62
|
+
testID='close-button'
|
|
63
|
+
>
|
|
64
|
+
<CircleClose pathFill={grey} />
|
|
65
|
+
</TouchableOpacity>
|
|
66
|
+
</View>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(
|
|
71
|
+
prevProps: InputReplyStateHeaderPropsWithContext<StreamChatGenerics>,
|
|
72
|
+
nextProps: InputReplyStateHeaderPropsWithContext<StreamChatGenerics>,
|
|
73
|
+
) => {
|
|
74
|
+
const { disabled: prevDisabled } = prevProps;
|
|
75
|
+
const { disabled: nextDisabled } = nextProps;
|
|
76
|
+
|
|
77
|
+
const disabledEqual = prevDisabled === nextDisabled;
|
|
78
|
+
if (!disabledEqual) return false;
|
|
79
|
+
|
|
80
|
+
return true;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const MemoizedInputReplyStateHeader = React.memo(
|
|
84
|
+
InputReplyStateHeaderWithContext,
|
|
85
|
+
areEqual,
|
|
86
|
+
) as typeof InputReplyStateHeaderWithContext;
|
|
87
|
+
|
|
88
|
+
export type InputReplyStateHeaderProps<
|
|
89
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
90
|
+
> = Partial<InputReplyStateHeaderPropsWithContext<StreamChatGenerics>>;
|
|
91
|
+
|
|
92
|
+
export const InputReplyStateHeader = <
|
|
93
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
94
|
+
>(
|
|
95
|
+
props: InputReplyStateHeaderProps<StreamChatGenerics>,
|
|
96
|
+
) => {
|
|
97
|
+
const { clearQuotedMessageState, resetInput } = useMessageInputContext<StreamChatGenerics>();
|
|
98
|
+
|
|
99
|
+
return <MemoizedInputReplyStateHeader {...{ clearQuotedMessageState, resetInput }} {...props} />;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
InputReplyStateHeader.displayName = 'ReplyStateHeader{messageInput}';
|
|
@@ -22,6 +22,9 @@ import { isEditingBoolean, useMessageDetailsForState } from './hooks/useMessageD
|
|
|
22
22
|
|
|
23
23
|
import type { AttachButtonProps } from '../../components/MessageInput/AttachButton';
|
|
24
24
|
import type { CommandsButtonProps } from '../../components/MessageInput/CommandsButton';
|
|
25
|
+
import type { InputEditingStateHeaderProps } from '../../components/MessageInput/components/InputEditingStateHeader';
|
|
26
|
+
import type { InputGiphySearchProps } from '../../components/MessageInput/components/InputGiphySearch';
|
|
27
|
+
import type { InputReplyStateHeaderProps } from '../../components/MessageInput/components/InputReplyStateHeader';
|
|
25
28
|
import type { CooldownTimerProps } from '../../components/MessageInput/CooldownTimer';
|
|
26
29
|
import type { FileUploadPreviewProps } from '../../components/MessageInput/FileUploadPreview';
|
|
27
30
|
import { useCooldown } from '../../components/MessageInput/hooks/useCooldown';
|
|
@@ -239,11 +242,13 @@ export type InputMessageInputContextValue<
|
|
|
239
242
|
CooldownTimer: React.ComponentType<CooldownTimerProps>;
|
|
240
243
|
editing: boolean | MessageType<StreamChatGenerics>;
|
|
241
244
|
editMessage: StreamChat<StreamChatGenerics>['updateMessage'];
|
|
245
|
+
|
|
242
246
|
/**
|
|
243
247
|
* Custom UI component for FileUploadPreview.
|
|
244
248
|
* Defaults to and accepts same props as: https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageInput/FileUploadPreview.tsx
|
|
245
249
|
*/
|
|
246
250
|
FileUploadPreview: React.ComponentType<FileUploadPreviewProps<StreamChatGenerics>>;
|
|
251
|
+
|
|
247
252
|
/** When false, CommandsButton will be hidden */
|
|
248
253
|
hasCommands: boolean;
|
|
249
254
|
/** When false, FileSelectorIcon will be hidden */
|
|
@@ -255,6 +260,9 @@ export type InputMessageInputContextValue<
|
|
|
255
260
|
* Defaults to and accepts same props as: https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageInput/ImageUploadPreview.tsx
|
|
256
261
|
*/
|
|
257
262
|
ImageUploadPreview: React.ComponentType<ImageUploadPreviewProps<StreamChatGenerics>>;
|
|
263
|
+
InputEditingStateHeader: React.ComponentType<InputEditingStateHeaderProps<StreamChatGenerics>>;
|
|
264
|
+
InputGiphySearch: React.ComponentType<InputGiphySearchProps<StreamChatGenerics>>;
|
|
265
|
+
InputReplyStateHeader: React.ComponentType<InputReplyStateHeaderProps<StreamChatGenerics>>;
|
|
258
266
|
/** Limit on allowed number of files to attach at a time. */
|
|
259
267
|
maxNumberOfFiles: number;
|
|
260
268
|
/**
|
|
@@ -341,6 +349,7 @@ export type InputMessageInputContextValue<
|
|
|
341
349
|
},
|
|
342
350
|
channel: ChannelContextValue<StreamChatGenerics>['channel'],
|
|
343
351
|
) => Promise<SendFileAPIResponse>;
|
|
352
|
+
|
|
344
353
|
/** Initial value to set on input */
|
|
345
354
|
initialValue?: string;
|
|
346
355
|
/**
|
|
@@ -36,6 +36,9 @@ export const useCreateMessageInputContext = <
|
|
|
36
36
|
Input,
|
|
37
37
|
inputBoxRef,
|
|
38
38
|
InputButtons,
|
|
39
|
+
InputEditingStateHeader,
|
|
40
|
+
InputGiphySearch,
|
|
41
|
+
InputReplyStateHeader,
|
|
39
42
|
isValidMessage,
|
|
40
43
|
maxMessageLength,
|
|
41
44
|
maxNumberOfFiles,
|
|
@@ -134,6 +137,9 @@ export const useCreateMessageInputContext = <
|
|
|
134
137
|
Input,
|
|
135
138
|
inputBoxRef,
|
|
136
139
|
InputButtons,
|
|
140
|
+
InputEditingStateHeader,
|
|
141
|
+
InputGiphySearch,
|
|
142
|
+
InputReplyStateHeader,
|
|
137
143
|
isValidMessage,
|
|
138
144
|
maxMessageLength,
|
|
139
145
|
maxNumberOfFiles,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
|
|
3
3
|
import type { BottomSheetMethods } from '@gorhom/bottom-sheet/lib/typescript/types';
|
|
4
|
+
import type { Attachment } from 'stream-chat';
|
|
4
5
|
|
|
5
6
|
import type { AttachmentPickerProps } from '../../components/AttachmentPicker/AttachmentPicker';
|
|
6
7
|
import type { ImageGalleryCustomComponents } from '../../components/ImageGallery/ImageGallery';
|
|
@@ -52,6 +53,10 @@ export type OverlayProviderProps<
|
|
|
52
53
|
>
|
|
53
54
|
> &
|
|
54
55
|
Pick<OverlayContextValue, 'translucentStatusBar'> & {
|
|
56
|
+
/**
|
|
57
|
+
* The giphy version to render - check the keys of the [Image Object](https://developers.giphy.com/docs/api/schema#image-object) for possible values. Uses 'fixed_height' by default
|
|
58
|
+
* */
|
|
59
|
+
giphyVersion: keyof NonNullable<Attachment['giphy']>;
|
|
55
60
|
closePicker?: (ref: React.RefObject<BottomSheetMethods>) => void;
|
|
56
61
|
error?: boolean | Error;
|
|
57
62
|
/** https://github.com/GetStream/stream-chat-react-native/wiki/Internationalization-(i18n) */
|
|
@@ -81,6 +81,7 @@ export const OverlayProvider = <
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
FileSelectorIcon = DefaultFileSelectorIcon,
|
|
84
|
+
giphyVersion = 'fixed_height',
|
|
84
85
|
i18nInstance,
|
|
85
86
|
imageGalleryCustomComponents,
|
|
86
87
|
imageGalleryGridHandleHeight,
|
|
@@ -222,6 +223,7 @@ export const OverlayProvider = <
|
|
|
222
223
|
)}
|
|
223
224
|
{overlay === 'gallery' && (
|
|
224
225
|
<ImageGallery<StreamChatGenerics>
|
|
226
|
+
giphyVersion={giphyVersion}
|
|
225
227
|
imageGalleryCustomComponents={imageGalleryCustomComponents}
|
|
226
228
|
imageGalleryGridHandleHeight={imageGalleryGridHandleHeight}
|
|
227
229
|
imageGalleryGridSnapPoints={imageGalleryGridSnapPoints}
|
|
@@ -233,6 +233,10 @@ export type Theme = {
|
|
|
233
233
|
editingBoxContainer: ViewStyle;
|
|
234
234
|
editingBoxHeader: ViewStyle;
|
|
235
235
|
editingBoxHeaderTitle: TextStyle;
|
|
236
|
+
editingStateHeader: {
|
|
237
|
+
editingBoxHeader: ViewStyle;
|
|
238
|
+
editingBoxHeaderTitle: TextStyle;
|
|
239
|
+
};
|
|
236
240
|
fileUploadPreview: {
|
|
237
241
|
dismiss: ViewStyle;
|
|
238
242
|
fileContainer: ViewStyle;
|
|
@@ -242,8 +246,10 @@ export type Theme = {
|
|
|
242
246
|
fileTextContainer: ViewStyle;
|
|
243
247
|
flatList: ViewStyle;
|
|
244
248
|
};
|
|
245
|
-
|
|
246
|
-
|
|
249
|
+
giphyCommandInput: {
|
|
250
|
+
giphyContainer: ViewStyle;
|
|
251
|
+
giphyText: TextStyle;
|
|
252
|
+
};
|
|
247
253
|
imageUploadPreview: {
|
|
248
254
|
dismiss: ViewStyle;
|
|
249
255
|
flatList: ViewStyle;
|
|
@@ -695,6 +701,10 @@ export const defaultTheme: Theme = {
|
|
|
695
701
|
editingBoxContainer: {},
|
|
696
702
|
editingBoxHeader: {},
|
|
697
703
|
editingBoxHeaderTitle: {},
|
|
704
|
+
editingStateHeader: {
|
|
705
|
+
editingBoxHeader: {},
|
|
706
|
+
editingBoxHeaderTitle: {},
|
|
707
|
+
},
|
|
698
708
|
fileUploadPreview: {
|
|
699
709
|
dismiss: {},
|
|
700
710
|
fileContainer: {},
|
|
@@ -704,8 +714,10 @@ export const defaultTheme: Theme = {
|
|
|
704
714
|
fileTextContainer: {},
|
|
705
715
|
flatList: {},
|
|
706
716
|
},
|
|
707
|
-
|
|
708
|
-
|
|
717
|
+
giphyCommandInput: {
|
|
718
|
+
giphyContainer: {},
|
|
719
|
+
giphyText: {},
|
|
720
|
+
},
|
|
709
721
|
imageUploadPreview: {
|
|
710
722
|
dismiss: {},
|
|
711
723
|
flatList: {},
|
package/src/version.json
CHANGED