@@ -28,10 +28,6 @@ import {
2828 useChannelContext ,
2929} from '../../contexts/channelContext/ChannelContext' ;
3030import { ChatContextValue , useChatContext } from '../../contexts/chatContext/ChatContext' ;
31- import {
32- ImageGalleryContextValue ,
33- useImageGalleryContext ,
34- } from '../../contexts/imageGalleryContext/ImageGalleryContext' ;
3531import {
3632 MessagesContextValue ,
3733 useMessagesContext ,
@@ -48,7 +44,6 @@ import { mergeThemes, ThemeProvider, useTheme } from '../../contexts/themeContex
4844import { ThreadContextValue , useThreadContext } from '../../contexts/threadContext/ThreadContext' ;
4945
5046import { useStableCallback } from '../../hooks' ;
51- import { FileTypes } from '../../types/types' ;
5247
5348let FlashList ;
5449
@@ -121,7 +116,6 @@ type MessageFlashListPropsWithContext = Pick<
121116 | 'maximumMessageLimit'
122117 > &
123118 Pick < ChatContextValue , 'client' > &
124- Pick < ImageGalleryContextValue , 'setMessages' > &
125119 Pick < PaginatedMessageListContextValue , 'loadMore' | 'loadMoreRecent' > &
126120 Pick <
127121 MessagesContextValue ,
@@ -130,7 +124,6 @@ type MessageFlashListPropsWithContext = Pick<
130124 | 'FlatList'
131125 | 'InlineDateSeparator'
132126 | 'InlineUnreadIndicator'
133- | 'legacyImageViewerSwipeBehaviour'
134127 | 'Message'
135128 | 'ScrollToBottomButton'
136129 | 'MessageSystem'
@@ -179,7 +172,6 @@ type MessageFlashListPropsWithContext = Pick<
179172 HeaderComponent ?: React . ComponentType ;
180173 /** Whether or not the FlatList is inverted. Defaults to true */
181174 inverted ?: boolean ;
182- isListActive ?: boolean ;
183175 /** Turn off grouping of messages by user */
184176 noGroupByUser ?: boolean ;
185177 onListScroll ?: ScrollViewProps [ 'onScroll' ] ;
@@ -271,9 +263,7 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
271263 highlightedMessageId,
272264 InlineDateSeparator,
273265 InlineUnreadIndicator,
274- isListActive = false ,
275266 isLiveStreaming = false ,
276- legacyImageViewerSwipeBehaviour,
277267 loadChannelAroundMessage,
278268 loading,
279269 LoadingIndicator,
@@ -296,7 +286,6 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
296286 selectedPicker,
297287 setChannelUnreadState,
298288 setFlatListRef,
299- setMessages,
300289 setSelectedPicker,
301290 setTargetedMessage,
302291 shouldShowUnreadUnderlay,
@@ -802,59 +791,6 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
802791 ] ,
803792 ) ;
804793
805- const messagesWithImages =
806- legacyImageViewerSwipeBehaviour &&
807- processedMessageList . filter ( ( message ) => {
808- const isMessageTypeDeleted = message . type === 'deleted' ;
809- if ( ! isMessageTypeDeleted && message . attachments ) {
810- return message . attachments . some (
811- ( attachment ) =>
812- attachment . type === FileTypes . Image &&
813- ! attachment . title_link &&
814- ! attachment . og_scrape_url &&
815- ( attachment . image_url || attachment . thumb_url ) ,
816- ) ;
817- }
818- return false ;
819- } ) ;
820-
821- /**
822- * This is for the useEffect to run again in the case that a message
823- * gets edited with more or the same number of images
824- */
825- const imageString =
826- legacyImageViewerSwipeBehaviour &&
827- messagesWithImages &&
828- messagesWithImages
829- . map ( ( message ) =>
830- message . attachments
831- ?. map ( ( attachment ) => attachment . image_url || attachment . thumb_url || '' )
832- . join ( ) ,
833- )
834- . join ( ) ;
835-
836- const numberOfMessagesWithImages =
837- legacyImageViewerSwipeBehaviour && messagesWithImages && messagesWithImages . length ;
838- const threadExists = ! ! thread ;
839-
840- useEffect ( ( ) => {
841- if (
842- legacyImageViewerSwipeBehaviour &&
843- isListActive &&
844- ( ( threadList && thread ) || ( ! threadList && ! thread ) )
845- ) {
846- setMessages ( messagesWithImages as LocalMessage [ ] ) ;
847- }
848- // eslint-disable-next-line react-hooks/exhaustive-deps
849- } , [
850- imageString ,
851- isListActive ,
852- legacyImageViewerSwipeBehaviour ,
853- numberOfMessagesWithImages ,
854- threadExists ,
855- threadList ,
856- ] ) ;
857-
858794 /**
859795 * We are keeping full control on message pagination, and not relying on react-native for it.
860796 * The reasons being,
@@ -1216,14 +1152,12 @@ export const MessageFlashList = (props: MessageFlashListProps) => {
12161152 threadList,
12171153 } = useChannelContext ( ) ;
12181154 const { client } = useChatContext ( ) ;
1219- const { setMessages } = useImageGalleryContext ( ) ;
12201155 const {
12211156 DateHeader,
12221157 disableTypingIndicator,
12231158 FlatList,
12241159 InlineDateSeparator,
12251160 InlineUnreadIndicator,
1226- legacyImageViewerSwipeBehaviour,
12271161 Message,
12281162 MessageSystem,
12291163 myMessageTheme,
@@ -1256,7 +1190,6 @@ export const MessageFlashList = (props: MessageFlashListProps) => {
12561190 InlineDateSeparator,
12571191 InlineUnreadIndicator,
12581192 isListActive : isChannelActive ,
1259- legacyImageViewerSwipeBehaviour,
12601193 loadChannelAroundMessage,
12611194 loading,
12621195 LoadingIndicator,
@@ -1276,7 +1209,6 @@ export const MessageFlashList = (props: MessageFlashListProps) => {
12761209 scrollToFirstUnreadThreshold,
12771210 selectedPicker,
12781211 setChannelUnreadState,
1279- setMessages,
12801212 setSelectedPicker,
12811213 setTargetedMessage,
12821214 shouldShowUnreadUnderlay,
0 commit comments