stream-chat-react-native-core 3.8.3-next.1 → 3.9.0-next.2

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.
Files changed (80) hide show
  1. package/lib/commonjs/components/Attachment/Gallery.js +21 -9
  2. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  3. package/lib/commonjs/components/Channel/Channel.js +52 -30
  4. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  5. package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js +4 -0
  6. package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
  7. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +4 -0
  8. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  9. package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +9 -6
  10. package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
  11. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +28 -23
  12. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  13. package/lib/commonjs/components/MessageList/MessageList.js +40 -31
  14. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  15. package/lib/commonjs/components/MessageList/hooks/useMessageList.js +1 -1
  16. package/lib/commonjs/components/MessageList/hooks/useMessageList.js.map +1 -1
  17. package/lib/commonjs/components/MessageList/utils/getGroupStyles.js +1 -5
  18. package/lib/commonjs/components/MessageList/utils/getGroupStyles.js.map +1 -1
  19. package/lib/commonjs/contexts/channelContext/ChannelContext.js +2 -2
  20. package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
  21. package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
  22. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  23. package/lib/commonjs/version.json +1 -1
  24. package/lib/module/components/Attachment/Gallery.js +21 -9
  25. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  26. package/lib/module/components/Channel/Channel.js +52 -30
  27. package/lib/module/components/Channel/Channel.js.map +1 -1
  28. package/lib/module/components/Channel/hooks/useCreateChannelContext.js +4 -0
  29. package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
  30. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +4 -0
  31. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  32. package/lib/module/components/Message/MessageSimple/MessageSimple.js +9 -6
  33. package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
  34. package/lib/module/components/MessageInput/FileUploadPreview.js +28 -23
  35. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  36. package/lib/module/components/MessageList/MessageList.js +40 -31
  37. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  38. package/lib/module/components/MessageList/hooks/useMessageList.js +1 -1
  39. package/lib/module/components/MessageList/hooks/useMessageList.js.map +1 -1
  40. package/lib/module/components/MessageList/utils/getGroupStyles.js +1 -5
  41. package/lib/module/components/MessageList/utils/getGroupStyles.js.map +1 -1
  42. package/lib/module/contexts/channelContext/ChannelContext.js +2 -2
  43. package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
  44. package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
  45. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  46. package/lib/module/version.json +1 -1
  47. package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
  48. package/lib/typescript/components/Channel/Channel.d.ts +3 -1
  49. package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
  50. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +4 -2
  51. package/lib/typescript/components/Message/MessageSimple/MessageSimple.d.ts +1 -1
  52. package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
  53. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +3 -1
  54. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +3 -1
  55. package/package.json +1 -1
  56. package/src/components/Attachment/Gallery.tsx +20 -5
  57. package/src/components/Channel/Channel.tsx +124 -67
  58. package/src/components/Channel/hooks/useCreateChannelContext.ts +4 -0
  59. package/src/components/Channel/hooks/useCreateMessagesContext.ts +4 -0
  60. package/src/components/Message/MessageSimple/MessageSimple.tsx +9 -3
  61. package/src/components/MessageInput/FileUploadPreview.tsx +68 -58
  62. package/src/components/MessageInput/__tests__/__snapshots__/FileUploadPreview.test.js.snap +778 -730
  63. package/src/components/MessageList/MessageList.tsx +52 -27
  64. package/src/components/MessageList/hooks/useMessageList.ts +1 -1
  65. package/src/components/MessageList/utils/getGroupStyles.ts +3 -8
  66. package/src/contexts/channelContext/ChannelContext.tsx +2 -0
  67. package/src/contexts/messagesContext/MessagesContext.tsx +2 -0
  68. package/src/version.json +1 -1
  69. package/lib/commonjs/components/Channel/utils/debounce.js +0 -20
  70. package/lib/commonjs/components/Channel/utils/debounce.js.map +0 -1
  71. package/lib/commonjs/components/Channel/utils/throttle.js +0 -20
  72. package/lib/commonjs/components/Channel/utils/throttle.js.map +0 -1
  73. package/lib/module/components/Channel/utils/debounce.js +0 -20
  74. package/lib/module/components/Channel/utils/debounce.js.map +0 -1
  75. package/lib/module/components/Channel/utils/throttle.js +0 -20
  76. package/lib/module/components/Channel/utils/throttle.js.map +0 -1
  77. package/lib/typescript/components/Channel/utils/debounce.d.ts +0 -2
  78. package/lib/typescript/components/Channel/utils/throttle.d.ts +0 -2
  79. package/src/components/Channel/utils/debounce.ts +0 -12
  80. package/src/components/Channel/utils/throttle.ts +0 -12
@@ -1 +1 @@
1
- {"version":3,"sources":["useMessageList.ts"],"names":["isMessageWithStylesReadByAndDateSeparator","message","readBy","undefined","useMessageList","params","inverted","noGroupByUser","threadList","client","hideDateSeparators","maxTimeBetweenGroupedMessages","read","messages","threadMessages","messageList","readList","dateSeparators","userId","userID","messageGroupStyles","readData","messagesWithStylesReadByAndDateSeparator","filter","msg","deleted_at","user","id","map","dateSeparator","groupStyles","reverse"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAIA;;AACA;;AAiDO,IAAMA,yCAAyC,GAAG,SAA5CA,yCAA4C,CASvDC,OATuD;AAAA,SAWtDA,OAAD,CAA8EC,MAA9E,KACAC,SAZuD;AAAA,CAAlD;;;;AAcA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAS5BC,MAT4B,EAUzB;AACH,MAAQC,QAAR,GAAgDD,MAAhD,CAAQC,QAAR;AAAA,MAAkBC,aAAlB,GAAgDF,MAAhD,CAAkBE,aAAlB;AAAA,MAAiCC,UAAjC,GAAgDH,MAAhD,CAAiCG,UAAjC;;AACA,wBAAmB,kCAAnB;AAAA,MAAQC,MAAR,mBAAQA,MAAR;;AACA,2BACE,wCADF;AAAA,MAAQC,kBAAR,sBAAQA,kBAAR;AAAA,MAA4BC,6BAA5B,sBAA4BA,6BAA5B;AAAA,MAA2DC,IAA3D,sBAA2DA,IAA3D;;AAEA,8BAAqB,kEAArB;AAAA,MAAQC,QAAR,yBAAQA,QAAR;;AACA,0BAA2B,sCAA3B;AAAA,MAAQC,cAAR,qBAAQA,cAAR;;AAEA,MAAMC,WAAW,GAAGP,UAAU,GAAGM,cAAH,GAAoBD,QAAlD;AACA,MAAMG,QAA6E,GAAGR,UAAU,GAC5FL,SAD4F,GAE5FS,IAFJ;AAIA,MAAMK,cAAc,GAAG,0CAA8C;AACnEP,IAAAA,kBAAkB,EAAlBA,kBADmE;AAEnEG,IAAAA,QAAQ,EAAEE,WAFyD;AAGnEG,IAAAA,MAAM,EAAET,MAAM,CAACU;AAHoD,GAA9C,CAAvB;AAMA,MAAMC,kBAAkB,GAAG,oCAA2C;AACpEH,IAAAA,cAAc,EAAdA,cADoE;AAEpEP,IAAAA,kBAAkB,EAAlBA,kBAFoE;AAGpEC,IAAAA,6BAA6B,EAA7BA,6BAHoE;AAIpEE,IAAAA,QAAQ,EAAEE,WAJ0D;AAKpER,IAAAA,aAAa,EAAbA,aALoE;AAMpEW,IAAAA,MAAM,EAAET,MAAM,CAACU;AANqD,GAA3C,CAA3B;AASA,MAAME,QAAQ,GAAG,kCAAcZ,MAAM,CAACU,MAArB,EAA6BJ,WAA7B,EAA0CC,QAA1C,CAAjB;AAEA,MAAMM,wCAAwC,GAAGP,WAAW,CACzDQ,MAD8C,CACvC,UAACC,GAAD;AAAA;;AAAA,WAAS,CAACA,GAAG,CAACC,UAAL,IAAmB,cAAAD,GAAG,CAACE,IAAJ,+BAAUC,EAAV,MAAiBlB,MAAM,CAACU,MAApD;AAAA,GADuC,EAE9CS,GAF8C,CAE1C,UAACJ,GAAD;AAAA,yCACAA,GADA;AAEHK,MAAAA,aAAa,EAAEZ,cAAc,CAACO,GAAG,CAACG,EAAL,CAAd,IAA0BxB,SAFtC;AAGH2B,MAAAA,WAAW,EAAEV,kBAAkB,CAACI,GAAG,CAACG,EAAL,CAAlB,IAA8B,EAHxC;AAIHzB,MAAAA,MAAM,EAAEsB,GAAG,CAACG,EAAJ,GAASN,QAAQ,CAACG,GAAG,CAACG,EAAL,CAAR,IAAoB,KAA7B,GAAqC;AAJ1C;AAAA,GAF0C,CAAjD;AASA,SACErB,QAAQ,GACJgB,wCAAwC,CAACS,OAAzC,EADI,GAEJT,wCAHN;AAKD,CAtDM","sourcesContent":["import { getDateSeparators } from '../utils/getDateSeparators';\nimport { getGroupStyles } from '../utils/getGroupStyles';\nimport { getReadStates } from '../utils/getReadStates';\n\nimport { useChatContext } from '../../../contexts/chatContext/ChatContext';\nimport {\n ChannelContextValue,\n useChannelContext,\n} from '../../../contexts/channelContext/ChannelContext';\nimport { usePaginatedMessageListContext } from '../../../contexts/paginatedMessageListContext/PaginatedMessageListContext';\nimport { useThreadContext } from '../../../contexts/threadContext/ThreadContext';\n\nimport type { ChannelState, MessageResponse } from 'stream-chat';\n\nimport type {\n DefaultAttachmentType,\n DefaultChannelType,\n DefaultCommandType,\n DefaultEventType,\n DefaultMessageType,\n DefaultReactionType,\n DefaultUserType,\n UnknownType,\n} from '../../../types/types';\n\nexport type UseMessageListParams = {\n inverted?: boolean;\n noGroupByUser?: boolean;\n threadList?: boolean;\n};\n\nexport type GroupType = 'bottom' | 'middle' | 'single' | 'top';\n\nexport type MessagesWithStylesReadByAndDateSeparator<\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n> = MessageResponse<At, Ch, Co, Me, Re, Us> & {\n groupStyles: GroupType[];\n readBy: boolean | number;\n dateSeparator?: Date;\n};\n\nexport type MessageType<\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n> =\n | ReturnType<ChannelState<At, Ch, Co, Ev, Me, Re, Us>['formatMessage']>\n | MessagesWithStylesReadByAndDateSeparator<At, Ch, Co, Me, Re, Us>;\n\n// Type guards to check MessageType\nexport const isMessageWithStylesReadByAndDateSeparator = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>(\n message: MessageType<At, Ch, Co, Ev, Me, Re, Us>,\n): message is MessagesWithStylesReadByAndDateSeparator<At, Ch, Co, Me, Re, Us> =>\n (message as MessagesWithStylesReadByAndDateSeparator<At, Ch, Co, Me, Re, Us>).readBy !==\n undefined;\n\nexport const useMessageList = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>(\n params: UseMessageListParams,\n) => {\n const { inverted, noGroupByUser, threadList } = params;\n const { client } = useChatContext<At, Ch, Co, Ev, Me, Re, Us>();\n const { hideDateSeparators, maxTimeBetweenGroupedMessages, read } =\n useChannelContext<At, Ch, Co, Ev, Me, Re, Us>();\n const { messages } = usePaginatedMessageListContext<At, Ch, Co, Ev, Me, Re, Us>();\n const { threadMessages } = useThreadContext<At, Ch, Co, Ev, Me, Re, Us>();\n\n const messageList = threadList ? threadMessages : messages;\n const readList: ChannelContextValue<At, Ch, Co, Ev, Me, Re, Us>['read'] | undefined = threadList\n ? undefined\n : read;\n\n const dateSeparators = getDateSeparators<At, Ch, Co, Ev, Me, Re, Us>({\n hideDateSeparators,\n messages: messageList,\n userId: client.userID,\n });\n\n const messageGroupStyles = getGroupStyles<At, Ch, Co, Ev, Me, Re, Us>({\n dateSeparators,\n hideDateSeparators,\n maxTimeBetweenGroupedMessages,\n messages: messageList,\n noGroupByUser,\n userId: client.userID,\n });\n\n const readData = getReadStates(client.userID, messageList, readList);\n\n const messagesWithStylesReadByAndDateSeparator = messageList\n .filter((msg) => !msg.deleted_at || msg.user?.id === client.userID)\n .map((msg) => ({\n ...msg,\n dateSeparator: dateSeparators[msg.id] || undefined,\n groupStyles: messageGroupStyles[msg.id] || [],\n readBy: msg.id ? readData[msg.id] || false : false,\n }));\n\n return (\n inverted\n ? messagesWithStylesReadByAndDateSeparator.reverse()\n : messagesWithStylesReadByAndDateSeparator\n ) as MessageType<At, Ch, Co, Ev, Me, Re, Us>[];\n};\n"]}
1
+ {"version":3,"sources":["useMessageList.ts"],"names":["isMessageWithStylesReadByAndDateSeparator","message","readBy","undefined","useMessageList","params","inverted","noGroupByUser","threadList","client","hideDateSeparators","maxTimeBetweenGroupedMessages","read","messages","threadMessages","messageList","readList","dateSeparators","userId","userID","messageGroupStyles","readData","messagesWithStylesReadByAndDateSeparator","filter","msg","deleted_at","user","id","map","dateSeparator","groupStyles","reverse"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAIA;;AACA;;AAiDO,IAAMA,yCAAyC,GAAG,SAA5CA,yCAA4C,CASvDC,OATuD;AAAA,SAWtDA,OAAD,CAA8EC,MAA9E,KACAC,SAZuD;AAAA,CAAlD;;;;AAcA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAS5BC,MAT4B,EAUzB;AACH,MAAQC,QAAR,GAAgDD,MAAhD,CAAQC,QAAR;AAAA,MAAkBC,aAAlB,GAAgDF,MAAhD,CAAkBE,aAAlB;AAAA,MAAiCC,UAAjC,GAAgDH,MAAhD,CAAiCG,UAAjC;;AACA,wBAAmB,kCAAnB;AAAA,MAAQC,MAAR,mBAAQA,MAAR;;AACA,2BACE,wCADF;AAAA,MAAQC,kBAAR,sBAAQA,kBAAR;AAAA,MAA4BC,6BAA5B,sBAA4BA,6BAA5B;AAAA,MAA2DC,IAA3D,sBAA2DA,IAA3D;;AAEA,8BAAqB,kEAArB;AAAA,MAAQC,QAAR,yBAAQA,QAAR;;AACA,0BAA2B,sCAA3B;AAAA,MAAQC,cAAR,qBAAQA,cAAR;;AAEA,MAAMC,WAAW,GAAGP,UAAU,GAAGM,cAAH,GAAoBD,QAAlD;AACA,MAAMG,QAA6E,GAAGR,UAAU,GAC5FL,SAD4F,GAE5FS,IAFJ;AAIA,MAAMK,cAAc,GAAG,0CAA8C;AACnEP,IAAAA,kBAAkB,EAAlBA,kBADmE;AAEnEG,IAAAA,QAAQ,EAAEE,WAFyD;AAGnEG,IAAAA,MAAM,EAAET,MAAM,CAACU;AAHoD,GAA9C,CAAvB;AAMA,MAAMC,kBAAkB,GAAG,oCAA2C;AACpEH,IAAAA,cAAc,EAAdA,cADoE;AAEpEP,IAAAA,kBAAkB,EAAlBA,kBAFoE;AAGpEC,IAAAA,6BAA6B,EAA7BA,6BAHoE;AAIpEE,IAAAA,QAAQ,EAAEE,WAJ0D;AAKpER,IAAAA,aAAa,EAAbA,aALoE;AAMpEW,IAAAA,MAAM,EAAET,MAAM,CAACU;AANqD,GAA3C,CAA3B;AASA,MAAME,QAAQ,GAAG,kCAAcZ,MAAM,CAACU,MAArB,EAA6BJ,WAA7B,EAA0CC,QAA1C,CAAjB;AAEA,MAAMM,wCAAwC,GAAGP,WAAW,CACzDQ,MAD8C,CACvC,UAACC,GAAD;AAAA;;AAAA,WAAS,CAACA,GAAG,CAACC,UAAL,IAAmB,cAAAD,GAAG,CAACE,IAAJ,+BAAUC,EAAV,MAAiBlB,MAAM,CAACU,MAApD;AAAA,GADuC,EAE9CS,GAF8C,CAE1C,UAACJ,GAAD;AAAA,yCACAA,GADA;AAEHK,MAAAA,aAAa,EAAEZ,cAAc,CAACO,GAAG,CAACG,EAAL,CAAd,IAA0BxB,SAFtC;AAGH2B,MAAAA,WAAW,EAAEV,kBAAkB,CAACI,GAAG,CAACG,EAAL,CAAlB,IAA8B,CAAC,QAAD,CAHxC;AAIHzB,MAAAA,MAAM,EAAEsB,GAAG,CAACG,EAAJ,GAASN,QAAQ,CAACG,GAAG,CAACG,EAAL,CAAR,IAAoB,KAA7B,GAAqC;AAJ1C;AAAA,GAF0C,CAAjD;AASA,SACErB,QAAQ,GACJgB,wCAAwC,CAACS,OAAzC,EADI,GAEJT,wCAHN;AAKD,CAtDM","sourcesContent":["import { getDateSeparators } from '../utils/getDateSeparators';\nimport { getGroupStyles } from '../utils/getGroupStyles';\nimport { getReadStates } from '../utils/getReadStates';\n\nimport { useChatContext } from '../../../contexts/chatContext/ChatContext';\nimport {\n ChannelContextValue,\n useChannelContext,\n} from '../../../contexts/channelContext/ChannelContext';\nimport { usePaginatedMessageListContext } from '../../../contexts/paginatedMessageListContext/PaginatedMessageListContext';\nimport { useThreadContext } from '../../../contexts/threadContext/ThreadContext';\n\nimport type { ChannelState, MessageResponse } from 'stream-chat';\n\nimport type {\n DefaultAttachmentType,\n DefaultChannelType,\n DefaultCommandType,\n DefaultEventType,\n DefaultMessageType,\n DefaultReactionType,\n DefaultUserType,\n UnknownType,\n} from '../../../types/types';\n\nexport type UseMessageListParams = {\n inverted?: boolean;\n noGroupByUser?: boolean;\n threadList?: boolean;\n};\n\nexport type GroupType = 'bottom' | 'middle' | 'single' | 'top';\n\nexport type MessagesWithStylesReadByAndDateSeparator<\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n> = MessageResponse<At, Ch, Co, Me, Re, Us> & {\n groupStyles: GroupType[];\n readBy: boolean | number;\n dateSeparator?: Date;\n};\n\nexport type MessageType<\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n> =\n | ReturnType<ChannelState<At, Ch, Co, Ev, Me, Re, Us>['formatMessage']>\n | MessagesWithStylesReadByAndDateSeparator<At, Ch, Co, Me, Re, Us>;\n\n// Type guards to check MessageType\nexport const isMessageWithStylesReadByAndDateSeparator = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>(\n message: MessageType<At, Ch, Co, Ev, Me, Re, Us>,\n): message is MessagesWithStylesReadByAndDateSeparator<At, Ch, Co, Me, Re, Us> =>\n (message as MessagesWithStylesReadByAndDateSeparator<At, Ch, Co, Me, Re, Us>).readBy !==\n undefined;\n\nexport const useMessageList = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>(\n params: UseMessageListParams,\n) => {\n const { inverted, noGroupByUser, threadList } = params;\n const { client } = useChatContext<At, Ch, Co, Ev, Me, Re, Us>();\n const { hideDateSeparators, maxTimeBetweenGroupedMessages, read } =\n useChannelContext<At, Ch, Co, Ev, Me, Re, Us>();\n const { messages } = usePaginatedMessageListContext<At, Ch, Co, Ev, Me, Re, Us>();\n const { threadMessages } = useThreadContext<At, Ch, Co, Ev, Me, Re, Us>();\n\n const messageList = threadList ? threadMessages : messages;\n const readList: ChannelContextValue<At, Ch, Co, Ev, Me, Re, Us>['read'] | undefined = threadList\n ? undefined\n : read;\n\n const dateSeparators = getDateSeparators<At, Ch, Co, Ev, Me, Re, Us>({\n hideDateSeparators,\n messages: messageList,\n userId: client.userID,\n });\n\n const messageGroupStyles = getGroupStyles<At, Ch, Co, Ev, Me, Re, Us>({\n dateSeparators,\n hideDateSeparators,\n maxTimeBetweenGroupedMessages,\n messages: messageList,\n noGroupByUser,\n userId: client.userID,\n });\n\n const readData = getReadStates(client.userID, messageList, readList);\n\n const messagesWithStylesReadByAndDateSeparator = messageList\n .filter((msg) => !msg.deleted_at || msg.user?.id === client.userID)\n .map((msg) => ({\n ...msg,\n dateSeparator: dateSeparators[msg.id] || undefined,\n groupStyles: messageGroupStyles[msg.id] || ['single'],\n readBy: msg.id ? readData[msg.id] || false : false,\n }));\n\n return (\n inverted\n ? messagesWithStylesReadByAndDateSeparator.reverse()\n : messagesWithStylesReadByAndDateSeparator\n ) as MessageType<At, Ch, Co, Ev, Me, Re, Us>[];\n};\n"]}
@@ -10,6 +10,7 @@ var getGroupStyles = function getGroupStyles(params) {
10
10
  messages = params.messages,
11
11
  noGroupByUser = params.noGroupByUser,
12
12
  userId = params.userId;
13
+ if (noGroupByUser) return {};
13
14
  var messageGroupStyles = {};
14
15
  var messagesFilteredForNonUser = messages.filter(function (message) {
15
16
  var _message$user;
@@ -53,11 +54,6 @@ var getGroupStyles = function getGroupStyles(params) {
53
54
  }
54
55
  }
55
56
 
56
- if (noGroupByUser) {
57
- groupStyles.splice(0, groupStyles.length);
58
- groupStyles.push('single');
59
- }
60
-
61
57
  if (message.id) {
62
58
  messageGroupStyles[message.id] = groupStyles;
63
59
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["getGroupStyles.ts"],"names":["getGroupStyles","params","dateSeparators","hideDateSeparators","maxTimeBetweenGroupedMessages","messages","noGroupByUser","userId","messageGroupStyles","messagesFilteredForNonUser","filter","message","deleted_at","user","id","i","length","previousMessage","nextMessage","groupStyles","isTopMessage","type","includes","isBottomMessage","undefined","created_at","getTime","push","splice"],"mappings":"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","sourcesContent":["import type { DateSeparators } from './getDateSeparators';\n\nimport type { GroupType } from '../hooks/useMessageList';\n\nimport type { PaginatedMessageListContextValue } from '../../../contexts/paginatedMessageListContext/PaginatedMessageListContext';\nimport type { ThreadContextValue } from '../../../contexts/threadContext/ThreadContext';\nimport type {\n DefaultAttachmentType,\n DefaultChannelType,\n DefaultCommandType,\n DefaultEventType,\n DefaultMessageType,\n DefaultReactionType,\n DefaultUserType,\n UnknownType,\n} from '../../../types/types';\n\nexport type GetGroupStylesParams<\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n> = {\n dateSeparators: DateSeparators;\n messages:\n | PaginatedMessageListContextValue<At, Ch, Co, Ev, Me, Re, Us>['messages']\n | ThreadContextValue<At, Ch, Co, Ev, Me, Re, Us>['threadMessages'];\n hideDateSeparators?: boolean;\n maxTimeBetweenGroupedMessages?: number;\n noGroupByUser?: boolean;\n userId?: string;\n};\n\nexport const getGroupStyles = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>(\n params: GetGroupStylesParams<At, Ch, Co, Ev, Me, Re, Us>,\n) => {\n const {\n dateSeparators,\n hideDateSeparators,\n maxTimeBetweenGroupedMessages,\n messages,\n noGroupByUser,\n userId,\n } = params;\n const messageGroupStyles: { [key: string]: GroupType[] } = {};\n\n const messagesFilteredForNonUser = messages.filter(\n (message) => !message.deleted_at || userId === message.user?.id,\n );\n\n for (let i = 0; i < messagesFilteredForNonUser.length; i++) {\n const previousMessage = messagesFilteredForNonUser[i - 1] as\n | typeof messagesFilteredForNonUser[0]\n | undefined;\n const message = messagesFilteredForNonUser[i];\n const nextMessage = messagesFilteredForNonUser[i + 1] as\n | typeof messagesFilteredForNonUser[0]\n | undefined;\n const groupStyles: GroupType[] = [];\n\n const userId = message?.user?.id || null;\n\n const isTopMessage =\n !previousMessage ||\n previousMessage.type === 'system' ||\n userId !== previousMessage?.user?.id ||\n previousMessage.type === 'error' ||\n !!previousMessage.deleted_at ||\n (!hideDateSeparators && dateSeparators[message.id]) ||\n messageGroupStyles[previousMessage.id]?.includes('bottom');\n\n const isBottomMessage =\n !nextMessage ||\n nextMessage.type === 'system' ||\n userId !== nextMessage?.user?.id ||\n nextMessage.type === 'error' ||\n !!nextMessage.deleted_at ||\n (!hideDateSeparators && dateSeparators[nextMessage.id]) ||\n (maxTimeBetweenGroupedMessages !== undefined &&\n nextMessage.created_at.getTime() - message.created_at.getTime() >\n maxTimeBetweenGroupedMessages);\n\n /**\n * Add group styles key for top message\n */\n if (isTopMessage) {\n groupStyles.push('top');\n }\n\n /**\n * Add group styles key for bottom message\n */\n if (isBottomMessage) {\n /**\n * If the bottom message is also the top, or deleted, or an error,\n * add the key for single message instead of bottom\n */\n if (isTopMessage || message.deleted_at || message.type === 'error') {\n groupStyles.splice(0, groupStyles.length);\n groupStyles.push('single');\n } else {\n groupStyles.push('bottom');\n }\n }\n\n /**\n * Add the key for all non top or bottom messages, if the message is\n * deleted or an error add the key for single otherwise middle\n */\n if (!isTopMessage && !isBottomMessage) {\n if (message.deleted_at || message.type === 'error') {\n groupStyles.splice(0, groupStyles.length);\n groupStyles.push('single');\n } else {\n groupStyles.splice(0, groupStyles.length);\n groupStyles.push('middle');\n }\n }\n\n /**\n * If noGroupByUser set add the key for single\n */\n if (noGroupByUser) {\n groupStyles.splice(0, groupStyles.length);\n groupStyles.push('single');\n }\n\n if (message.id) {\n messageGroupStyles[message.id] = groupStyles;\n }\n }\n\n return messageGroupStyles;\n};\n"]}
1
+ {"version":3,"sources":["getGroupStyles.ts"],"names":["getGroupStyles","params","dateSeparators","hideDateSeparators","maxTimeBetweenGroupedMessages","messages","noGroupByUser","userId","messageGroupStyles","messagesFilteredForNonUser","filter","message","deleted_at","user","id","i","length","previousMessage","nextMessage","groupStyles","isTopMessage","type","includes","isBottomMessage","undefined","created_at","getTime","push","splice"],"mappings":"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","sourcesContent":["import type { DateSeparators } from './getDateSeparators';\n\nimport type { GroupType } from '../hooks/useMessageList';\n\nimport type { PaginatedMessageListContextValue } from '../../../contexts/paginatedMessageListContext/PaginatedMessageListContext';\nimport type { ThreadContextValue } from '../../../contexts/threadContext/ThreadContext';\nimport type {\n DefaultAttachmentType,\n DefaultChannelType,\n DefaultCommandType,\n DefaultEventType,\n DefaultMessageType,\n DefaultReactionType,\n DefaultUserType,\n UnknownType,\n} from '../../../types/types';\n\nexport type GetGroupStylesParams<\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n> = {\n dateSeparators: DateSeparators;\n messages:\n | PaginatedMessageListContextValue<At, Ch, Co, Ev, Me, Re, Us>['messages']\n | ThreadContextValue<At, Ch, Co, Ev, Me, Re, Us>['threadMessages'];\n hideDateSeparators?: boolean;\n maxTimeBetweenGroupedMessages?: number;\n noGroupByUser?: boolean;\n userId?: string;\n};\n\nexport const getGroupStyles = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>(\n params: GetGroupStylesParams<At, Ch, Co, Ev, Me, Re, Us>,\n) => {\n const {\n dateSeparators,\n hideDateSeparators,\n maxTimeBetweenGroupedMessages,\n messages,\n noGroupByUser,\n userId,\n } = params;\n\n if (noGroupByUser) return {};\n\n const messageGroupStyles: { [key: string]: GroupType[] } = {};\n\n const messagesFilteredForNonUser = messages.filter(\n (message) => !message.deleted_at || userId === message.user?.id,\n );\n\n for (let i = 0; i < messagesFilteredForNonUser.length; i++) {\n const previousMessage = messagesFilteredForNonUser[i - 1] as\n | typeof messagesFilteredForNonUser[0]\n | undefined;\n const message = messagesFilteredForNonUser[i];\n const nextMessage = messagesFilteredForNonUser[i + 1] as\n | typeof messagesFilteredForNonUser[0]\n | undefined;\n const groupStyles: GroupType[] = [];\n\n const userId = message?.user?.id || null;\n\n const isTopMessage =\n !previousMessage ||\n previousMessage.type === 'system' ||\n userId !== previousMessage?.user?.id ||\n previousMessage.type === 'error' ||\n !!previousMessage.deleted_at ||\n (!hideDateSeparators && dateSeparators[message.id]) ||\n messageGroupStyles[previousMessage.id]?.includes('bottom');\n\n const isBottomMessage =\n !nextMessage ||\n nextMessage.type === 'system' ||\n userId !== nextMessage?.user?.id ||\n nextMessage.type === 'error' ||\n !!nextMessage.deleted_at ||\n (!hideDateSeparators && dateSeparators[nextMessage.id]) ||\n (maxTimeBetweenGroupedMessages !== undefined &&\n nextMessage.created_at.getTime() - message.created_at.getTime() >\n maxTimeBetweenGroupedMessages);\n\n /**\n * Add group styles key for top message\n */\n if (isTopMessage) {\n groupStyles.push('top');\n }\n\n /**\n * Add group styles key for bottom message\n */\n if (isBottomMessage) {\n /**\n * If the bottom message is also the top, or deleted, or an error,\n * add the key for single message instead of bottom\n */\n if (isTopMessage || message.deleted_at || message.type === 'error') {\n groupStyles.splice(0, groupStyles.length);\n groupStyles.push('single');\n } else {\n groupStyles.push('bottom');\n }\n }\n\n /**\n * Add the key for all non top or bottom messages, if the message is\n * deleted or an error add the key for single otherwise middle\n */\n if (!isTopMessage && !isBottomMessage) {\n if (message.deleted_at || message.type === 'error') {\n groupStyles.splice(0, groupStyles.length);\n groupStyles.push('single');\n } else {\n groupStyles.splice(0, groupStyles.length);\n groupStyles.push('middle');\n }\n }\n\n if (message.id) {\n messageGroupStyles[message.id] = groupStyles;\n }\n }\n\n return messageGroupStyles;\n};\n"]}
@@ -32,7 +32,7 @@ var ChannelProvider = function ChannelProvider(_ref) {
32
32
  __self: _this,
33
33
  __source: {
34
34
  fileName: _jsxFileName,
35
- lineNumber: 203,
35
+ lineNumber: 205,
36
36
  columnNumber: 3
37
37
  }
38
38
  }, children);
@@ -53,7 +53,7 @@ var withChannelContext = function withChannelContext(Component) {
53
53
  __self: _this,
54
54
  __source: {
55
55
  fileName: _jsxFileName,
56
- lineNumber: 240,
56
+ lineNumber: 242,
57
57
  columnNumber: 12
58
58
  }
59
59
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["ChannelContext.tsx"],"names":["ChannelContext","React","createContext","ChannelProvider","children","value","useChannelContext","withChannelContext","Component","WithChannelContextComponent","props","channelContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;;;;AAwLO,IAAMA,cAAc,GAAGC,kBAAMC,aAAN,CAAoB,EAApB,CAAvB;;;;AAEA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB;AAAA,MAS7BC,QAT6B,QAS7BA,QAT6B;AAAA,MAU7BC,KAV6B,QAU7BA,KAV6B;AAAA,SAc7B,gCAAC,cAAD,CAAgB,QAAhB;AAAyB,IAAA,KAAK,EAAEA,KAAhC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAd6B;AAAA,CAAxB;;;;AAmBA,IAAME,iBAAiB,GAAG,SAApBA,iBAAoB;AAAA,SAQ1B,uBAAWN,cAAX,CAR0B;AAAA,CAA1B;;;;AAeA,IAAMO,kBAAkB,GAAG,SAArBA,kBAAqB,CAUhCC,SAVgC,EAW6C;AAC7E,MAAMC,2BAA2B,GAAG,SAA9BA,2BAA8B,CAClCC,KADkC,EAE/B;AACH,QAAMC,cAAc,GAAGL,iBAAiB,EAAxC;AAEA,WAAO,gCAAC,SAAD,gCAAgBI,KAAhB,EAAiCC,cAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,2BAA2B,CAACG,WAA5B,0BAA+D,oCAAeJ,SAAf,CAA/D;AACA,SAAOC,2BAAP;AACD,CArBM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport { getDisplayName } from '../utils/getDisplayName';\n\nimport type { Channel, ChannelState } from 'stream-chat';\n\nimport type { EmptyStateProps } from '../../components/Indicators/EmptyStateIndicator';\nimport type { LoadingProps } from '../../components/Indicators/LoadingIndicator';\nimport type {\n DefaultAttachmentType,\n DefaultChannelType,\n DefaultCommandType,\n DefaultEventType,\n DefaultMessageType,\n DefaultReactionType,\n DefaultUserType,\n UnknownType,\n} from '../../types/types';\n\nexport type ChannelConfig = {\n readEventsEnabled?: boolean;\n typingEventsEnabled?: boolean;\n};\n\nexport type ChannelContextValue<\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n> = {\n /**\n * Custom UI component to display empty state when channel has no messages.\n *\n * **Default** [EmptyStateIndicator](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Indicators/EmptyStateIndicator.tsx)\n */\n EmptyStateIndicator: React.ComponentType<EmptyStateProps>;\n /**\n * When set to true, reactions will be limited to 1 per user. If user selects another reaction\n * then his previous reaction will be removed and replaced with new one.\n *\n * This is similar to reaction UX on [iMessage application](https://en.wikipedia.org/wiki/IMessage).\n */\n enforceUniqueReaction: boolean;\n error: boolean;\n /**\n * When set to false, it will disable giphy command on MessageInput component.\n */\n giphyEnabled: boolean;\n /**\n * Hide inline date separators on channel\n */\n hideDateSeparators: boolean;\n /**\n * Returns true if the current user has admin privileges\n */\n isAdmin: boolean;\n /**\n * Returns true if the current user is a moderator\n */\n isModerator: boolean;\n /**\n * Returns true if the current user is a owner\n */\n isOwner: boolean;\n loadChannelAtMessage: ({\n after,\n before,\n messageId,\n }: {\n after?: number;\n before?: number;\n messageId?: string;\n }) => Promise<void>;\n loading: boolean;\n /**\n * Custom loading indicator to override the Stream default\n */\n LoadingIndicator: React.ComponentType<LoadingProps>;\n markRead: () => void;\n /**\n *\n * ```json\n * {\n * \"thierry-123\": {\n * \"id\": \"thierry-123\",\n * \"role\": \"user\",\n * \"created_at\": \"2019-04-03T14:42:47.087869Z\",\n * \"updated_at\": \"2019-04-16T09:20:03.982283Z\",\n * \"last_active\": \"2019-04-16T11:23:51.168113408+02:00\",\n * \"online\": true\n * },\n * \"vishal-123\": {\n * \"id\": \"vishal-123\",\n * \"role\": \"user\",\n * \"created_at\": \"2019-05-03T14:42:47.087869Z\",\n * \"updated_at\": \"2019-05-16T09:20:03.982283Z\",\n * \"last_active\": \"2019-06-16T11:23:51.168113408+02:00\",\n * \"online\": false\n * }\n * }\n * ```\n */\n members: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['members'];\n /**\n * Custom network down indicator to override the Stream default\n */\n NetworkDownIndicator: React.ComponentType;\n read: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['read'];\n reloadChannel: () => Promise<void>;\n /**\n * When true, messagelist will be scrolled to first unread message, when opened.\n */\n scrollToFirstUnreadThreshold: number;\n setLastRead: React.Dispatch<React.SetStateAction<Date | undefined>>;\n setTargetedMessage: (messageId: string) => void;\n /**\n *\n * ```json\n * {\n * \"thierry-123\": {\n * \"id\": \"thierry-123\",\n * \"role\": \"user\",\n * \"created_at\": \"2019-04-03T14:42:47.087869Z\",\n * \"updated_at\": \"2019-04-16T09:20:03.982283Z\",\n * \"last_active\": \"2019-04-16T11:23:51.168113408+02:00\",\n * \"online\": true\n * },\n * \"vishal-123\": {\n * \"id\": \"vishal-123\",\n * \"role\": \"user\",\n * \"created_at\": \"2019-05-03T14:42:47.087869Z\",\n * \"updated_at\": \"2019-05-16T09:20:03.982283Z\",\n * \"last_active\": \"2019-06-16T11:23:51.168113408+02:00\",\n * \"online\": false\n * }\n * }\n * ```\n */\n watchers: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['watchers'];\n /**\n * Instance of channel object from stream-chat package.\n *\n * Please check the docs around how to create or query channel - https://getstream.io/chat/docs/javascript/creating_channels/?language=javascript\n *\n * ```\n * import { StreamChat, Channel } from 'stream-chat';\n * import { Chat, Channel} from 'stream-chat-react-native';\n *\n * const client = StreamChat.getInstance('api_key');\n * await client.connectUser('user_id', 'user_token');\n * const channel = client.channel('messaging', 'channel_id');\n * await channel.watch();\n *\n * <Chat client={client}>\n * <Channel channel={channel}>\n * </Channel>\n * </Chat>\n * ```\n *\n * @overrideType Channel\n */\n channel?: Channel<At, Ch, Co, Ev, Me, Re, Us>;\n disabled?: boolean;\n lastRead?: Date;\n /**\n * Maximum time in milliseconds that should occur between messages\n * to still consider them grouped together\n */\n maxTimeBetweenGroupedMessages?: number;\n /**\n * Custom UI component for sticky header of channel.\n *\n * **Default** [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageList/DateHeader.tsx)\n */\n StickyHeader?: React.ComponentType<{ dateString: string }>;\n /**\n * Id of message, around which Channel/MessageList gets loaded when opened.\n * You will see a highlighted background for targetted message, when opened.\n */\n targetedMessage?: string;\n watcherCount?: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['watcher_count'];\n} & ChannelConfig;\n\nexport const ChannelContext = React.createContext({} as ChannelContextValue);\n\nexport const ChannelProvider = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value: ChannelContextValue<At, Ch, Co, Ev, Me, Re, Us>;\n}>) => (\n <ChannelContext.Provider value={value as unknown as ChannelContextValue}>\n {children}\n </ChannelContext.Provider>\n);\n\nexport const useChannelContext = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>() => useContext(ChannelContext) as unknown as ChannelContextValue<At, Ch, Co, Ev, Me, Re, Us>;\n\n/**\n * Typescript currently does not support partial inference so if ChatContext\n * typing is desired while using the HOC withChannelContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withChannelContext = <\n P extends UnknownType,\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof ChannelContextValue<At, Ch, Co, Ev, Me, Re, Us>>> => {\n const WithChannelContextComponent = (\n props: Omit<P, keyof ChannelContextValue<At, Ch, Co, Ev, Me, Re, Us>>,\n ) => {\n const channelContext = useChannelContext<At, Ch, Co, Ev, Me, Re, Us>();\n\n return <Component {...(props as P)} {...channelContext} />;\n };\n WithChannelContextComponent.displayName = `WithChannelContext${getDisplayName(Component)}`;\n return WithChannelContextComponent;\n};\n"]}
1
+ {"version":3,"sources":["ChannelContext.tsx"],"names":["ChannelContext","React","createContext","ChannelProvider","children","value","useChannelContext","withChannelContext","Component","WithChannelContextComponent","props","channelContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;;;;AA0LO,IAAMA,cAAc,GAAGC,kBAAMC,aAAN,CAAoB,EAApB,CAAvB;;;;AAEA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB;AAAA,MAS7BC,QAT6B,QAS7BA,QAT6B;AAAA,MAU7BC,KAV6B,QAU7BA,KAV6B;AAAA,SAc7B,gCAAC,cAAD,CAAgB,QAAhB;AAAyB,IAAA,KAAK,EAAEA,KAAhC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAd6B;AAAA,CAAxB;;;;AAmBA,IAAME,iBAAiB,GAAG,SAApBA,iBAAoB;AAAA,SAQ1B,uBAAWN,cAAX,CAR0B;AAAA,CAA1B;;;;AAeA,IAAMO,kBAAkB,GAAG,SAArBA,kBAAqB,CAUhCC,SAVgC,EAW6C;AAC7E,MAAMC,2BAA2B,GAAG,SAA9BA,2BAA8B,CAClCC,KADkC,EAE/B;AACH,QAAMC,cAAc,GAAGL,iBAAiB,EAAxC;AAEA,WAAO,gCAAC,SAAD,gCAAgBI,KAAhB,EAAiCC,cAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,2BAA2B,CAACG,WAA5B,0BAA+D,oCAAeJ,SAAf,CAA/D;AACA,SAAOC,2BAAP;AACD,CArBM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport { getDisplayName } from '../utils/getDisplayName';\n\nimport type { Channel, ChannelState } from 'stream-chat';\n\nimport type { EmptyStateProps } from '../../components/Indicators/EmptyStateIndicator';\nimport type { LoadingProps } from '../../components/Indicators/LoadingIndicator';\nimport type {\n DefaultAttachmentType,\n DefaultChannelType,\n DefaultCommandType,\n DefaultEventType,\n DefaultMessageType,\n DefaultReactionType,\n DefaultUserType,\n UnknownType,\n} from '../../types/types';\n\nexport type ChannelConfig = {\n readEventsEnabled?: boolean;\n typingEventsEnabled?: boolean;\n};\n\nexport type ChannelContextValue<\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n> = {\n /**\n * Custom UI component to display empty state when channel has no messages.\n *\n * **Default** [EmptyStateIndicator](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Indicators/EmptyStateIndicator.tsx)\n */\n EmptyStateIndicator: React.ComponentType<EmptyStateProps>;\n /**\n * When set to true, reactions will be limited to 1 per user. If user selects another reaction\n * then his previous reaction will be removed and replaced with new one.\n *\n * This is similar to reaction UX on [iMessage application](https://en.wikipedia.org/wiki/IMessage).\n */\n enforceUniqueReaction: boolean;\n error: boolean;\n /**\n * When set to false, it will disable giphy command on MessageInput component.\n */\n giphyEnabled: boolean;\n /**\n * Hide inline date separators on channel\n */\n hideDateSeparators: boolean;\n hideStickyDateHeader: boolean;\n /**\n * Returns true if the current user has admin privileges\n */\n isAdmin: boolean;\n /**\n * Returns true if the current user is a moderator\n */\n isModerator: boolean;\n /**\n * Returns true if the current user is a owner\n */\n isOwner: boolean;\n loadChannelAtMessage: ({\n after,\n before,\n messageId,\n }: {\n after?: number;\n before?: number;\n messageId?: string;\n }) => Promise<void>;\n loading: boolean;\n /**\n * Custom loading indicator to override the Stream default\n */\n LoadingIndicator: React.ComponentType<LoadingProps>;\n markRead: () => void;\n /**\n *\n * ```json\n * {\n * \"thierry-123\": {\n * \"id\": \"thierry-123\",\n * \"role\": \"user\",\n * \"created_at\": \"2019-04-03T14:42:47.087869Z\",\n * \"updated_at\": \"2019-04-16T09:20:03.982283Z\",\n * \"last_active\": \"2019-04-16T11:23:51.168113408+02:00\",\n * \"online\": true\n * },\n * \"vishal-123\": {\n * \"id\": \"vishal-123\",\n * \"role\": \"user\",\n * \"created_at\": \"2019-05-03T14:42:47.087869Z\",\n * \"updated_at\": \"2019-05-16T09:20:03.982283Z\",\n * \"last_active\": \"2019-06-16T11:23:51.168113408+02:00\",\n * \"online\": false\n * }\n * }\n * ```\n */\n members: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['members'];\n /**\n * Custom network down indicator to override the Stream default\n */\n NetworkDownIndicator: React.ComponentType;\n read: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['read'];\n reloadChannel: () => Promise<void>;\n /**\n * When true, messagelist will be scrolled to first unread message, when opened.\n */\n scrollToFirstUnreadThreshold: number;\n setLastRead: React.Dispatch<React.SetStateAction<Date | undefined>>;\n setTargetedMessage: (messageId: string) => void;\n /**\n *\n * ```json\n * {\n * \"thierry-123\": {\n * \"id\": \"thierry-123\",\n * \"role\": \"user\",\n * \"created_at\": \"2019-04-03T14:42:47.087869Z\",\n * \"updated_at\": \"2019-04-16T09:20:03.982283Z\",\n * \"last_active\": \"2019-04-16T11:23:51.168113408+02:00\",\n * \"online\": true\n * },\n * \"vishal-123\": {\n * \"id\": \"vishal-123\",\n * \"role\": \"user\",\n * \"created_at\": \"2019-05-03T14:42:47.087869Z\",\n * \"updated_at\": \"2019-05-16T09:20:03.982283Z\",\n * \"last_active\": \"2019-06-16T11:23:51.168113408+02:00\",\n * \"online\": false\n * }\n * }\n * ```\n */\n watchers: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['watchers'];\n /**\n * Instance of channel object from stream-chat package.\n *\n * Please check the docs around how to create or query channel - https://getstream.io/chat/docs/javascript/creating_channels/?language=javascript\n *\n * ```\n * import { StreamChat, Channel } from 'stream-chat';\n * import { Chat, Channel} from 'stream-chat-react-native';\n *\n * const client = StreamChat.getInstance('api_key');\n * await client.connectUser('user_id', 'user_token');\n * const channel = client.channel('messaging', 'channel_id');\n * await channel.watch();\n *\n * <Chat client={client}>\n * <Channel channel={channel}>\n * </Channel>\n * </Chat>\n * ```\n *\n * @overrideType Channel\n */\n channel?: Channel<At, Ch, Co, Ev, Me, Re, Us>;\n disabled?: boolean;\n enableMessageGroupingByUser?: boolean;\n lastRead?: Date;\n /**\n * Maximum time in milliseconds that should occur between messages\n * to still consider them grouped together\n */\n maxTimeBetweenGroupedMessages?: number;\n /**\n * Custom UI component for sticky header of channel.\n *\n * **Default** [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageList/DateHeader.tsx)\n */\n StickyHeader?: React.ComponentType<{ dateString: string }>;\n /**\n * Id of message, around which Channel/MessageList gets loaded when opened.\n * You will see a highlighted background for targetted message, when opened.\n */\n targetedMessage?: string;\n watcherCount?: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['watcher_count'];\n} & ChannelConfig;\n\nexport const ChannelContext = React.createContext({} as ChannelContextValue);\n\nexport const ChannelProvider = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value: ChannelContextValue<At, Ch, Co, Ev, Me, Re, Us>;\n}>) => (\n <ChannelContext.Provider value={value as unknown as ChannelContextValue}>\n {children}\n </ChannelContext.Provider>\n);\n\nexport const useChannelContext = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>() => useContext(ChannelContext) as unknown as ChannelContextValue<At, Ch, Co, Ev, Me, Re, Us>;\n\n/**\n * Typescript currently does not support partial inference so if ChatContext\n * typing is desired while using the HOC withChannelContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withChannelContext = <\n P extends UnknownType,\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof ChannelContextValue<At, Ch, Co, Ev, Me, Re, Us>>> => {\n const WithChannelContextComponent = (\n props: Omit<P, keyof ChannelContextValue<At, Ch, Co, Ev, Me, Re, Us>>,\n ) => {\n const channelContext = useChannelContext<At, Ch, Co, Ev, Me, Re, Us>();\n\n return <Component {...(props as P)} {...channelContext} />;\n };\n WithChannelContextComponent.displayName = `WithChannelContext${getDisplayName(Component)}`;\n return WithChannelContextComponent;\n};\n"]}
@@ -32,7 +32,7 @@ var MessagesProvider = function MessagesProvider(_ref) {
32
32
  __self: _this,
33
33
  __source: {
34
34
  fileName: _jsxFileName,
35
- lineNumber: 591,
35
+ lineNumber: 593,
36
36
  columnNumber: 3
37
37
  }
38
38
  }, children);
@@ -53,7 +53,7 @@ var withMessagesContext = function withMessagesContext(Component) {
53
53
  __self: _this,
54
54
  __source: {
55
55
  fileName: _jsxFileName,
56
- lineNumber: 628,
56
+ lineNumber: 630,
57
57
  columnNumber: 12
58
58
  }
59
59
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["MessagesContext.tsx"],"names":["MessagesContext","React","createContext","MessagesProvider","children","value","useMessagesContext","withMessagesContext","Component","WithMessagesContextComponent","props","messagesContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;;;;AA4jBO,IAAMA,eAAe,GAAGC,kBAAMC,aAAN,CAAoB,EAApB,CAAxB;;;;AAEA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAAA,MAS9BC,QAT8B,QAS9BA,QAT8B;AAAA,MAU9BC,KAV8B,QAU9BA,KAV8B;AAAA,SAc9B,gCAAC,eAAD,CAAiB,QAAjB;AAA0B,IAAA,KAAK,EAAEA,KAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAd8B;AAAA,CAAzB;;;;AAmBA,IAAME,kBAAkB,GAAG,SAArBA,kBAAqB;AAAA,SAQ3B,uBAAWN,eAAX,CAR2B;AAAA,CAA3B;;;;AAeA,IAAMO,mBAAmB,GAAG,SAAtBA,mBAAsB,CAUjCC,SAViC,EAW6C;AAC9E,MAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CACnCC,KADmC,EAEhC;AACH,QAAMC,eAAe,GAAGL,kBAAkB,EAA1C;AAEA,WAAO,gCAAC,SAAD,gCAAgBI,KAAhB,EAAiCC,eAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,4BAA4B,CAACG,WAA7B,2BAAiE,oCAAeJ,SAAf,CAAjE;AACA,SAAOC,4BAAP;AACD,CArBM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport { getDisplayName } from '../utils/getDisplayName';\n\nimport type { TouchableOpacityProps } from 'react-native';\n\nimport type { ChannelState, MessageResponse } from 'stream-chat';\n\nimport type { Alignment } from '../messageContext/MessageContext';\nimport type { MessageAction } from '../messageOverlayContext/MessageOverlayContext';\nimport type { SuggestionCommand } from '../suggestionsContext/SuggestionsContext';\nimport type { DeepPartial } from '../themeContext/ThemeContext';\nimport type { Theme } from '../themeContext/utils/theme';\nimport type { TDateTimeParserInput } from '../translationContext/TranslationContext';\n\nimport type { AttachmentProps } from '../../components/Attachment/Attachment';\nimport type { AttachmentActionsProps } from '../../components/Attachment/AttachmentActions';\nimport type { CardProps } from '../../components/Attachment/Card';\nimport type { FileAttachmentProps } from '../../components/Attachment/FileAttachment';\nimport type { FileAttachmentGroupProps } from '../../components/Attachment/FileAttachmentGroup';\nimport type { FileIconProps } from '../../components/Attachment/FileIcon';\nimport type { GalleryProps } from '../../components/Attachment/Gallery';\nimport type { GiphyProps } from '../../components/Attachment/Giphy';\nimport type {\n MessageProps,\n MessageTouchableHandlerPayload,\n} from '../../components/Message/Message';\nimport type { MessageAvatarProps } from '../../components/Message/MessageSimple/MessageAvatar';\nimport type { MessageContentProps } from '../../components/Message/MessageSimple/MessageContent';\nimport type { MessageDeletedProps } from '../../components/Message/MessageSimple/MessageDeleted';\nimport type { MessageFooterProps } from '../../components/Message/MessageSimple/MessageFooter';\nimport type { MessageRepliesProps } from '../../components/Message/MessageSimple/MessageReplies';\nimport type { MessageRepliesAvatarsProps } from '../../components/Message/MessageSimple/MessageRepliesAvatars';\nimport type { MessageStatusProps } from '../../components/Message/MessageSimple/MessageStatus';\nimport type { MessageSimpleProps } from '../../components/Message/MessageSimple/MessageSimple';\nimport type { MessageTextProps } from '../../components/Message/MessageSimple/MessageTextContainer';\nimport type { MarkdownRules } from '../../components/Message/MessageSimple/utils/renderText';\nimport type { DateHeaderProps } from '../../components/MessageList/DateHeader';\nimport type { MessageType } from '../../components/MessageList/hooks/useMessageList';\nimport type { InlineDateSeparatorProps } from '../../components/MessageList/InlineDateSeparator';\nimport type { MessageListProps } from '../../components/MessageList/MessageList';\nimport type { ScrollToBottomButtonProps } from '../../components/MessageList/ScrollToBottomButton';\nimport type { MessageSystemProps } from '../../components/MessageList/MessageSystem';\nimport type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList';\nimport type { ReactionListProps } from '../../components/Message/MessageSimple/ReactionList';\nimport type { ReplyProps } from '../../components/Reply/Reply';\nimport type { FlatList } from '../../native';\nimport type {\n DefaultAttachmentType,\n DefaultChannelType,\n DefaultCommandType,\n DefaultEventType,\n DefaultMessageType,\n DefaultReactionType,\n DefaultUserType,\n UnknownType,\n} from '../../types/types';\nimport type { ReactionData } from '../../utils/utils';\n\nexport type MessagesConfig = {\n mutesEnabled?: boolean;\n quotedRepliesEnabled?: boolean;\n reactionsEnabled?: boolean;\n threadRepliesEnabled?: boolean;\n};\n\nexport type MessageContentType = 'attachments' | 'files' | 'gallery' | 'quoted_reply' | 'text';\n\nexport type MessagesContextValue<\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n> = MessagesConfig & {\n /**\n * UI component for Attachment.\n * Defaults to: [Attachment](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/Attachment.tsx)\n */\n Attachment: React.ComponentType<AttachmentProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component to display AttachmentActions. e.g., send, shuffle, cancel in case of giphy\n * Defaults to: [AttachmentActions](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/AttachmentActions.tsx)\n */\n AttachmentActions: React.ComponentType<AttachmentActionsProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component to display generic media type e.g. giphy, url preview etc\n * Defaults to: [Card](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/Card.tsx)\n */\n Card: React.ComponentType<CardProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for DateHeader\n * Defaults to: [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageList/DateHeader.tsx)\n **/\n DateHeader: React.ComponentType<DateHeaderProps>;\n /** Should keyboard be dismissed when messaged is touched */\n dismissKeyboardOnMessageTouch: boolean;\n /**\n * UI component to display File type attachment.\n * Defaults to: [FileAttachment](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/FileAttachment.tsx)\n */\n FileAttachment: React.ComponentType<FileAttachmentProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component to display group of File type attachments or multiple file attachments (in single message).\n * Defaults to: [FileAttachmentGroup](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/FileAttachmentGroup.tsx)\n */\n FileAttachmentGroup: React.ComponentType<FileAttachmentGroupProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for attachment icon for type 'file' attachment.\n * Defaults to: https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/FileIcon.tsx\n */\n FileAttachmentIcon: React.ComponentType<FileIconProps>;\n FlatList: typeof FlatList;\n /**\n * UI component to display image attachments\n * Defaults to: [Gallery](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/Gallery.tsx)\n */\n Gallery: React.ComponentType<GalleryProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for Giphy\n * Defaults to: [Giphy](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/Giphy.tsx)\n */\n Giphy: React.ComponentType<GiphyProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * When true, messageList will be scrolled at first unread message, when opened.\n */\n initialScrollToFirstUnreadMessage: boolean;\n /**\n * UI component for Message Date Separator Component\n * Defaults to: [InlineDateSeparator](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageList/InlineDateSeparator.tsx)\n */\n InlineDateSeparator: React.ComponentType<InlineDateSeparatorProps>;\n /**\n * UI component for InlineUnreadIndicator\n * Defaults to: [InlineUnreadIndicator](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/MessageSimple/InlineUnreadIndicator.tsx)\n **/\n InlineUnreadIndicator: React.ComponentType;\n Message: React.ComponentType<MessageProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for MessageAvatar\n * Defaults to: [MessageAvatar](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/MessageSimple/MessageAvatar.tsx)\n **/\n MessageAvatar: React.ComponentType<MessageAvatarProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for MessageContent\n * Defaults to: [MessageContent](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/MessageSimple/MessageContent.tsx)\n */\n MessageContent: React.ComponentType<MessageContentProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /** Order to render the message content */\n messageContentOrder: MessageContentType[];\n /**\n * UI component for MessageDeleted\n * Defaults to: [MessageDeleted](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageSimple/MessageDeleted.tsx)\n */\n MessageDeleted: React.ComponentType<MessageDeletedProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Custom message footer component\n */\n MessageFooter: React.ComponentType<MessageFooterProps<At, Ch, Co, Ev, Me, Re, Us>>;\n MessageList: React.ComponentType<MessageListProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for MessageReplies\n * Defaults to: [MessageReplies](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageSimple/MessageReplies.tsx)\n */\n MessageReplies: React.ComponentType<MessageRepliesProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI Component for MessageRepliesAvatars\n * Defaults to: [MessageRepliesAvatars](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageSimple/MessageRepliesAvatars.tsx)\n */\n MessageRepliesAvatars: React.ComponentType<\n MessageRepliesAvatarsProps<At, Ch, Co, Ev, Me, Re, Us>\n >;\n /**\n * UI component for MessageSimple\n * Defaults to: [MessageSimple](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/MessageSimple/MessageSimple.tsx)\n */\n MessageSimple: React.ComponentType<MessageSimpleProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for MessageStatus (delivered/read)\n * Defaults to: [MessageStatus](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/MessageSimple/MessageStatus.tsx)\n */\n MessageStatus: React.ComponentType<MessageStatusProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for MessageSystem\n * Defaults to: [MessageSystem](https://getstream.github.io/stream-chat-react-native/v3/#messagesystem)\n */\n MessageSystem: React.ComponentType<MessageSystemProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for OverlayReactionList\n */\n OverlayReactionList: React.ComponentType<OverlayReactionListProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for ReactionList\n * Defaults to: [ReactionList](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Reaction/ReactionList.tsx)\n */\n ReactionList: React.ComponentType<ReactionListProps<At, Ch, Co, Ev, Me, Re, Us>>;\n removeMessage: (message: { id: string; parent_id?: string }) => void;\n /**\n * UI component for Reply\n * Defaults to: [Reply](https://getstream.github.io/stream-chat-react-native/v3/#reply)\n */\n Reply: React.ComponentType<ReplyProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Override the api request for retry message functionality.\n */\n retrySendMessage: (message: MessageResponse<At, Ch, Co, Me, Re, Us>) => Promise<void>;\n /**\n * UI component for ScrollToBottomButton\n * Defaults to: [ScrollToBottomButton](https://getstream.github.io/stream-chat-react-native/v3/#ScrollToBottomButton)\n */\n ScrollToBottomButton: React.ComponentType<ScrollToBottomButtonProps>;\n setEditingState: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => void;\n setQuotedMessageState: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => void;\n supportedReactions: ReactionData[];\n /**\n * UI component for TypingIndicator\n * Defaults to: [TypingIndicator](https://getstream.github.io/stream-chat-react-native/v3/#typingindicator)\n */\n TypingIndicator: React.ComponentType;\n /**\n * UI component for TypingIndicatorContainer\n * Defaults to: [TypingIndicatorContainer](https://getstream.github.io/stream-chat-react-native/v3/#typingindicatorcontainer)\n */\n TypingIndicatorContainer: React.ComponentType;\n updateMessage: (\n updatedMessage: MessageResponse<At, Ch, Co, Me, Re, Us>,\n extraState?: {\n commands?: SuggestionCommand<Co>[];\n messageInput?: string;\n threadMessages?: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['threads'][string];\n },\n ) => void;\n /**\n * Custom UI component to display enriched url preview.\n * Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/Card.tsx\n */\n UrlPreview: React.ComponentType<CardProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Provide any additional props for `TouchableOpacity` which wraps inner MessageContent component here.\n * Please check docs for TouchableOpacity for supported props - https://reactnative.dev/docs/touchableopacity#props\n *\n * @overrideType Object\n */\n additionalTouchableProps?: Omit<TouchableOpacityProps, 'style'>;\n /**\n * When false, pop-out animation will be disabled for message bubble, onLongPress\n */\n animatedLongPress?: boolean;\n /**\n * Full override of the block user button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n blockUser?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Custom UI component to override default cover (between Header and Footer) of Card component.\n * Accepts the same props as Card component.\n */\n CardCover?: React.ComponentType<CardProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Custom UI component to override default Footer of Card component.\n * Accepts the same props as Card component.\n */\n CardFooter?: React.ComponentType<CardProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Custom UI component to override default header of Card component.\n * Accepts the same props as Card component.\n */\n CardHeader?: React.ComponentType<CardProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Full override of the copy message button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n copyMessage?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Full override of the delete message button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n deleteMessage?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n disableTypingIndicator?: boolean;\n /**\n * Full override of the edit message button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n editMessage?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Full override of the flag message button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n flagMessage?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Whether messages should be aligned to right or left part of screen.\n * By default, messages will be received messages will be aligned to left and\n * sent messages will be aligned to right.\n */\n forceAlignMessages?: Alignment | boolean;\n /**\n * Optional function to custom format the message date\n */\n formatDate?: (date: TDateTimeParserInput) => string;\n handleBlock?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to access when a copy message action is invoked */\n handleCopy?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to access when a delete message action is invoked */\n handleDelete?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to access when an edit message action is invoked */\n handleEdit?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => void;\n /** Handler to access when a flag message action is invoked */\n handleFlag?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to access when a mute user action is invoked */\n handleMute?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to access when a quoted reply action is invoked */\n handleQuotedReply?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to process a reaction */\n handleReaction?: (\n message: MessageType<At, Ch, Co, Ev, Me, Re, Us>,\n reactionType: string,\n ) => Promise<void>;\n /** Handler to access when a retry action is invoked */\n handleRetry?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to access when a thread reply action is invoked */\n handleThreadReply?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Object specifying rules defined within simple-markdown https://github.com/Khan/simple-markdown#adding-a-simple-extension */\n markdownRules?: MarkdownRules;\n /**\n * Use this prop to override message actions (which pop-up in message overlay).\n *\n * You can either completely override the default messageActions object.\n *\n * ```\n * <Channel\n * messageActions=[\n * {\n * action: () => { someAction() };\n * title: \"Pin Message\";\n * icon: PinIcon;\n * titleStyle: {};\n * },\n * {\n * action: () => { someAction() };\n * title: \"Delete Message\";\n * icon: PinIcon;\n * titleStyle: {};\n * }\n * ]\n * >\n * </Channel>\n * ```\n *\n * Or you can selectly keep certain action and remove some:\n *\n * e.g. Lets say you only want to keep threadReply and copyMessage actions\n *\n * ```\n * <Channel\n * messageActions={({\n * blockUser,\n * copyMessage,\n * deleteMessage,\n * editMessage,\n * flagMessage,\n * muteUser,\n * quotedReply,\n * retry,\n * threadReply,\n * }) => ([\n * threadReply, copyMessage\n * ])}\n * >\n * </Channel>\n * ```\n *\n * @overrideType Function | Array<Objects>\n */\n messageActions?:\n | (MessageAction | null)[]\n | (({\n blockUser,\n canModifyMessage,\n copyMessage,\n deleteMessage,\n dismissOverlay,\n editMessage,\n error,\n flagMessage,\n isMyMessage,\n isThreadMessage,\n message,\n messageReactions,\n muteUser,\n quotedRepliesEnabled,\n quotedReply,\n retry,\n threadRepliesEnabled,\n threadReply,\n }: {\n blockUser: MessageAction | null;\n canModifyMessage: boolean;\n copyMessage: MessageAction | null;\n deleteMessage: MessageAction | null;\n dismissOverlay: () => void;\n editMessage: MessageAction | null;\n error: boolean;\n flagMessage: MessageAction | null;\n isMyMessage: boolean;\n isThreadMessage: boolean;\n message: MessageType<At, Ch, Co, Ev, Me, Re, Us>;\n messageReactions: boolean;\n muteUser: MessageAction | null;\n quotedReply: MessageAction | null;\n retry: MessageAction | null;\n threadReply: MessageAction | null;\n quotedRepliesEnabled?: boolean;\n threadRepliesEnabled?: boolean;\n }) => (MessageAction | null)[] | undefined);\n /**\n * Custom message header component\n */\n MessageHeader?: React.ComponentType<MessageFooterProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /** Custom UI component for message text */\n MessageText?: React.ComponentType<MessageTextProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Full override of the mute user button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n * */\n muteUser?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Theme provided only to messages that are the current users\n */\n myMessageTheme?: DeepPartial<Theme>;\n /**\n * Add double tap handler for message.\n *\n * ```\n * <Channel\n * onDoubleTapMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onDoubleTapMessage?: (\n payload: MessageTouchableHandlerPayload<At, Ch, Co, Ev, Me, Re, Us>,\n ) => void;\n /**\n * Override default handler for onLongPress on message. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onLongPressMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onLongPressMessage?: (\n payload: MessageTouchableHandlerPayload<At, Ch, Co, Ev, Me, Re, Us>,\n ) => void;\n /**\n * Add onPressIn handler for attachments. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onPressInMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onPressInMessage?: (payload: MessageTouchableHandlerPayload<At, Ch, Co, Ev, Me, Re, Us>) => void;\n /**\n * Override onPress handler for message. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onPressMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occurred\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onPressMessage?: (payload: MessageTouchableHandlerPayload<At, Ch, Co, Ev, Me, Re, Us>) => void;\n /**\n * Full override of the quoted reply button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n quotedReply?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Full override of the resend button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n * */\n retry?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Full override of the reaction function on Message and Message Overlay\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n * */\n selectReaction?: (\n message: MessageType<At, Ch, Co, Ev, Me, Re, Us>,\n ) => (reactionType: string) => Promise<void>;\n /**\n * Full override of the thread reply button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n * */\n threadReply?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction;\n};\n\nexport const MessagesContext = React.createContext({} as MessagesContextValue);\n\nexport const MessagesProvider = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value?: MessagesContextValue<At, Ch, Co, Ev, Me, Re, Us>;\n}>) => (\n <MessagesContext.Provider value={value as unknown as MessagesContextValue}>\n {children}\n </MessagesContext.Provider>\n);\n\nexport const useMessagesContext = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>() => useContext(MessagesContext) as unknown as MessagesContextValue<At, Ch, Co, Ev, Me, Re, Us>;\n\n/**\n * Typescript currently does not support partial inference so if MessagesContext\n * typing is desired while using the HOC withMessagesContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withMessagesContext = <\n P extends UnknownType,\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof MessagesContextValue<At, Ch, Co, Ev, Me, Re, Us>>> => {\n const WithMessagesContextComponent = (\n props: Omit<P, keyof MessagesContextValue<At, Ch, Co, Ev, Me, Re, Us>>,\n ) => {\n const messagesContext = useMessagesContext<At, Ch, Co, Ev, Me, Re, Us>();\n\n return <Component {...(props as P)} {...messagesContext} />;\n };\n WithMessagesContextComponent.displayName = `WithMessagesContext${getDisplayName(Component)}`;\n return WithMessagesContextComponent;\n};\n"]}
1
+ {"version":3,"sources":["MessagesContext.tsx"],"names":["MessagesContext","React","createContext","MessagesProvider","children","value","useMessagesContext","withMessagesContext","Component","WithMessagesContextComponent","props","messagesContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;;;;AA8jBO,IAAMA,eAAe,GAAGC,kBAAMC,aAAN,CAAoB,EAApB,CAAxB;;;;AAEA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAAA,MAS9BC,QAT8B,QAS9BA,QAT8B;AAAA,MAU9BC,KAV8B,QAU9BA,KAV8B;AAAA,SAc9B,gCAAC,eAAD,CAAiB,QAAjB;AAA0B,IAAA,KAAK,EAAEA,KAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAd8B;AAAA,CAAzB;;;;AAmBA,IAAME,kBAAkB,GAAG,SAArBA,kBAAqB;AAAA,SAQ3B,uBAAWN,eAAX,CAR2B;AAAA,CAA3B;;;;AAeA,IAAMO,mBAAmB,GAAG,SAAtBA,mBAAsB,CAUjCC,SAViC,EAW6C;AAC9E,MAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CACnCC,KADmC,EAEhC;AACH,QAAMC,eAAe,GAAGL,kBAAkB,EAA1C;AAEA,WAAO,gCAAC,SAAD,gCAAgBI,KAAhB,EAAiCC,eAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,4BAA4B,CAACG,WAA7B,2BAAiE,oCAAeJ,SAAf,CAAjE;AACA,SAAOC,4BAAP;AACD,CArBM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport { getDisplayName } from '../utils/getDisplayName';\n\nimport type { TouchableOpacityProps } from 'react-native';\n\nimport type { ChannelState, MessageResponse } from 'stream-chat';\n\nimport type { Alignment } from '../messageContext/MessageContext';\nimport type { MessageAction } from '../messageOverlayContext/MessageOverlayContext';\nimport type { SuggestionCommand } from '../suggestionsContext/SuggestionsContext';\nimport type { DeepPartial } from '../themeContext/ThemeContext';\nimport type { Theme } from '../themeContext/utils/theme';\nimport type { TDateTimeParserInput } from '../translationContext/TranslationContext';\n\nimport type { AttachmentProps } from '../../components/Attachment/Attachment';\nimport type { AttachmentActionsProps } from '../../components/Attachment/AttachmentActions';\nimport type { CardProps } from '../../components/Attachment/Card';\nimport type { FileAttachmentProps } from '../../components/Attachment/FileAttachment';\nimport type { FileAttachmentGroupProps } from '../../components/Attachment/FileAttachmentGroup';\nimport type { FileIconProps } from '../../components/Attachment/FileIcon';\nimport type { GalleryProps } from '../../components/Attachment/Gallery';\nimport type { GiphyProps } from '../../components/Attachment/Giphy';\nimport type {\n MessageProps,\n MessageTouchableHandlerPayload,\n} from '../../components/Message/Message';\nimport type { MessageAvatarProps } from '../../components/Message/MessageSimple/MessageAvatar';\nimport type { MessageContentProps } from '../../components/Message/MessageSimple/MessageContent';\nimport type { MessageDeletedProps } from '../../components/Message/MessageSimple/MessageDeleted';\nimport type { MessageFooterProps } from '../../components/Message/MessageSimple/MessageFooter';\nimport type { MessageRepliesProps } from '../../components/Message/MessageSimple/MessageReplies';\nimport type { MessageRepliesAvatarsProps } from '../../components/Message/MessageSimple/MessageRepliesAvatars';\nimport type { MessageStatusProps } from '../../components/Message/MessageSimple/MessageStatus';\nimport type { MessageSimpleProps } from '../../components/Message/MessageSimple/MessageSimple';\nimport type { MessageTextProps } from '../../components/Message/MessageSimple/MessageTextContainer';\nimport type { MarkdownRules } from '../../components/Message/MessageSimple/utils/renderText';\nimport type { DateHeaderProps } from '../../components/MessageList/DateHeader';\nimport type { MessageType } from '../../components/MessageList/hooks/useMessageList';\nimport type { InlineDateSeparatorProps } from '../../components/MessageList/InlineDateSeparator';\nimport type { MessageListProps } from '../../components/MessageList/MessageList';\nimport type { ScrollToBottomButtonProps } from '../../components/MessageList/ScrollToBottomButton';\nimport type { MessageSystemProps } from '../../components/MessageList/MessageSystem';\nimport type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList';\nimport type { ReactionListProps } from '../../components/Message/MessageSimple/ReactionList';\nimport type { ReplyProps } from '../../components/Reply/Reply';\nimport type { FlatList } from '../../native';\nimport type {\n DefaultAttachmentType,\n DefaultChannelType,\n DefaultCommandType,\n DefaultEventType,\n DefaultMessageType,\n DefaultReactionType,\n DefaultUserType,\n UnknownType,\n} from '../../types/types';\nimport type { ReactionData } from '../../utils/utils';\n\nexport type MessagesConfig = {\n mutesEnabled?: boolean;\n quotedRepliesEnabled?: boolean;\n reactionsEnabled?: boolean;\n threadRepliesEnabled?: boolean;\n};\n\nexport type MessageContentType = 'attachments' | 'files' | 'gallery' | 'quoted_reply' | 'text';\n\nexport type MessagesContextValue<\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n> = MessagesConfig & {\n /**\n * UI component for Attachment.\n * Defaults to: [Attachment](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/Attachment.tsx)\n */\n Attachment: React.ComponentType<AttachmentProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component to display AttachmentActions. e.g., send, shuffle, cancel in case of giphy\n * Defaults to: [AttachmentActions](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/AttachmentActions.tsx)\n */\n AttachmentActions: React.ComponentType<AttachmentActionsProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component to display generic media type e.g. giphy, url preview etc\n * Defaults to: [Card](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/Card.tsx)\n */\n Card: React.ComponentType<CardProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for DateHeader\n * Defaults to: [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageList/DateHeader.tsx)\n **/\n DateHeader: React.ComponentType<DateHeaderProps>;\n /** Should keyboard be dismissed when messaged is touched */\n dismissKeyboardOnMessageTouch: boolean;\n enableMessageGroupingByUser: boolean;\n /**\n * UI component to display File type attachment.\n * Defaults to: [FileAttachment](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/FileAttachment.tsx)\n */\n FileAttachment: React.ComponentType<FileAttachmentProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component to display group of File type attachments or multiple file attachments (in single message).\n * Defaults to: [FileAttachmentGroup](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/FileAttachmentGroup.tsx)\n */\n FileAttachmentGroup: React.ComponentType<FileAttachmentGroupProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for attachment icon for type 'file' attachment.\n * Defaults to: https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/FileIcon.tsx\n */\n FileAttachmentIcon: React.ComponentType<FileIconProps>;\n FlatList: typeof FlatList;\n /**\n * UI component to display image attachments\n * Defaults to: [Gallery](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/Gallery.tsx)\n */\n Gallery: React.ComponentType<GalleryProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for Giphy\n * Defaults to: [Giphy](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/Giphy.tsx)\n */\n Giphy: React.ComponentType<GiphyProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * When true, messageList will be scrolled at first unread message, when opened.\n */\n initialScrollToFirstUnreadMessage: boolean;\n /**\n * UI component for Message Date Separator Component\n * Defaults to: [InlineDateSeparator](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageList/InlineDateSeparator.tsx)\n */\n InlineDateSeparator: React.ComponentType<InlineDateSeparatorProps>;\n /**\n * UI component for InlineUnreadIndicator\n * Defaults to: [InlineUnreadIndicator](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/MessageSimple/InlineUnreadIndicator.tsx)\n **/\n InlineUnreadIndicator: React.ComponentType;\n Message: React.ComponentType<MessageProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for MessageAvatar\n * Defaults to: [MessageAvatar](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/MessageSimple/MessageAvatar.tsx)\n **/\n MessageAvatar: React.ComponentType<MessageAvatarProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for MessageContent\n * Defaults to: [MessageContent](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/MessageSimple/MessageContent.tsx)\n */\n MessageContent: React.ComponentType<MessageContentProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /** Order to render the message content */\n messageContentOrder: MessageContentType[];\n /**\n * UI component for MessageDeleted\n * Defaults to: [MessageDeleted](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageSimple/MessageDeleted.tsx)\n */\n MessageDeleted: React.ComponentType<MessageDeletedProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Custom message footer component\n */\n MessageFooter: React.ComponentType<MessageFooterProps<At, Ch, Co, Ev, Me, Re, Us>>;\n MessageList: React.ComponentType<MessageListProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for MessageReplies\n * Defaults to: [MessageReplies](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageSimple/MessageReplies.tsx)\n */\n MessageReplies: React.ComponentType<MessageRepliesProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI Component for MessageRepliesAvatars\n * Defaults to: [MessageRepliesAvatars](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageSimple/MessageRepliesAvatars.tsx)\n */\n MessageRepliesAvatars: React.ComponentType<\n MessageRepliesAvatarsProps<At, Ch, Co, Ev, Me, Re, Us>\n >;\n /**\n * UI component for MessageSimple\n * Defaults to: [MessageSimple](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/MessageSimple/MessageSimple.tsx)\n */\n MessageSimple: React.ComponentType<MessageSimpleProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for MessageStatus (delivered/read)\n * Defaults to: [MessageStatus](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Message/MessageSimple/MessageStatus.tsx)\n */\n MessageStatus: React.ComponentType<MessageStatusProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for MessageSystem\n * Defaults to: [MessageSystem](https://getstream.github.io/stream-chat-react-native/v3/#messagesystem)\n */\n MessageSystem: React.ComponentType<MessageSystemProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for OverlayReactionList\n */\n OverlayReactionList: React.ComponentType<OverlayReactionListProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * UI component for ReactionList\n * Defaults to: [ReactionList](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Reaction/ReactionList.tsx)\n */\n ReactionList: React.ComponentType<ReactionListProps<At, Ch, Co, Ev, Me, Re, Us>>;\n removeMessage: (message: { id: string; parent_id?: string }) => void;\n /**\n * UI component for Reply\n * Defaults to: [Reply](https://getstream.github.io/stream-chat-react-native/v3/#reply)\n */\n Reply: React.ComponentType<ReplyProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Override the api request for retry message functionality.\n */\n retrySendMessage: (message: MessageResponse<At, Ch, Co, Me, Re, Us>) => Promise<void>;\n /**\n * UI component for ScrollToBottomButton\n * Defaults to: [ScrollToBottomButton](https://getstream.github.io/stream-chat-react-native/v3/#ScrollToBottomButton)\n */\n ScrollToBottomButton: React.ComponentType<ScrollToBottomButtonProps>;\n setEditingState: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => void;\n setQuotedMessageState: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => void;\n supportedReactions: ReactionData[];\n /**\n * UI component for TypingIndicator\n * Defaults to: [TypingIndicator](https://getstream.github.io/stream-chat-react-native/v3/#typingindicator)\n */\n TypingIndicator: React.ComponentType;\n /**\n * UI component for TypingIndicatorContainer\n * Defaults to: [TypingIndicatorContainer](https://getstream.github.io/stream-chat-react-native/v3/#typingindicatorcontainer)\n */\n TypingIndicatorContainer: React.ComponentType;\n updateMessage: (\n updatedMessage: MessageResponse<At, Ch, Co, Me, Re, Us>,\n extraState?: {\n commands?: SuggestionCommand<Co>[];\n messageInput?: string;\n threadMessages?: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['threads'][string];\n },\n ) => void;\n /**\n * Custom UI component to display enriched url preview.\n * Defaults to https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/Attachment/Card.tsx\n */\n UrlPreview: React.ComponentType<CardProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Provide any additional props for `TouchableOpacity` which wraps inner MessageContent component here.\n * Please check docs for TouchableOpacity for supported props - https://reactnative.dev/docs/touchableopacity#props\n *\n * @overrideType Object\n */\n additionalTouchableProps?: Omit<TouchableOpacityProps, 'style'>;\n /**\n * When false, pop-out animation will be disabled for message bubble, onLongPress\n */\n animatedLongPress?: boolean;\n /**\n * Full override of the block user button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n blockUser?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Custom UI component to override default cover (between Header and Footer) of Card component.\n * Accepts the same props as Card component.\n */\n CardCover?: React.ComponentType<CardProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Custom UI component to override default Footer of Card component.\n * Accepts the same props as Card component.\n */\n CardFooter?: React.ComponentType<CardProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Custom UI component to override default header of Card component.\n * Accepts the same props as Card component.\n */\n CardHeader?: React.ComponentType<CardProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Full override of the copy message button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n copyMessage?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Full override of the delete message button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n deleteMessage?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n disableTypingIndicator?: boolean;\n /**\n * Full override of the edit message button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n editMessage?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Full override of the flag message button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n flagMessage?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Whether messages should be aligned to right or left part of screen.\n * By default, messages will be received messages will be aligned to left and\n * sent messages will be aligned to right.\n */\n forceAlignMessages?: Alignment | boolean;\n /**\n * Optional function to custom format the message date\n */\n formatDate?: (date: TDateTimeParserInput) => string;\n handleBlock?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to access when a copy message action is invoked */\n handleCopy?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to access when a delete message action is invoked */\n handleDelete?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to access when an edit message action is invoked */\n handleEdit?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => void;\n /** Handler to access when a flag message action is invoked */\n handleFlag?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to access when a mute user action is invoked */\n handleMute?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to access when a quoted reply action is invoked */\n handleQuotedReply?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to process a reaction */\n handleReaction?: (\n message: MessageType<At, Ch, Co, Ev, Me, Re, Us>,\n reactionType: string,\n ) => Promise<void>;\n /** Handler to access when a retry action is invoked */\n handleRetry?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n /** Handler to access when a thread reply action is invoked */\n handleThreadReply?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => Promise<void>;\n legacyImageViewerSwipeBehaviour?: boolean;\n /** Object specifying rules defined within simple-markdown https://github.com/Khan/simple-markdown#adding-a-simple-extension */\n markdownRules?: MarkdownRules;\n /**\n * Use this prop to override message actions (which pop-up in message overlay).\n *\n * You can either completely override the default messageActions object.\n *\n * ```\n * <Channel\n * messageActions=[\n * {\n * action: () => { someAction() };\n * title: \"Pin Message\";\n * icon: PinIcon;\n * titleStyle: {};\n * },\n * {\n * action: () => { someAction() };\n * title: \"Delete Message\";\n * icon: PinIcon;\n * titleStyle: {};\n * }\n * ]\n * >\n * </Channel>\n * ```\n *\n * Or you can selectly keep certain action and remove some:\n *\n * e.g. Lets say you only want to keep threadReply and copyMessage actions\n *\n * ```\n * <Channel\n * messageActions={({\n * blockUser,\n * copyMessage,\n * deleteMessage,\n * editMessage,\n * flagMessage,\n * muteUser,\n * quotedReply,\n * retry,\n * threadReply,\n * }) => ([\n * threadReply, copyMessage\n * ])}\n * >\n * </Channel>\n * ```\n *\n * @overrideType Function | Array<Objects>\n */\n messageActions?:\n | (MessageAction | null)[]\n | (({\n blockUser,\n canModifyMessage,\n copyMessage,\n deleteMessage,\n dismissOverlay,\n editMessage,\n error,\n flagMessage,\n isMyMessage,\n isThreadMessage,\n message,\n messageReactions,\n muteUser,\n quotedRepliesEnabled,\n quotedReply,\n retry,\n threadRepliesEnabled,\n threadReply,\n }: {\n blockUser: MessageAction | null;\n canModifyMessage: boolean;\n copyMessage: MessageAction | null;\n deleteMessage: MessageAction | null;\n dismissOverlay: () => void;\n editMessage: MessageAction | null;\n error: boolean;\n flagMessage: MessageAction | null;\n isMyMessage: boolean;\n isThreadMessage: boolean;\n message: MessageType<At, Ch, Co, Ev, Me, Re, Us>;\n messageReactions: boolean;\n muteUser: MessageAction | null;\n quotedReply: MessageAction | null;\n retry: MessageAction | null;\n threadReply: MessageAction | null;\n quotedRepliesEnabled?: boolean;\n threadRepliesEnabled?: boolean;\n }) => (MessageAction | null)[] | undefined);\n /**\n * Custom message header component\n */\n MessageHeader?: React.ComponentType<MessageFooterProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /** Custom UI component for message text */\n MessageText?: React.ComponentType<MessageTextProps<At, Ch, Co, Ev, Me, Re, Us>>;\n /**\n * Full override of the mute user button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n * */\n muteUser?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Theme provided only to messages that are the current users\n */\n myMessageTheme?: DeepPartial<Theme>;\n /**\n * Add double tap handler for message.\n *\n * ```\n * <Channel\n * onDoubleTapMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onDoubleTapMessage?: (\n payload: MessageTouchableHandlerPayload<At, Ch, Co, Ev, Me, Re, Us>,\n ) => void;\n /**\n * Override default handler for onLongPress on message. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onLongPressMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onLongPressMessage?: (\n payload: MessageTouchableHandlerPayload<At, Ch, Co, Ev, Me, Re, Us>,\n ) => void;\n /**\n * Add onPressIn handler for attachments. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onPressInMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onPressInMessage?: (payload: MessageTouchableHandlerPayload<At, Ch, Co, Ev, Me, Re, Us>) => void;\n /**\n * Override onPress handler for message. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onPressMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occurred\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onPressMessage?: (payload: MessageTouchableHandlerPayload<At, Ch, Co, Ev, Me, Re, Us>) => void;\n /**\n * Full override of the quoted reply button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n quotedReply?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Full override of the resend button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n * */\n retry?: ((message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction) | null;\n /**\n * Full override of the reaction function on Message and Message Overlay\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n * */\n selectReaction?: (\n message: MessageType<At, Ch, Co, Ev, Me, Re, Us>,\n ) => (reactionType: string) => Promise<void>;\n /**\n * Full override of the thread reply button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n * */\n threadReply?: (message: MessageType<At, Ch, Co, Ev, Me, Re, Us>) => MessageAction;\n};\n\nexport const MessagesContext = React.createContext({} as MessagesContextValue);\n\nexport const MessagesProvider = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value?: MessagesContextValue<At, Ch, Co, Ev, Me, Re, Us>;\n}>) => (\n <MessagesContext.Provider value={value as unknown as MessagesContextValue}>\n {children}\n </MessagesContext.Provider>\n);\n\nexport const useMessagesContext = <\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>() => useContext(MessagesContext) as unknown as MessagesContextValue<At, Ch, Co, Ev, Me, Re, Us>;\n\n/**\n * Typescript currently does not support partial inference so if MessagesContext\n * typing is desired while using the HOC withMessagesContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withMessagesContext = <\n P extends UnknownType,\n At extends UnknownType = DefaultAttachmentType,\n Ch extends UnknownType = DefaultChannelType,\n Co extends string = DefaultCommandType,\n Ev extends UnknownType = DefaultEventType,\n Me extends UnknownType = DefaultMessageType,\n Re extends UnknownType = DefaultReactionType,\n Us extends UnknownType = DefaultUserType,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof MessagesContextValue<At, Ch, Co, Ev, Me, Re, Us>>> => {\n const WithMessagesContextComponent = (\n props: Omit<P, keyof MessagesContextValue<At, Ch, Co, Ev, Me, Re, Us>>,\n ) => {\n const messagesContext = useMessagesContext<At, Ch, Co, Ev, Me, Re, Us>();\n\n return <Component {...(props as P)} {...messagesContext} />;\n };\n WithMessagesContextComponent.displayName = `WithMessagesContext${getDisplayName(Component)}`;\n return WithMessagesContextComponent;\n};\n"]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "3.8.3-next.1"
2
+ "version": "3.9.0-next.2"
3
3
  }
@@ -108,6 +108,8 @@ var GalleryWithContext = function GalleryWithContext(props) {
108
108
  groupStyles = props.groupStyles,
109
109
  hasThreadReplies = props.hasThreadReplies,
110
110
  images = props.images,
111
+ legacyImageViewerSwipeBehaviour = props.legacyImageViewerSwipeBehaviour,
112
+ message = props.message,
111
113
  messageId = props.messageId,
112
114
  messageText = props.messageText,
113
115
  _onLongPress = props.onLongPress,
@@ -116,6 +118,7 @@ var GalleryWithContext = function GalleryWithContext(props) {
116
118
  preventPress = props.preventPress,
117
119
  setBlurType = props.setBlurType,
118
120
  setImage = props.setImage,
121
+ setImages = props.setImages,
119
122
  setOverlay = props.setOverlay,
120
123
  threadList = props.threadList;
121
124
 
@@ -177,7 +180,7 @@ var GalleryWithContext = function GalleryWithContext(props) {
177
180
  __self: _this,
178
181
  __source: {
179
182
  fileName: _jsxFileName,
180
- lineNumber: 197,
183
+ lineNumber: 204,
181
184
  columnNumber: 5
182
185
  }
183
186
  }, galleryImages.map(function (column, colIndex) {
@@ -189,7 +192,7 @@ var GalleryWithContext = function GalleryWithContext(props) {
189
192
  __self: _this,
190
193
  __source: {
191
194
  fileName: _jsxFileName,
192
- lineNumber: 208,
195
+ lineNumber: 215,
193
196
  columnNumber: 9
194
197
  }
195
198
  }, column.map(function (_ref, rowIndex) {
@@ -197,6 +200,10 @@ var GalleryWithContext = function GalleryWithContext(props) {
197
200
  url = _ref.url;
198
201
 
199
202
  var defaultOnPress = function defaultOnPress() {
203
+ if (!legacyImageViewerSwipeBehaviour) {
204
+ setImages([message]);
205
+ }
206
+
200
207
  setImage({
201
208
  messageId: messageId,
202
209
  url: url
@@ -243,7 +250,7 @@ var GalleryWithContext = function GalleryWithContext(props) {
243
250
  __self: _this,
244
251
  __source: {
245
252
  fileName: _jsxFileName,
246
- lineNumber: 226,
253
+ lineNumber: 236,
247
254
  columnNumber: 15
248
255
  }
249
256
  }), _react["default"].createElement(MemoizedGalleryImage, {
@@ -259,7 +266,7 @@ var GalleryWithContext = function GalleryWithContext(props) {
259
266
  __self: _this,
260
267
  __source: {
261
268
  fileName: _jsxFileName,
262
- lineNumber: 266,
269
+ lineNumber: 276,
263
270
  columnNumber: 17
264
271
  }
265
272
  }), colIndex === 1 && rowIndex === 1 && images.length > 3 ? _react["default"].createElement(_reactNative.View, {
@@ -269,7 +276,7 @@ var GalleryWithContext = function GalleryWithContext(props) {
269
276
  __self: _this,
270
277
  __source: {
271
278
  fileName: _jsxFileName,
272
- lineNumber: 303,
279
+ lineNumber: 313,
273
280
  columnNumber: 19
274
281
  }
275
282
  }, _react["default"].createElement(_reactNative.Text, {
@@ -277,7 +284,7 @@ var GalleryWithContext = function GalleryWithContext(props) {
277
284
  __self: _this,
278
285
  __source: {
279
286
  fileName: _jsxFileName,
280
- lineNumber: 311,
287
+ lineNumber: 321,
281
288
  columnNumber: 21
282
289
  }
283
290
  }, "+" + (images.length - 3))) : null);
@@ -327,7 +334,8 @@ var Gallery = function Gallery(props) {
327
334
  propThreadList = props.threadList;
328
335
 
329
336
  var _useImageGalleryConte = (0, _ImageGalleryContext.useImageGalleryContext)(),
330
- contextSetImage = _useImageGalleryConte.setImage;
337
+ contextSetImage = _useImageGalleryConte.setImage,
338
+ setImages = _useImageGalleryConte.setImages;
331
339
 
332
340
  var _useMessageContext = (0, _MessageContext.useMessageContext)(),
333
341
  contextAlignment = _useMessageContext.alignment,
@@ -341,7 +349,8 @@ var Gallery = function Gallery(props) {
341
349
  contextThreadList = _useMessageContext.threadList;
342
350
 
343
351
  var _useMessagesContext = (0, _MessagesContext.useMessagesContext)(),
344
- contextAdditionalTouchableProps = _useMessagesContext.additionalTouchableProps;
352
+ contextAdditionalTouchableProps = _useMessagesContext.additionalTouchableProps,
353
+ legacyImageViewerSwipeBehaviour = _useMessagesContext.legacyImageViewerSwipeBehaviour;
345
354
 
346
355
  var _useOverlayContext = (0, _OverlayContext.useOverlayContext)(),
347
356
  contextSetBlurType = _useOverlayContext.setBlurType,
@@ -366,6 +375,8 @@ var Gallery = function Gallery(props) {
366
375
  groupStyles: groupStyles,
367
376
  hasThreadReplies: hasThreadReplies || !!(message != null && message.reply_count),
368
377
  images: images,
378
+ legacyImageViewerSwipeBehaviour: legacyImageViewerSwipeBehaviour,
379
+ message: message,
369
380
  messageId: messageId || (message == null ? void 0 : message.id),
370
381
  messageText: messageText || (message == null ? void 0 : message.text),
371
382
  onLongPress: onLongPress,
@@ -374,12 +385,13 @@ var Gallery = function Gallery(props) {
374
385
  preventPress: preventPress,
375
386
  setBlurType: setBlurType,
376
387
  setImage: setImage,
388
+ setImages: setImages,
377
389
  setOverlay: setOverlay,
378
390
  threadList: threadList,
379
391
  __self: _this,
380
392
  __source: {
381
393
  fileName: _jsxFileName,
382
- lineNumber: 450,
394
+ lineNumber: 462,
383
395
  columnNumber: 5
384
396
  }
385
397
  });