@@ -50,7 +50,11 @@ import { CreatePollIcon as DefaultCreatePollIcon } from '../../components/Poll/c
5050import {
5151 AttachmentPickerContextValue ,
5252 AttachmentPickerProvider ,
53+ ImageGalleryProvider ,
54+ ImageGalleryProviderProps ,
5355 MessageContextValue ,
56+ OverlayContextValue ,
57+ useOverlayContext ,
5458} from '../../contexts' ;
5559import {
5660 AudioPlayerContextProps ,
@@ -140,6 +144,7 @@ import { ImageOverlaySelectedComponent as DefaultImageOverlaySelectedComponent }
140144import { AutoCompleteSuggestionHeader as AutoCompleteSuggestionHeaderDefault } from '../AutoCompleteInput/AutoCompleteSuggestionHeader' ;
141145import { AutoCompleteSuggestionItem as AutoCompleteSuggestionItemDefault } from '../AutoCompleteInput/AutoCompleteSuggestionItem' ;
142146import { AutoCompleteSuggestionList as AutoCompleteSuggestionListDefault } from '../AutoCompleteInput/AutoCompleteSuggestionList' ;
147+ import { ImageGallery } from '../ImageGallery/ImageGallery' ;
143148import { EmptyStateIndicator as EmptyStateIndicatorDefault } from '../Indicators/EmptyStateIndicator' ;
144149import {
145150 LoadingErrorIndicator as LoadingErrorIndicatorDefault ,
@@ -263,6 +268,8 @@ const debounceOptions = {
263268} ;
264269
265270export type ChannelPropsWithContext = Pick < ChannelContextValue , 'channel' > &
271+ Partial < ImageGalleryProviderProps > &
272+ Pick < OverlayContextValue , 'overlay' | 'overlayOpacity' > &
266273 Partial <
267274 Pick < AttachmentPickerContextValue , 'bottomInset' | 'topInset' | 'disableAttachmentPicker' >
268275 > &
@@ -575,7 +582,14 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
575582 attachmentPickerErrorText,
576583 numberOfAttachmentImagesToLoadPerCall = 60 ,
577584 numberOfAttachmentPickerImageColumns = 3 ,
578-
585+ autoPlayVideo = false ,
586+ giphyVersion = 'fixed_height' ,
587+ imageGalleryCustomComponents,
588+ imageGalleryGridHandleHeight = 40 ,
589+ imageGalleryGridSnapPoints,
590+ numberOfImageGalleryGridColumns = 3 ,
591+ overlay,
592+ overlayOpacity,
579593 bottomInset = 0 ,
580594 CameraSelectorIcon = DefaultCameraSelectorIcon ,
581595 FileSelectorIcon = DefaultFileSelectorIcon ,
@@ -620,7 +634,6 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
620634 Gallery = GalleryDefault ,
621635 getMessagesGroupStyles,
622636 Giphy = GiphyDefault ,
623- giphyVersion = 'fixed_height' ,
624637 handleAttachButtonPress,
625638 handleBan,
626639 handleCopy,
@@ -1747,6 +1760,25 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
17471760 ] ,
17481761 ) ;
17491762
1763+ const imageGalleryProviderProps = useMemo (
1764+ ( ) => ( {
1765+ autoPlayVideo,
1766+ giphyVersion,
1767+ imageGalleryCustomComponents,
1768+ imageGalleryGridHandleHeight,
1769+ imageGalleryGridSnapPoints,
1770+ numberOfImageGalleryGridColumns,
1771+ } ) ,
1772+ [
1773+ autoPlayVideo ,
1774+ giphyVersion ,
1775+ imageGalleryCustomComponents ,
1776+ imageGalleryGridHandleHeight ,
1777+ imageGalleryGridSnapPoints ,
1778+ numberOfImageGalleryGridColumns ,
1779+ ] ,
1780+ ) ;
1781+
17501782 const attachmentPickerContext = useMemo (
17511783 ( ) => ( {
17521784 bottomInset,
@@ -2044,37 +2076,40 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
20442076 }
20452077
20462078 return (
2047- < KeyboardCompatibleView
2048- behavior = { keyboardBehavior }
2049- enabled = { ! disableKeyboardCompatibleView }
2050- keyboardVerticalOffset = { keyboardVerticalOffset }
2051- { ...additionalKeyboardAvoidingViewProps }
2052- >
2053- < ChannelProvider value = { channelContext } >
2054- < OwnCapabilitiesProvider value = { ownCapabilitiesContext } >
2055- < TypingProvider value = { typingContext } >
2056- < PaginatedMessageListProvider value = { messageListContext } >
2057- < MessagesProvider value = { messagesContext } >
2058- < ThreadProvider value = { threadContext } >
2059- < AttachmentPickerProvider value = { attachmentPickerContext } >
2060- < MessageComposerProvider value = { messageComposerContext } >
2061- < MessageInputProvider value = { inputMessageInputContext } >
2062- < AudioPlayerProvider value = { audioPlayerContext } >
2063- < View style = { { height : '100%' } } > { children } </ View >
2064- { ! disableAttachmentPicker && (
2065- < AttachmentPicker ref = { bottomSheetRef } { ...attachmentPickerProps } />
2066- ) }
2067- </ AudioPlayerProvider >
2068- </ MessageInputProvider >
2069- </ MessageComposerProvider >
2070- </ AttachmentPickerProvider >
2071- </ ThreadProvider >
2072- </ MessagesProvider >
2073- </ PaginatedMessageListProvider >
2074- </ TypingProvider >
2075- </ OwnCapabilitiesProvider >
2076- </ ChannelProvider >
2077- </ KeyboardCompatibleView >
2079+ < ImageGalleryProvider value = { imageGalleryProviderProps } >
2080+ < KeyboardCompatibleView
2081+ behavior = { keyboardBehavior }
2082+ enabled = { ! disableKeyboardCompatibleView }
2083+ keyboardVerticalOffset = { keyboardVerticalOffset }
2084+ { ...additionalKeyboardAvoidingViewProps }
2085+ >
2086+ < ChannelProvider value = { channelContext } >
2087+ < OwnCapabilitiesProvider value = { ownCapabilitiesContext } >
2088+ < TypingProvider value = { typingContext } >
2089+ < PaginatedMessageListProvider value = { messageListContext } >
2090+ < MessagesProvider value = { messagesContext } >
2091+ < ThreadProvider value = { threadContext } >
2092+ < AttachmentPickerProvider value = { attachmentPickerContext } >
2093+ < MessageComposerProvider value = { messageComposerContext } >
2094+ < MessageInputProvider value = { inputMessageInputContext } >
2095+ < AudioPlayerProvider value = { audioPlayerContext } >
2096+ < View style = { { height : '100%' } } > { children } </ View >
2097+ { ! disableAttachmentPicker && (
2098+ < AttachmentPicker ref = { bottomSheetRef } { ...attachmentPickerProps } />
2099+ ) }
2100+ </ AudioPlayerProvider >
2101+ </ MessageInputProvider >
2102+ </ MessageComposerProvider >
2103+ </ AttachmentPickerProvider >
2104+ </ ThreadProvider >
2105+ </ MessagesProvider >
2106+ </ PaginatedMessageListProvider >
2107+ </ TypingProvider >
2108+ </ OwnCapabilitiesProvider >
2109+ </ ChannelProvider >
2110+ </ KeyboardCompatibleView >
2111+ { overlay === 'gallery' && < ImageGallery overlayOpacity = { overlayOpacity } /> }
2112+ </ ImageGalleryProvider >
20782113 ) ;
20792114} ;
20802115
@@ -2094,6 +2129,7 @@ export type ChannelProps = Partial<Omit<ChannelPropsWithContext, 'channel' | 'th
20942129export const Channel = ( props : PropsWithChildren < ChannelProps > ) => {
20952130 const { client, enableOfflineSupport, isOnline, isMessageAIGenerated } = useChatContext ( ) ;
20962131 const { t } = useTranslationContext ( ) ;
2132+ const { overlay, overlayOpacity } = useOverlayContext ( ) ;
20972133
20982134 const threadFromProps = props ?. thread ;
20992135 const threadInstance = ( threadFromProps as ThreadType ) ?. threadInstance as Thread ;
@@ -2125,6 +2161,8 @@ export const Channel = (props: PropsWithChildren<ChannelProps>) => {
21252161 { ...{
21262162 isMessageAIGenerated,
21272163 isOnline,
2164+ overlay,
2165+ overlayOpacity,
21282166 setThreadMessages,
21292167 thread,
21302168 threadMessages,
0 commit comments