stream-chat-react-native-core 9.6.1-beta.1 → 9.6.1-beta.3
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/utils/buildGallery/buildThumbnail.js +6 -1
- package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +3 -0
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/InputButtons/AttachButton.js +8 -2
- package/lib/commonjs/components/MessageInput/components/InputButtons/AttachButton.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js +6 -1
- package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +3 -0
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/MessageInput/components/InputButtons/AttachButton.js +8 -2
- package/lib/module/components/MessageInput/components/InputButtons/AttachButton.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/utils/buildGallery/buildThumbnail.d.ts.map +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/InputButtons/AttachButton.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +8 -0
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Attachment/__tests__/buildGallery.test.ts +35 -1
- package/src/components/Attachment/utils/buildGallery/buildThumbnail.ts +9 -1
- package/src/components/Channel/Channel.tsx +3 -0
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -0
- package/src/components/MessageInput/__tests__/AttachButton.test.tsx +31 -0
- package/src/components/MessageInput/components/InputButtons/AttachButton.tsx +12 -2
- package/src/contexts/messageInputContext/MessageInputContext.tsx +9 -0
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -0
- package/src/version.json +1 -1
|
@@ -80,6 +80,14 @@ export type InputMessageInputContextValue = {
|
|
|
80
80
|
localMessage: LocalMessage;
|
|
81
81
|
options?: UpdateMessageOptions;
|
|
82
82
|
}) => ReturnType<StreamChat['updateMessage']>;
|
|
83
|
+
/**
|
|
84
|
+
* Controls what happens when the attach button is pressed while the attachment picker is open.
|
|
85
|
+
* When true (default), the message input is focused, toggling from the picker to the keyboard.
|
|
86
|
+
* When false, the attachment picker is closed without focusing the input.
|
|
87
|
+
* @type boolean
|
|
88
|
+
* @default true
|
|
89
|
+
*/
|
|
90
|
+
focusInputOnPickerClose: boolean;
|
|
83
91
|
/** When false, CameraSelectorIcon will be hidden */
|
|
84
92
|
hasCameraPicker: boolean;
|
|
85
93
|
/** When false, CommandsButton will be hidden */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageInputContext.d.ts","sourceRoot":"","sources":["../../../../src/contexts/messageInputContext/MessageInputContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,iBAAiB,EACjB,GAAG,EAMJ,MAAM,OAAO,CAAC;AACf,OAAO,EAAkB,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGzE,OAAO,EACL,YAAY,EAEZ,kBAAkB,EAClB,UAAU,EACV,OAAO,IAAI,aAAa,EACxB,oBAAoB,EACpB,eAAe,EAChB,MAAM,aAAa,CAAC;AAgBrB,OAAO,EAA6B,UAAU,EAAkB,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAazC,MAAM,MAAM,wBAAwB,GAAG;IACrC,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACjD,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC;;OAEG;IACH,kCAAkC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC;;OAEG;IACH,cAAc,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;IAC7C;;OAEG;IACH,kBAAkB,EAAE,CAClB,SAAS,CAAC,EAAE,UAAU,KACnB,OAAO,CAAC;QAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ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CAUlC,CAAC"}
|
|
1
|
+
{"version":3,"file":"MessageInputContext.d.ts","sourceRoot":"","sources":["../../../../src/contexts/messageInputContext/MessageInputContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,iBAAiB,EACjB,GAAG,EAMJ,MAAM,OAAO,CAAC;AACf,OAAO,EAAkB,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGzE,OAAO,EACL,YAAY,EAEZ,kBAAkB,EAClB,UAAU,EACV,OAAO,IAAI,aAAa,EACxB,oBAAoB,EACpB,eAAe,EAChB,MAAM,aAAa,CAAC;AAgBrB,OAAO,EAA6B,UAAU,EAAkB,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAazC,MAAM,MAAM,wBAAwB,GAAG;IACrC,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACjD,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC;;OAEG;IACH,kCAAkC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC;;OAEG;IACH,cAAc,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;IAC7C;;OAEG;IACH,kBAAkB,EAAE,CAClB,SAAS,CAAC,EAAE,UAAU,KACnB,OAAO,CAAC;QAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC;IAC9E,aAAa,EAAE,C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,4 +1,4 @@
|
|
|
1
1
|
import type { ThreadContextValue } from '../../threadContext/ThreadContext';
|
|
2
2
|
import type { MessageInputContextValue } from '../MessageInputContext';
|
|
3
|
-
export declare const useCreateMessageInputContext: ({ additionalTextInputProps, allowSendBeforeAttachmentsUpload, asyncMessagesLockDistance, asyncMessagesMinimumPressDuration, asyncMessagesSlideToCancelDistance, audioRecordingSendOnComplete, attachmentPickerBottomSheetHeight, attachmentSelectionBarHeight, audioRecordingEnabled, closeAttachmentPicker, closePollCreationDialog, compressImageQuality, createPollOptionGap, editMessage, handleAttachButtonPress, hasCameraPicker, hasCommands, hasFilePicker, hasImagePicker, inputBoxRef, messageInputFloating, messageInputHeightStore, openAttachmentPicker, openPollCreationDialog, pickAndUploadImageFromNativePicker, pickFile, sendMessage, setInputBoxRef, setInputRef, showPollCreationDialog, takeAndUploadImage, uploadNewFile, audioRecorderManager, startVoiceRecording, deleteVoiceRecording, uploadVoiceRecording, stopVoiceRecording, thread, }: MessageInputContextValue & Pick<ThreadContextValue, "thread">) => MessageInputContextValue;
|
|
3
|
+
export declare const useCreateMessageInputContext: ({ additionalTextInputProps, allowSendBeforeAttachmentsUpload, asyncMessagesLockDistance, asyncMessagesMinimumPressDuration, asyncMessagesSlideToCancelDistance, audioRecordingSendOnComplete, attachmentPickerBottomSheetHeight, attachmentSelectionBarHeight, audioRecordingEnabled, closeAttachmentPicker, closePollCreationDialog, compressImageQuality, createPollOptionGap, editMessage, focusInputOnPickerClose, handleAttachButtonPress, hasCameraPicker, hasCommands, hasFilePicker, hasImagePicker, inputBoxRef, messageInputFloating, messageInputHeightStore, openAttachmentPicker, openPollCreationDialog, pickAndUploadImageFromNativePicker, pickFile, sendMessage, setInputBoxRef, setInputRef, showPollCreationDialog, takeAndUploadImage, uploadNewFile, audioRecorderManager, startVoiceRecording, deleteVoiceRecording, uploadVoiceRecording, stopVoiceRecording, thread, }: MessageInputContextValue & Pick<ThreadContextValue, "thread">) => MessageInputContextValue;
|
|
4
4
|
//# sourceMappingURL=useCreateMessageInputContext.d.ts.map
|
package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateMessageInputContext.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,eAAO,MAAM,4BAA4B,GAAI,
|
|
1
|
+
{"version":3,"file":"useCreateMessageInputContext.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,eAAO,MAAM,4BAA4B,GAAI,g2BAwC1C,wBAAwB,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,6BAiD/D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native-core",
|
|
3
3
|
"description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "9.6.1-beta.
|
|
4
|
+
"version": "9.6.1-beta.3",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Attachment } from 'stream-chat';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
generateImageAttachment,
|
|
5
|
+
generateVideoAttachment,
|
|
6
|
+
} from '../../../mock-builders/generator/attachment';
|
|
4
7
|
import { buildGallery } from '../utils/buildGallery/buildGallery';
|
|
5
8
|
|
|
6
9
|
describe('buildGallery', () => {
|
|
@@ -126,4 +129,35 @@ describe('buildGallery', () => {
|
|
|
126
129
|
expect(t2.url.includes('&w=*')).toBe(true);
|
|
127
130
|
expect(t2.url.includes('&resize=*')).toBe(true);
|
|
128
131
|
});
|
|
132
|
+
|
|
133
|
+
it('resizes the thumb_url of a video attachment', () => {
|
|
134
|
+
const video = generateVideoAttachment({
|
|
135
|
+
image_url:
|
|
136
|
+
'https://us-east.stream-io-cdn.com/23kn4k2j3n4k2n3k4n23?sig=34k23n4k23nk423&oh=2532&ow=1170&s=v',
|
|
137
|
+
thumb_url:
|
|
138
|
+
'https://us-east.stream-io-cdn.com/23kn4k2j3n4k2n3k4n23?sig=34k23n4k23nk423&oh=2532&ow=1170&s=v',
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
const { thumbnailGrid } = buildGallery({
|
|
142
|
+
images: [video],
|
|
143
|
+
sizeConfig: defaultSizeConfig,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
const thumbnail = thumbnailGrid[0][0];
|
|
147
|
+
expect(thumbnail.thumb_url?.includes('&h=')).toBe(true);
|
|
148
|
+
expect(thumbnail.thumb_url?.includes('&w=')).toBe(true);
|
|
149
|
+
expect(thumbnail.thumb_url?.includes('&resize=clip')).toBe(true);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('leaves a non-resizable thumb_url untouched', () => {
|
|
153
|
+
const thumbUrl = 'https://not-a-stream-cdn.example.com/thumb.jpg';
|
|
154
|
+
const video = generateVideoAttachment({ thumb_url: thumbUrl });
|
|
155
|
+
|
|
156
|
+
const { thumbnailGrid } = buildGallery({
|
|
157
|
+
images: [video],
|
|
158
|
+
sizeConfig: defaultSizeConfig,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
expect(thumbnailGrid[0][0].thumb_url).toBe(thumbUrl);
|
|
162
|
+
});
|
|
129
163
|
});
|
|
@@ -42,7 +42,15 @@ export function buildThumbnail({
|
|
|
42
42
|
resizeMode: resizeMode
|
|
43
43
|
? resizeMode
|
|
44
44
|
: ((image.original_height && image.original_width ? 'contain' : 'cover') as ImageResizeMode),
|
|
45
|
-
thumb_url:
|
|
45
|
+
thumb_url:
|
|
46
|
+
image.thumb_url && shouldResize
|
|
47
|
+
? getResizedImageUrl({
|
|
48
|
+
height,
|
|
49
|
+
resizableCDNHosts,
|
|
50
|
+
url: image.thumb_url,
|
|
51
|
+
width,
|
|
52
|
+
})
|
|
53
|
+
: image.thumb_url,
|
|
46
54
|
type: image.type,
|
|
47
55
|
url: shouldResize
|
|
48
56
|
? getResizedImageUrl({
|
|
@@ -218,6 +218,7 @@ export type ChannelPropsWithContext = Pick<ChannelContextValue, 'channel'> &
|
|
|
218
218
|
| 'compressImageQuality'
|
|
219
219
|
| 'createPollOptionGap'
|
|
220
220
|
| 'doFileUploadRequest'
|
|
221
|
+
| 'focusInputOnPickerClose'
|
|
221
222
|
| 'handleAttachButtonPress'
|
|
222
223
|
| 'hasCameraPicker'
|
|
223
224
|
| 'hasCommands'
|
|
@@ -423,6 +424,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
|
|
|
423
424
|
enableSwipeToReply = true,
|
|
424
425
|
enforceUniqueReaction = false,
|
|
425
426
|
FlatList = NativeHandlers.FlatList,
|
|
427
|
+
focusInputOnPickerClose = true,
|
|
426
428
|
forceAlignMessages,
|
|
427
429
|
getMessageGroupStyle,
|
|
428
430
|
handleAttachButtonPress,
|
|
@@ -1651,6 +1653,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
|
|
|
1651
1653
|
createPollOptionGap,
|
|
1652
1654
|
doFileUploadRequest,
|
|
1653
1655
|
editMessage,
|
|
1656
|
+
focusInputOnPickerClose,
|
|
1654
1657
|
handleAttachButtonPress,
|
|
1655
1658
|
hasCameraPicker,
|
|
1656
1659
|
hasCommands: hasCommands ?? !!clientChannelConfig?.commands?.length,
|
|
@@ -17,6 +17,7 @@ export const useCreateInputMessageInputContext = ({
|
|
|
17
17
|
createPollOptionGap,
|
|
18
18
|
doFileUploadRequest,
|
|
19
19
|
editMessage,
|
|
20
|
+
focusInputOnPickerClose,
|
|
20
21
|
handleAttachButtonPress,
|
|
21
22
|
hasCameraPicker,
|
|
22
23
|
hasCommands,
|
|
@@ -49,6 +50,7 @@ export const useCreateInputMessageInputContext = ({
|
|
|
49
50
|
createPollOptionGap,
|
|
50
51
|
doFileUploadRequest,
|
|
51
52
|
editMessage,
|
|
53
|
+
focusInputOnPickerClose,
|
|
52
54
|
handleAttachButtonPress,
|
|
53
55
|
hasCameraPicker,
|
|
54
56
|
hasCommands,
|
|
@@ -180,4 +180,35 @@ describe('AttachButton', () => {
|
|
|
180
180
|
expect(queryByTestId('attachment-picker-list')).toBeTruthy();
|
|
181
181
|
});
|
|
182
182
|
});
|
|
183
|
+
|
|
184
|
+
it('should close the attachment picker on second press when focusInputOnPickerClose is false', async () => {
|
|
185
|
+
jest.spyOn(NativeHandler, 'isImageMediaLibraryAvailable').mockImplementation(() => true);
|
|
186
|
+
|
|
187
|
+
const channelProps = { channel, focusInputOnPickerClose: false };
|
|
188
|
+
const props = {};
|
|
189
|
+
|
|
190
|
+
renderComponent({ channelProps, client, props });
|
|
191
|
+
|
|
192
|
+
const { queryByTestId } = screen;
|
|
193
|
+
|
|
194
|
+
await waitFor(() => {
|
|
195
|
+
expect(queryByTestId('attach-button')).toBeTruthy();
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
act(() => {
|
|
199
|
+
fireEvent.press(screen.getByTestId('attach-button'));
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
await waitFor(() => {
|
|
203
|
+
expect(queryByTestId('attachment-picker-list')).toBeTruthy();
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
act(() => {
|
|
207
|
+
fireEvent.press(screen.getByTestId('attach-button'));
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
await waitFor(() => {
|
|
211
|
+
expect(queryByTestId('attachment-picker-list')).toBeNull();
|
|
212
|
+
});
|
|
213
|
+
});
|
|
183
214
|
});
|
|
@@ -92,13 +92,23 @@ export type AttachButtonProps = Partial<AttachButtonPropsWithContext>;
|
|
|
92
92
|
*/
|
|
93
93
|
export const AttachButton = (props: AttachButtonProps) => {
|
|
94
94
|
const { disableAttachmentPicker } = useAttachmentPickerContext();
|
|
95
|
-
const {
|
|
95
|
+
const {
|
|
96
|
+
closeAttachmentPicker,
|
|
97
|
+
focusInputOnPickerClose,
|
|
98
|
+
handleAttachButtonPress,
|
|
99
|
+
inputBoxRef,
|
|
100
|
+
openAttachmentPicker,
|
|
101
|
+
} = useMessageInputContext();
|
|
96
102
|
const { attachmentPickerStore } = useAttachmentPickerContext();
|
|
97
103
|
const { selectedPicker } = useAttachmentPickerState();
|
|
98
104
|
|
|
99
105
|
const toggleAttachmentPicker = useStableCallback(() => {
|
|
100
106
|
if (attachmentPickerStore.state.getLatestValue().selectedPicker) {
|
|
101
|
-
|
|
107
|
+
if (focusInputOnPickerClose) {
|
|
108
|
+
inputBoxRef.current?.focus();
|
|
109
|
+
} else {
|
|
110
|
+
closeAttachmentPicker();
|
|
111
|
+
}
|
|
102
112
|
} else {
|
|
103
113
|
openAttachmentPicker();
|
|
104
114
|
}
|
|
@@ -128,6 +128,15 @@ export type InputMessageInputContextValue = {
|
|
|
128
128
|
options?: UpdateMessageOptions;
|
|
129
129
|
}) => ReturnType<StreamChat['updateMessage']>;
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Controls what happens when the attach button is pressed while the attachment picker is open.
|
|
133
|
+
* When true (default), the message input is focused, toggling from the picker to the keyboard.
|
|
134
|
+
* When false, the attachment picker is closed without focusing the input.
|
|
135
|
+
* @type boolean
|
|
136
|
+
* @default true
|
|
137
|
+
*/
|
|
138
|
+
focusInputOnPickerClose: boolean;
|
|
139
|
+
|
|
131
140
|
/** When false, CameraSelectorIcon will be hidden */
|
|
132
141
|
hasCameraPicker: boolean;
|
|
133
142
|
|
|
@@ -18,6 +18,7 @@ export const useCreateMessageInputContext = ({
|
|
|
18
18
|
compressImageQuality,
|
|
19
19
|
createPollOptionGap,
|
|
20
20
|
editMessage,
|
|
21
|
+
focusInputOnPickerClose,
|
|
21
22
|
handleAttachButtonPress,
|
|
22
23
|
hasCameraPicker,
|
|
23
24
|
hasCommands,
|
|
@@ -61,6 +62,7 @@ export const useCreateMessageInputContext = ({
|
|
|
61
62
|
compressImageQuality,
|
|
62
63
|
createPollOptionGap,
|
|
63
64
|
editMessage,
|
|
65
|
+
focusInputOnPickerClose,
|
|
64
66
|
handleAttachButtonPress,
|
|
65
67
|
hasCameraPicker,
|
|
66
68
|
hasCommands,
|
package/src/version.json
CHANGED