stream-chat-react-native-core 4.8.0 → 4.9.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/lib/commonjs/components/Attachment/GallaryImage.js +41 -0
  2. package/lib/commonjs/components/Attachment/GallaryImage.js.map +1 -0
  3. package/lib/commonjs/components/Attachment/Gallery.js +101 -36
  4. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  5. package/lib/commonjs/components/Attachment/Giphy.js +118 -25
  6. package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
  7. package/lib/commonjs/components/Attachment/ImageLoadingFailedIndicator.js +105 -0
  8. package/lib/commonjs/components/Attachment/ImageLoadingFailedIndicator.js.map +1 -0
  9. package/lib/commonjs/components/Attachment/ImageLoadingIndicator.js +58 -0
  10. package/lib/commonjs/components/Attachment/ImageLoadingIndicator.js.map +1 -0
  11. package/lib/commonjs/components/Attachment/hooks/useLoadingImage.js +32 -0
  12. package/lib/commonjs/components/Attachment/hooks/useLoadingImage.js.map +1 -0
  13. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js +3 -2
  14. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
  15. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js +1 -1
  16. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -1
  17. package/lib/commonjs/components/Channel/Channel.js +23 -13
  18. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  19. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +4 -0
  20. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  21. package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js +43 -19
  22. package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
  23. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +28 -21
  24. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  25. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +16 -17
  26. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js.map +1 -1
  27. package/lib/commonjs/components/RTLComponents/WritingDirectionAwareText.js +43 -0
  28. package/lib/commonjs/components/RTLComponents/WritingDirectionAwareText.js.map +1 -0
  29. package/lib/commonjs/components/Reply/Reply.js +7 -2
  30. package/lib/commonjs/components/Reply/Reply.js.map +1 -1
  31. package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
  32. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  33. package/lib/commonjs/contexts/themeContext/utils/theme.js +4 -0
  34. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  35. package/lib/commonjs/mock-builders/api/channelMocks.js +299 -0
  36. package/lib/commonjs/mock-builders/api/channelMocks.js.map +1 -0
  37. package/lib/commonjs/version.json +1 -1
  38. package/lib/module/components/Attachment/GallaryImage.js +41 -0
  39. package/lib/module/components/Attachment/GallaryImage.js.map +1 -0
  40. package/lib/module/components/Attachment/Gallery.js +101 -36
  41. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  42. package/lib/module/components/Attachment/Giphy.js +118 -25
  43. package/lib/module/components/Attachment/Giphy.js.map +1 -1
  44. package/lib/module/components/Attachment/ImageLoadingFailedIndicator.js +105 -0
  45. package/lib/module/components/Attachment/ImageLoadingFailedIndicator.js.map +1 -0
  46. package/lib/module/components/Attachment/ImageLoadingIndicator.js +58 -0
  47. package/lib/module/components/Attachment/ImageLoadingIndicator.js.map +1 -0
  48. package/lib/module/components/Attachment/hooks/useLoadingImage.js +32 -0
  49. package/lib/module/components/Attachment/hooks/useLoadingImage.js.map +1 -0
  50. package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +3 -2
  51. package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
  52. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js +1 -1
  53. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -1
  54. package/lib/module/components/Channel/Channel.js +23 -13
  55. package/lib/module/components/Channel/Channel.js.map +1 -1
  56. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +4 -0
  57. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  58. package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js +43 -19
  59. package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
  60. package/lib/module/components/MessageInput/FileUploadPreview.js +28 -21
  61. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  62. package/lib/module/components/MessageInput/ImageUploadPreview.js +16 -17
  63. package/lib/module/components/MessageInput/ImageUploadPreview.js.map +1 -1
  64. package/lib/module/components/RTLComponents/WritingDirectionAwareText.js +43 -0
  65. package/lib/module/components/RTLComponents/WritingDirectionAwareText.js.map +1 -0
  66. package/lib/module/components/Reply/Reply.js +7 -2
  67. package/lib/module/components/Reply/Reply.js.map +1 -1
  68. package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
  69. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  70. package/lib/module/contexts/themeContext/utils/theme.js +4 -0
  71. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  72. package/lib/module/mock-builders/api/channelMocks.js +299 -0
  73. package/lib/module/mock-builders/api/channelMocks.js.map +1 -0
  74. package/lib/module/version.json +1 -1
  75. package/lib/typescript/components/Attachment/GallaryImage.d.ts +5 -0
  76. package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
  77. package/lib/typescript/components/Attachment/Giphy.d.ts +1 -1
  78. package/lib/typescript/components/Attachment/ImageLoadingFailedIndicator.d.ts +3 -0
  79. package/lib/typescript/components/Attachment/ImageLoadingIndicator.d.ts +3 -0
  80. package/lib/typescript/components/Attachment/hooks/useLoadingImage.d.ts +7 -0
  81. package/lib/typescript/components/Channel/Channel.d.ts +1 -1
  82. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
  83. package/lib/typescript/components/ChannelPreview/hooks/__tests__/useLatestMessagePreview.test.d.ts +1 -0
  84. package/lib/typescript/components/RTLComponents/WritingDirectionAwareText.d.ts +4 -0
  85. package/lib/typescript/components/Reply/__tests__/Reply.test.d.ts +1 -0
  86. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +10 -0
  87. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +4 -0
  88. package/lib/typescript/mock-builders/api/channelMocks.d.ts +14 -0
  89. package/lib/typescript/mock-builders/api/getOrCreateChannel.d.ts +7 -0
  90. package/lib/typescript/mock-builders/api/useMockedApis.d.ts +1 -0
  91. package/lib/typescript/mock-builders/generator/channel.d.ts +116 -0
  92. package/package.json +3 -2
  93. package/src/components/Attachment/GallaryImage.tsx +22 -0
  94. package/src/components/Attachment/Gallery.tsx +68 -35
  95. package/src/components/Attachment/Giphy.tsx +68 -1
  96. package/src/components/Attachment/ImageLoadingFailedIndicator.tsx +56 -0
  97. package/src/components/Attachment/ImageLoadingIndicator.tsx +31 -0
  98. package/src/components/Attachment/__tests__/Attachment.test.js +9 -3
  99. package/src/components/Attachment/__tests__/Gallery.test.js +36 -1
  100. package/src/components/Attachment/__tests__/Giphy.test.js +110 -90
  101. package/src/components/Attachment/hooks/useLoadingImage.tsx +8 -0
  102. package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +2 -1
  103. package/src/components/AutoCompleteInput/AutoCompleteSuggestionItem.tsx +1 -1
  104. package/src/components/Channel/Channel.tsx +8 -0
  105. package/src/components/Channel/hooks/useCreateMessagesContext.ts +4 -0
  106. package/src/components/ChannelPreview/__tests__/ChannelPreviewMessenger.test.js +0 -1
  107. package/src/components/ChannelPreview/hooks/__tests__/useLatestMessagePreview.test.tsx +145 -0
  108. package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts +50 -24
  109. package/src/components/MessageInput/FileUploadPreview.tsx +11 -8
  110. package/src/components/MessageInput/ImageUploadPreview.tsx +4 -5
  111. package/src/components/MessageInput/__tests__/__snapshots__/MessageInput.test.js.snap +1 -0
  112. package/src/components/RTLComponents/WritingDirectionAwareText.tsx +17 -0
  113. package/src/components/Reply/Reply.tsx +19 -3
  114. package/src/components/Reply/__tests__/Reply.test.tsx +48 -0
  115. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +1 -0
  116. package/src/contexts/messagesContext/MessagesContext.tsx +15 -0
  117. package/src/contexts/themeContext/utils/theme.ts +8 -0
  118. package/src/mock-builders/api/channelMocks.tsx +272 -0
  119. package/src/version.json +1 -1
@@ -40,7 +40,7 @@ var styles = _reactNative.StyleSheet.create({
40
40
  },
41
41
  fileSizeText: {
42
42
  fontSize: 12,
43
- paddingLeft: 10
43
+ paddingHorizontal: 10
44
44
  },
45
45
  flatList: {
46
46
  paddingBottom: 12
@@ -59,7 +59,7 @@ var styles = _reactNative.StyleSheet.create({
59
59
  borderRadius: 20,
60
60
  bottom: 8,
61
61
  flexDirection: 'row',
62
- marginLeft: 3,
62
+ marginHorizontal: 3,
63
63
  position: 'absolute'
64
64
  },
65
65
  upload: {
@@ -69,15 +69,14 @@ var styles = _reactNative.StyleSheet.create({
69
69
  },
70
70
  warningIconStyle: {
71
71
  borderRadius: 24,
72
- marginLeft: 4,
73
- marginTop: 4
72
+ marginTop: 6
74
73
  },
75
74
  warningText: {
76
75
  alignItems: 'center',
77
76
  color: 'black',
78
77
  fontSize: 10,
79
78
  justifyContent: 'center',
80
- paddingRight: 8
79
+ marginHorizontal: 4
81
80
  }
82
81
  });
83
82
 
@@ -114,7 +113,7 @@ var ImageUploadPreviewWithContext = function ImageUploadPreviewWithContext(props
114
113
  __self: _this,
115
114
  __source: {
116
115
  fileName: _jsxFileName,
117
- lineNumber: 111,
116
+ lineNumber: 110,
118
117
  columnNumber: 7
119
118
  }
120
119
  }, _react["default"].createElement(_reactNative.View, {
@@ -122,7 +121,7 @@ var ImageUploadPreviewWithContext = function ImageUploadPreviewWithContext(props
122
121
  __self: _this,
123
122
  __source: {
124
123
  fileName: _jsxFileName,
125
- lineNumber: 112,
124
+ lineNumber: 111,
126
125
  columnNumber: 9
127
126
  }
128
127
  }, _react["default"].createElement(_Warning.Warning, {
@@ -133,7 +132,7 @@ var ImageUploadPreviewWithContext = function ImageUploadPreviewWithContext(props
133
132
  __self: _this,
134
133
  __source: {
135
134
  fileName: _jsxFileName,
136
- lineNumber: 113,
135
+ lineNumber: 112,
137
136
  columnNumber: 11
138
137
  }
139
138
  }), _react["default"].createElement(_reactNative.Text, {
@@ -143,7 +142,7 @@ var ImageUploadPreviewWithContext = function ImageUploadPreviewWithContext(props
143
142
  __self: _this,
144
143
  __source: {
145
144
  fileName: _jsxFileName,
146
- lineNumber: 119,
145
+ lineNumber: 118,
147
146
  columnNumber: 11
148
147
  }
149
148
  }, t('Not supported')))) : null;
@@ -161,7 +160,7 @@ var ImageUploadPreviewWithContext = function ImageUploadPreviewWithContext(props
161
160
  __self: _this,
162
161
  __source: {
163
162
  fileName: _jsxFileName,
164
- lineNumber: 130,
163
+ lineNumber: 129,
165
164
  columnNumber: 7
166
165
  }
167
166
  }, _react["default"].createElement(_UploadProgressIndicator.UploadProgressIndicator, {
@@ -175,7 +174,7 @@ var ImageUploadPreviewWithContext = function ImageUploadPreviewWithContext(props
175
174
  __self: _this,
176
175
  __source: {
177
176
  fileName: _jsxFileName,
178
- lineNumber: 131,
177
+ lineNumber: 130,
179
178
  columnNumber: 9
180
179
  }
181
180
  }, _react["default"].createElement(_reactNative.Image, {
@@ -187,7 +186,7 @@ var ImageUploadPreviewWithContext = function ImageUploadPreviewWithContext(props
187
186
  __self: _this,
188
187
  __source: {
189
188
  fileName: _jsxFileName,
190
- lineNumber: 138,
189
+ lineNumber: 137,
191
190
  columnNumber: 11
192
191
  }
193
192
  })), _react["default"].createElement(_reactNative.TouchableOpacity, {
@@ -201,14 +200,14 @@ var ImageUploadPreviewWithContext = function ImageUploadPreviewWithContext(props
201
200
  __self: _this,
202
201
  __source: {
203
202
  fileName: _jsxFileName,
204
- lineNumber: 144,
203
+ lineNumber: 143,
205
204
  columnNumber: 9
206
205
  }
207
206
  }, _react["default"].createElement(_Close.Close, {
208
207
  __self: _this,
209
208
  __source: {
210
209
  fileName: _jsxFileName,
211
- lineNumber: 151,
210
+ lineNumber: 150,
212
211
  columnNumber: 11
213
212
  }
214
213
  })), _react["default"].createElement(UnsupportedImageTypeIndicator, {
@@ -216,7 +215,7 @@ var ImageUploadPreviewWithContext = function ImageUploadPreviewWithContext(props
216
215
  __self: _this,
217
216
  __source: {
218
217
  fileName: _jsxFileName,
219
- lineNumber: 153,
218
+ lineNumber: 152,
220
219
  columnNumber: 9
221
220
  }
222
221
  }));
@@ -240,7 +239,7 @@ var ImageUploadPreviewWithContext = function ImageUploadPreviewWithContext(props
240
239
  __self: _this,
241
240
  __source: {
242
241
  fileName: _jsxFileName,
243
- lineNumber: 159,
242
+ lineNumber: 158,
244
243
  columnNumber: 5
245
244
  }
246
245
  }) : null;
@@ -270,7 +269,7 @@ var ImageUploadPreview = function ImageUploadPreview(props) {
270
269
  __self: _this,
271
270
  __source: {
272
271
  fileName: _jsxFileName,
273
- lineNumber: 205,
272
+ lineNumber: 204,
274
273
  columnNumber: 5
275
274
  }
276
275
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["ImageUploadPreview.tsx"],"names":["IMAGE_PREVIEW_SIZE","WARNING_ICON_SIZE","styles","StyleSheet","create","dismiss","borderRadius","position","right","top","fileSizeText","fontSize","paddingLeft","flatList","paddingBottom","iconContainer","alignItems","flexDirection","justifyContent","itemContainer","height","marginLeft","unsupportedImage","bottom","upload","width","warningIconStyle","marginTop","warningText","color","paddingRight","ImageUploadPreviewWithContext","props","imageUploads","removeImage","uploadImage","theme","overlay","colors","messageInput","imageUploadPreview","UnsupportedImageTypeIndicator","indicatorType","accent_red","white","t","ProgressIndicatorTypes","NOT_SUPPORTED","backgroundColor","renderItem","index","item","state","itemMarginForIndex","length","marginRight","newImage","uri","file","url","id","_","offset","areEqual","prevProps","nextProps","prevImageUploads","nextImageUploads","every","prevImageUpload","MemoizedImageUploadPreviewWithContext","React","memo","ImageUploadPreview","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;;;;AAEA,IAAMA,kBAAkB,GAAG,GAA3B;AACA,IAAMC,iBAAiB,GAAG,EAA1B;;AAEA,IAAMC,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,OAAO,EAAE;AACPC,IAAAA,YAAY,EAAE,EADP;AAEPC,IAAAA,QAAQ,EAAE,UAFH;AAGPC,IAAAA,KAAK,EAAE,CAHA;AAIPC,IAAAA,GAAG,EAAE;AAJE,GADsB;AAO/BC,EAAAA,YAAY,EAAE;AACZC,IAAAA,QAAQ,EAAE,EADE;AAEZC,IAAAA,WAAW,EAAE;AAFD,GAPiB;AAW/BC,EAAAA,QAAQ,EAAE;AAAEC,IAAAA,aAAa,EAAE;AAAjB,GAXqB;AAY/BC,EAAAA,aAAa,EAAE;AACbC,IAAAA,UAAU,EAAE,QADC;AAEbC,IAAAA,aAAa,EAAE,KAFF;AAGbC,IAAAA,cAAc,EAAE;AAHH,GAZgB;AAiB/BC,EAAAA,aAAa,EAAE;AACbF,IAAAA,aAAa,EAAE,KADF;AAEbG,IAAAA,MAAM,EAAEpB,kBAFK;AAGbqB,IAAAA,UAAU,EAAE;AAHC,GAjBgB;AAsB/BC,EAAAA,gBAAgB,EAAE;AAChBhB,IAAAA,YAAY,EAAE,EADE;AAEhBiB,IAAAA,MAAM,EAAE,CAFQ;AAGhBN,IAAAA,aAAa,EAAE,KAHC;AAIhBI,IAAAA,UAAU,EAAE,CAJI;AAKhBd,IAAAA,QAAQ,EAAE;AALM,GAtBa;AA6B/BiB,EAAAA,MAAM,EAAE;AACNlB,IAAAA,YAAY,EAAE,EADR;AAENc,IAAAA,MAAM,EAAEpB,kBAF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ADR;AACsBC,IAAAA,WAAW,EAAXA,WADtB;AACmCC,IAAAA,WAAW,EAAXA;AADnC,KAEMH,KAFN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KADF;AAMD,CAbM;;;AAePyC,kBAAkB,CAACC,WAAnB,GAAiC,sDAAjC","sourcesContent":["import React from 'react';\nimport { FlatList, Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport { UploadProgressIndicator } from './UploadProgressIndicator';\n\nimport {\n ImageUpload,\n MessageInputContextValue,\n useMessageInputContext,\n} from '../../contexts/messageInputContext/MessageInputContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport { useTranslationContext } from '../../contexts/translationContext/TranslationContext';\nimport { Close } from '../../icons/Close';\nimport { Warning } from '../../icons/Warning';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { getIndicatorTypeForFileState, ProgressIndicatorTypes } from '../../utils/utils';\n\nconst IMAGE_PREVIEW_SIZE = 100;\nconst WARNING_ICON_SIZE = 16;\n\nconst styles = StyleSheet.create({\n dismiss: {\n borderRadius: 24,\n position: 'absolute',\n right: 8,\n top: 8,\n },\n fileSizeText: {\n fontSize: 12,\n paddingLeft: 10,\n },\n flatList: { paddingBottom: 12 },\n iconContainer: {\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'center',\n },\n itemContainer: {\n flexDirection: 'row',\n height: IMAGE_PREVIEW_SIZE,\n marginLeft: 8,\n },\n unsupportedImage: {\n borderRadius: 20,\n bottom: 8,\n flexDirection: 'row',\n marginLeft: 3,\n position: 'absolute',\n },\n upload: {\n borderRadius: 10,\n height: IMAGE_PREVIEW_SIZE,\n width: IMAGE_PREVIEW_SIZE,\n },\n warningIconStyle: {\n borderRadius: 24,\n marginLeft: 4,\n marginTop: 4,\n },\n warningText: {\n alignItems: 'center',\n color: 'black',\n fontSize: 10,\n justifyContent: 'center',\n paddingRight: 8,\n },\n});\n\ntype ImageUploadPreviewPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<\n MessageInputContextValue<StreamChatGenerics>,\n 'imageUploads' | 'removeImage' | 'uploadImage'\n>;\n\nexport type ImageUploadPreviewProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<ImageUploadPreviewPropsWithContext<StreamChatGenerics>>;\n\ntype ImageUploadPreviewItem = { index: number; item: ImageUpload };\n\nconst ImageUploadPreviewWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: ImageUploadPreviewPropsWithContext<StreamChatGenerics>,\n) => {\n const { imageUploads, removeImage, uploadImage } = props;\n\n const {\n theme: {\n colors: { overlay },\n messageInput: {\n imageUploadPreview: { dismiss, flatList, itemContainer, upload },\n },\n },\n } = useTheme();\n\n const UnsupportedImageTypeIndicator = ({\n indicatorType,\n }: {\n indicatorType: typeof ProgressIndicatorTypes[keyof typeof ProgressIndicatorTypes] | null;\n }) => {\n const {\n theme: {\n colors: { accent_red, overlay, white },\n },\n } = useTheme();\n\n const { t } = useTranslationContext();\n return indicatorType === ProgressIndicatorTypes.NOT_SUPPORTED ? (\n <View style={[styles.unsupportedImage, { backgroundColor: overlay }]}>\n <View style={[styles.iconContainer]}>\n <Warning\n height={WARNING_ICON_SIZE}\n pathFill={accent_red}\n style={styles.warningIconStyle}\n width={WARNING_ICON_SIZE}\n />\n <Text style={[styles.warningText, { color: white }]}>{t('Not supported')}</Text>\n </View>\n </View>\n ) : null;\n };\n\n const renderItem = ({ index, item }: ImageUploadPreviewItem) => {\n const indicatorType = getIndicatorTypeForFileState(item.state);\n const itemMarginForIndex = index === imageUploads.length - 1 ? { marginRight: 8 } : {};\n\n return (\n <View style={[styles.itemContainer, itemMarginForIndex, itemContainer]}>\n <UploadProgressIndicator\n action={() => {\n uploadImage({ newImage: item });\n }}\n style={styles.upload}\n type={indicatorType}\n >\n <Image\n resizeMode='cover'\n source={{ uri: item.file.uri || item.url }}\n style={[styles.upload, upload]}\n />\n </UploadProgressIndicator>\n <TouchableOpacity\n onPress={() => {\n removeImage(item.id);\n }}\n style={[styles.dismiss, { backgroundColor: overlay }, dismiss]}\n testID='remove-image-upload-preview'\n >\n <Close />\n </TouchableOpacity>\n <UnsupportedImageTypeIndicator indicatorType={indicatorType} />\n </View>\n );\n };\n\n return imageUploads.length > 0 ? (\n <FlatList\n data={imageUploads}\n getItemLayout={(_, index) => ({\n index,\n length: IMAGE_PREVIEW_SIZE + 8,\n offset: (IMAGE_PREVIEW_SIZE + 8) * index,\n })}\n horizontal\n keyExtractor={(item) => item.id}\n renderItem={renderItem}\n style={[styles.flatList, flatList]}\n />\n ) : null;\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: ImageUploadPreviewPropsWithContext<StreamChatGenerics>,\n nextProps: ImageUploadPreviewPropsWithContext<StreamChatGenerics>,\n) => {\n const { imageUploads: prevImageUploads } = prevProps;\n const { imageUploads: nextImageUploads } = nextProps;\n\n return (\n prevImageUploads.length === nextImageUploads.length &&\n prevImageUploads.every(\n (prevImageUpload, index) => prevImageUpload.state === nextImageUploads[index].state,\n )\n );\n};\n\nconst MemoizedImageUploadPreviewWithContext = React.memo(\n ImageUploadPreviewWithContext,\n areEqual,\n) as typeof ImageUploadPreviewWithContext;\n\n/**\n * UI Component to preview the images set for upload\n */\nexport const ImageUploadPreview = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: ImageUploadPreviewProps<StreamChatGenerics>,\n) => {\n const { imageUploads, removeImage, uploadImage } = useMessageInputContext<StreamChatGenerics>();\n\n return (\n <MemoizedImageUploadPreviewWithContext\n {...{ imageUploads, removeImage, uploadImage }}\n {...props}\n />\n );\n};\n\nImageUploadPreview.displayName = 'ImageUploadPreview{messageInput{imageUploadPreview}}';\n"]}
1
+ {"version":3,"sources":["ImageUploadPreview.tsx"],"names":["IMAGE_PREVIEW_SIZE","WARNING_ICON_SIZE","styles","StyleSheet","create","dismiss","borderRadius","position","right","top","fileSizeText","fontSize","paddingHorizontal","flatList","paddingBottom","iconContainer","alignItems","flexDirection","justifyContent","itemContainer","height","marginLeft","unsupportedImage","bottom","marginHorizontal","upload","width","warningIconStyle","marginTop","warningText","color","ImageUploadPreviewWithContext","props","imageUploads","removeImage","uploadImage","theme","overlay","colors","messageInput","imageUploadPreview","UnsupportedImageTypeIndicator","indicatorType","accent_red","white","t","ProgressIndicatorTypes","NOT_SUPPORTED","backgroundColor","renderItem","index","item","state","itemMarginForIndex","length","marginRight","newImage","uri","file","url","id","_","offset","areEqual","prevProps","nextProps","prevImageUploads","nextImageUploads","every","prevImageUpload","MemoizedImageUploadPreviewWithContext","React","memo","ImageUploadPreview","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;;;;AAEA,IAAMA,kBAAkB,GAAG,GAA3B;AACA,IAAMC,iBAAiB,GAAG,EAA1B;;AAEA,IAAMC,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,OAAO,EAAE;AACPC,IAAAA,YAAY,EAAE,EADP;AAEPC,IAAAA,QAAQ,EAAE,UAFH;AAGPC,IAAAA,KAAK,EAAE,CAHA;AAIPC,IAAAA,GAAG,EAAE;AAJE,GADsB;AAO/BC,EAAAA,YAAY,EAAE;AACZC,IAAAA,QAAQ,EAAE,EADE;AAEZC,IAAAA,iBAAiB,EAAE;AAFP,GAPiB;AAW/BC,EAAAA,QAAQ,EAAE;AAAEC,IAAAA,aAAa,EAAE;AAAjB,GAXqB;AAY/BC,EAAAA,aAAa,EAAE;AACbC,IAAAA,UAAU,EAAE,QADC;AAEbC,IAAAA,aAAa,EAAE,KAFF;AAGbC,IAAAA,cAAc,EAAE;AAHH,GAZgB;AAiB/BC,EAAAA,aAAa,EAAE;AACbF,IAAAA,aAAa,EAAE,KADF;AAEbG,IAAAA,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A,IAAMkB,qCAAqC,GAAGC,kBAAMC,IAAN,CAC5CzC,6BAD4C,EAE5CgC,QAF4C,CAA9C;;AAQO,IAAMU,kBAAkB,GAAG,SAArBA,kBAAqB,CAGhCzC,KAHgC,EAI7B;AACH,8BAAmD,kDAAnD;AAAA,MAAQC,YAAR,yBAAQA,YAAR;AAAA,MAAsBC,WAAtB,yBAAsBA,WAAtB;AAAA,MAAmCC,WAAnC,yBAAmCA,WAAnC;;AAEA,SACE,gCAAC,qCAAD;AACQF,IAAAA,YAAY,EAAZA,YADR;AACsBC,IAAAA,WAAW,EAAXA,WADtB;AACmCC,IAAAA,WAAW,EAAXA;AADnC,KAEMH,KAFN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KADF;AAMD,CAbM;;;AAePyC,kBAAkB,CAACC,WAAnB,GAAiC,sDAAjC","sourcesContent":["import React from 'react';\nimport { FlatList, Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport { UploadProgressIndicator } from './UploadProgressIndicator';\n\nimport {\n ImageUpload,\n MessageInputContextValue,\n useMessageInputContext,\n} from '../../contexts/messageInputContext/MessageInputContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport { useTranslationContext } from '../../contexts/translationContext/TranslationContext';\nimport { Close } from '../../icons/Close';\nimport { Warning } from '../../icons/Warning';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { getIndicatorTypeForFileState, ProgressIndicatorTypes } from '../../utils/utils';\n\nconst IMAGE_PREVIEW_SIZE = 100;\nconst WARNING_ICON_SIZE = 16;\n\nconst styles = StyleSheet.create({\n dismiss: {\n borderRadius: 24,\n position: 'absolute',\n right: 8,\n top: 8,\n },\n fileSizeText: {\n fontSize: 12,\n paddingHorizontal: 10,\n },\n flatList: { paddingBottom: 12 },\n iconContainer: {\n alignItems: 'center',\n flexDirection: 'row',\n justifyContent: 'center',\n },\n itemContainer: {\n flexDirection: 'row',\n height: IMAGE_PREVIEW_SIZE,\n marginLeft: 8,\n },\n unsupportedImage: {\n borderRadius: 20,\n bottom: 8,\n flexDirection: 'row',\n marginHorizontal: 3,\n position: 'absolute',\n },\n upload: {\n borderRadius: 10,\n height: IMAGE_PREVIEW_SIZE,\n width: IMAGE_PREVIEW_SIZE,\n },\n warningIconStyle: {\n borderRadius: 24,\n marginTop: 6,\n },\n warningText: {\n alignItems: 'center',\n color: 'black',\n fontSize: 10,\n justifyContent: 'center',\n marginHorizontal: 4,\n },\n});\n\ntype ImageUploadPreviewPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<\n MessageInputContextValue<StreamChatGenerics>,\n 'imageUploads' | 'removeImage' | 'uploadImage'\n>;\n\nexport type ImageUploadPreviewProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<ImageUploadPreviewPropsWithContext<StreamChatGenerics>>;\n\ntype ImageUploadPreviewItem = { index: number; item: ImageUpload };\n\nconst ImageUploadPreviewWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: ImageUploadPreviewPropsWithContext<StreamChatGenerics>,\n) => {\n const { imageUploads, removeImage, uploadImage } = props;\n\n const {\n theme: {\n colors: { overlay },\n messageInput: {\n imageUploadPreview: { dismiss, flatList, itemContainer, upload },\n },\n },\n } = useTheme();\n\n const UnsupportedImageTypeIndicator = ({\n indicatorType,\n }: {\n indicatorType: typeof ProgressIndicatorTypes[keyof typeof ProgressIndicatorTypes] | null;\n }) => {\n const {\n theme: {\n colors: { accent_red, overlay, white },\n },\n } = useTheme();\n\n const { t } = useTranslationContext();\n return indicatorType === ProgressIndicatorTypes.NOT_SUPPORTED ? (\n <View style={[styles.unsupportedImage, { backgroundColor: overlay }]}>\n <View style={[styles.iconContainer]}>\n <Warning\n height={WARNING_ICON_SIZE}\n pathFill={accent_red}\n style={styles.warningIconStyle}\n width={WARNING_ICON_SIZE}\n />\n <Text style={[styles.warningText, { color: white }]}>{t('Not supported')}</Text>\n </View>\n </View>\n ) : null;\n };\n\n const renderItem = ({ index, item }: ImageUploadPreviewItem) => {\n const indicatorType = getIndicatorTypeForFileState(item.state);\n const itemMarginForIndex = index === imageUploads.length - 1 ? { marginRight: 8 } : {};\n\n return (\n <View style={[styles.itemContainer, itemMarginForIndex, itemContainer]}>\n <UploadProgressIndicator\n action={() => {\n uploadImage({ newImage: item });\n }}\n style={styles.upload}\n type={indicatorType}\n >\n <Image\n resizeMode='cover'\n source={{ uri: item.file.uri || item.url }}\n style={[styles.upload, upload]}\n />\n </UploadProgressIndicator>\n <TouchableOpacity\n onPress={() => {\n removeImage(item.id);\n }}\n style={[styles.dismiss, { backgroundColor: overlay }, dismiss]}\n testID='remove-image-upload-preview'\n >\n <Close />\n </TouchableOpacity>\n <UnsupportedImageTypeIndicator indicatorType={indicatorType} />\n </View>\n );\n };\n\n return imageUploads.length > 0 ? (\n <FlatList\n data={imageUploads}\n getItemLayout={(_, index) => ({\n index,\n length: IMAGE_PREVIEW_SIZE + 8,\n offset: (IMAGE_PREVIEW_SIZE + 8) * index,\n })}\n horizontal\n keyExtractor={(item) => item.id}\n renderItem={renderItem}\n style={[styles.flatList, flatList]}\n />\n ) : null;\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: ImageUploadPreviewPropsWithContext<StreamChatGenerics>,\n nextProps: ImageUploadPreviewPropsWithContext<StreamChatGenerics>,\n) => {\n const { imageUploads: prevImageUploads } = prevProps;\n const { imageUploads: nextImageUploads } = nextProps;\n\n return (\n prevImageUploads.length === nextImageUploads.length &&\n prevImageUploads.every(\n (prevImageUpload, index) => prevImageUpload.state === nextImageUploads[index].state,\n )\n );\n};\n\nconst MemoizedImageUploadPreviewWithContext = React.memo(\n ImageUploadPreviewWithContext,\n areEqual,\n) as typeof ImageUploadPreviewWithContext;\n\n/**\n * UI Component to preview the images set for upload\n */\nexport const ImageUploadPreview = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: ImageUploadPreviewProps<StreamChatGenerics>,\n) => {\n const { imageUploads, removeImage, uploadImage } = useMessageInputContext<StreamChatGenerics>();\n\n return (\n <MemoizedImageUploadPreviewWithContext\n {...{ imageUploads, removeImage, uploadImage }}\n {...props}\n />\n );\n};\n\nImageUploadPreview.displayName = 'ImageUploadPreview{messageInput{imageUploadPreview}}';\n"]}
@@ -0,0 +1,43 @@
1
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WritingDirectionAwareText = void 0;
7
+
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _reactNative = require("react-native");
15
+
16
+ var _excluded = ["children", "style"];
17
+
18
+ var _this = this,
19
+ _jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/components/RTLComponents/WritingDirectionAwareText.tsx";
20
+
21
+ var styles = _reactNative.StyleSheet.create({
22
+ defaultStyle: {
23
+ writingDirection: _reactNative.I18nManager.isRTL ? 'rtl' : 'ltr'
24
+ }
25
+ });
26
+
27
+ var WritingDirectionAwareText = function WritingDirectionAwareText(props) {
28
+ var children = props.children,
29
+ style = props.style,
30
+ rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
31
+ return _react["default"].createElement(_reactNative.Text, (0, _extends2["default"])({}, rest, {
32
+ style: [style, styles.defaultStyle],
33
+ __self: _this,
34
+ __source: {
35
+ fileName: _jsxFileName,
36
+ lineNumber: 13,
37
+ columnNumber: 5
38
+ }
39
+ }), children);
40
+ };
41
+
42
+ exports.WritingDirectionAwareText = WritingDirectionAwareText;
43
+ //# sourceMappingURL=WritingDirectionAwareText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["WritingDirectionAwareText.tsx"],"names":["styles","StyleSheet","create","defaultStyle","writingDirection","I18nManager","isRTL","WritingDirectionAwareText","props","children","style","rest"],"mappings":";;;;;;;;;;;AAAA;;AACA;;;;;;;AAEA,IAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,YAAY,EAAE;AAAEC,IAAAA,gBAAgB,EAAEC,yBAAYC,KAAZ,GAAoB,KAApB,GAA4B;AAAhD;AADiB,CAAlB,CAAf;;AAMO,IAAMC,yBAAmE,GAAG,SAAtEA,yBAAsE,CAACC,KAAD,EAAW;AAC5F,MAAQC,QAAR,GAAqCD,KAArC,CAAQC,QAAR;AAAA,MAAkBC,KAAlB,GAAqCF,KAArC,CAAkBE,KAAlB;AAAA,MAA4BC,IAA5B,6CAAqCH,KAArC;AACA,SACE,gCAAC,iBAAD,gCAAUG,IAAV;AAAgB,IAAA,KAAK,EAAE,CAACD,KAAD,EAAQV,MAAM,CAACG,YAAf,CAAvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MACGM,QADH,CADF;AAKD,CAPM","sourcesContent":["import React from 'react';\nimport { I18nManager, StyleSheet, Text, ViewProps } from 'react-native';\n\nconst styles = StyleSheet.create({\n defaultStyle: { writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr' },\n});\n\nexport type WritingDirectionAwareTextProps = ViewProps;\n\nexport const WritingDirectionAwareText: React.FC<WritingDirectionAwareTextProps> = (props) => {\n const { children, style, ...rest } = props;\n return (\n <Text {...rest} style={[style, styles.defaultStyle]}>\n {children}\n </Text>\n );\n};\n"]}
@@ -248,6 +248,11 @@ var ReplyWithContext = function ReplyWithContext(props) {
248
248
  })));
249
249
  };
250
250
 
251
+ var useMessageInputContextIfAvailable = function useMessageInputContextIfAvailable() {
252
+ var contextValue = (0, _react.useContext)(_MessageInputContext.MessageInputContext);
253
+ return contextValue;
254
+ };
255
+
251
256
  var areEqual = function areEqual(prevProps, nextProps) {
252
257
  var prevQuotedMessage = prevProps.quotedMessage;
253
258
  var nextQuotedMessage = nextProps.quotedMessage;
@@ -268,7 +273,7 @@ var Reply = function Reply(props) {
268
273
  _useMessagesContext$M = _useMessagesContext.MessageAvatar,
269
274
  MessageAvatar = _useMessagesContext$M === void 0 ? _MessageAvatar.MessageAvatar : _useMessagesContext$M;
270
275
 
271
- var _useMessageInputConte = (0, _MessageInputContext.useMessageInputContext)(),
276
+ var _useMessageInputConte = useMessageInputContextIfAvailable(),
272
277
  editing = _useMessageInputConte.editing,
273
278
  quotedMessage = _useMessageInputConte.quotedMessage;
274
279
 
@@ -286,7 +291,7 @@ var Reply = function Reply(props) {
286
291
  __self: _this,
287
292
  __source: {
288
293
  fileName: _jsxFileName,
289
- lineNumber: 319,
294
+ lineNumber: 335,
290
295
  columnNumber: 5
291
296
  }
292
297
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["Reply.tsx"],"names":["styles","StyleSheet","create","container","alignItems","flexDirection","fileAttachmentContainer","paddingLeft","paddingVertical","imageAttachment","borderRadius","height","marginLeft","marginVertical","width","messageContainer","borderBottomLeftRadius","borderBottomRightRadius","borderTopLeftRadius","borderTopRightRadius","flexGrow","flexShrink","text","fontSize","textContainer","maxWidth","undefined","paddingHorizontal","videoAttachment","getMessageType","lastAttachment","messageType","isLastAttachmentFile","type","isLastAttachmentVideo","isLastAttachmentGiphy","isLastAttachmentImageOrGiphy","title_link","og_scrape_url","isLastAttachmentImage","image_url","thumb_url","ReplyWithContext","props","FileAttachmentIcon","attachmentSize","MessageAvatar","quotedMessage","stylesProp","t","error","setError","theme","colors","blue_alice","border","grey","transparent","white","deletedText","messageSimple","content","reply","markdownStyles","attachments","slice","hasImage","onlyEmojis","emojiRegex","test","backgroundColor","borderColor","borderWidth","mime_type","uri","url","deleted_at","em","color","length","title","marginRight","Number","areEqual","prevProps","nextProps","prevQuotedMessage","nextQuotedMessage","quotedMessageEqual","id","MemoizedReply","React","memo","Reply","message","F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B;;AAEA,MAAMmD,oBAAoB,GACxB,OAAOD,OAAP,KAAmB,SAAnB,GAA+B,CAAAA,OAAO,QAAP,YAAAA,OAAO,CAAEE,cAAT,KAA2B,KAA1D,GAAkE,KADpE;;AAIA,8BAAc,gDAAd;AAAA,MAAQlD,CAAR,yBAAQA,CAAR;;AAEA,SACE,gCAAC,aAAD;AAEIL,IAAAA,kBAAkB,EAAlBA,kBAFJ;AAGIE,IAAAA,aAAa,EAAbA,aAHJ;AAIIC,IAAAA,aAAa,EAAE+C,OAAO,GACjBA,OAAO,CAACK,cADS,GAElBpD,aAAa,IAAImD,oBANzB;AAOIjD,IAAAA,CAAC,EAADA;AAPJ,KASMN,KATN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KADF;AAaD,CA/BM;;;AAiCPkD,KAAK,CAACO,WAAN,GAAoB,cAApB","sourcesContent":["import React, { useState } from 'react';\nimport { Image, ImageStyle, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport merge from 'lodash/merge';\n\nimport type { Attachment } from 'stream-chat';\n\nimport { useMessageContext } from '../../contexts/messageContext/MessageContext';\nimport {\n MessageInputContextValue,\n useMessageInputContext,\n} from '../../contexts/messageInputContext/MessageInputContext';\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport {\n TranslationContextValue,\n useTranslationContext,\n} from '../../contexts/translationContext/TranslationContext';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { getResizedImageUrl } from '../../utils/getResizedImageUrl';\nimport { emojiRegex } from '../../utils/utils';\n\nimport { FileIcon as FileIconDefault } from '../Attachment/FileIcon';\nimport { VideoThumbnail } from '../Attachment/VideoThumbnail';\nimport { MessageAvatar as MessageAvatarDefault } from '../Message/MessageSimple/MessageAvatar';\nimport { MessageTextContainer } from '../Message/MessageSimple/MessageTextContainer';\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: 'flex-end',\n flexDirection: 'row',\n },\n fileAttachmentContainer: { paddingLeft: 8, paddingVertical: 8 },\n imageAttachment: {\n borderRadius: 8,\n height: 32,\n marginLeft: 8,\n marginVertical: 8,\n width: 32,\n },\n messageContainer: {\n alignItems: 'flex-start',\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 12,\n borderTopLeftRadius: 12,\n borderTopRightRadius: 12,\n flexDirection: 'row',\n flexGrow: 1,\n flexShrink: 1,\n },\n text: { fontSize: 12 },\n textContainer: { maxWidth: undefined, paddingHorizontal: 8 },\n videoAttachment: {\n borderRadius: 8,\n height: 50,\n marginLeft: 8,\n marginVertical: 8,\n width: 50,\n },\n});\n\ntype ReplyPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<MessageInputContextValue<StreamChatGenerics>, 'quotedMessage'> &\n Pick<MessagesContextValue<StreamChatGenerics>, 'FileAttachmentIcon' | 'MessageAvatar'> &\n Pick<TranslationContextValue, 't'> & {\n attachmentSize?: number;\n styles?: Partial<{\n container: ViewStyle;\n fileAttachmentContainer: ViewStyle;\n imageAttachment: ImageStyle;\n messageContainer: ViewStyle;\n textContainer: ViewStyle;\n }>;\n };\n\nconst getMessageType = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n lastAttachment: Attachment<StreamChatGenerics>,\n) => {\n let messageType;\n\n const isLastAttachmentFile = lastAttachment.type === 'file' || lastAttachment.type === 'audio';\n\n const isLastAttachmentVideo = lastAttachment.type === 'video';\n\n const isLastAttachmentGiphy =\n lastAttachment?.type === 'giphy' || lastAttachment?.type === 'imgur';\n\n const isLastAttachmentImageOrGiphy =\n lastAttachment?.type === 'image' &&\n !lastAttachment?.title_link &&\n !lastAttachment?.og_scrape_url;\n\n const isLastAttachmentImage = lastAttachment?.image_url || lastAttachment?.thumb_url;\n\n if (isLastAttachmentFile) {\n messageType = 'file';\n } else if (isLastAttachmentVideo) {\n messageType = 'video';\n } else if (isLastAttachmentImageOrGiphy) {\n if (isLastAttachmentImage) messageType = 'image';\n else messageType = undefined;\n } else if (isLastAttachmentGiphy) messageType = 'giphy';\n else messageType = 'other';\n\n return messageType;\n};\n\nconst ReplyWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: ReplyPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n FileAttachmentIcon,\n attachmentSize = 40,\n MessageAvatar,\n quotedMessage,\n styles: stylesProp = {},\n t,\n } = props;\n\n const [error, setError] = useState(false);\n\n const {\n theme: {\n colors: { blue_alice, border, grey, transparent, white },\n messageSimple: {\n content: { deletedText },\n },\n reply: {\n container,\n fileAttachmentContainer,\n imageAttachment,\n markdownStyles,\n messageContainer,\n textContainer,\n },\n },\n } = useTheme();\n\n if (typeof quotedMessage === 'boolean') return null;\n\n const lastAttachment = quotedMessage.attachments?.slice(-1)[0] as Attachment<StreamChatGenerics>;\n const messageType = lastAttachment && getMessageType(lastAttachment);\n\n const hasImage =\n !error &&\n lastAttachment &&\n messageType !== 'file' &&\n (lastAttachment.image_url || lastAttachment.thumb_url || lastAttachment.og_scrape_url);\n\n const onlyEmojis = !lastAttachment && !!quotedMessage.text && emojiRegex.test(quotedMessage.text);\n\n return (\n <View style={[styles.container, container, stylesProp.container]}>\n <MessageAvatar alignment={'left'} lastGroupMessage message={quotedMessage} size={24} />\n <View\n style={[\n styles.messageContainer,\n {\n backgroundColor:\n messageType === 'other' ? blue_alice : messageType === 'giphy' ? transparent : white,\n borderColor: border,\n borderWidth: messageType === 'other' ? 0 : 1,\n },\n messageContainer,\n stylesProp.messageContainer,\n ]}\n >\n {!error && lastAttachment ? (\n messageType === 'file' ? (\n <View\n style={[\n styles.fileAttachmentContainer,\n fileAttachmentContainer,\n stylesProp.fileAttachmentContainer,\n ]}\n >\n <FileAttachmentIcon mimeType={lastAttachment.mime_type} size={attachmentSize} />\n </View>\n ) : hasImage ? (\n <Image\n onError={() => setError(true)}\n source={{\n uri: getResizedImageUrl({\n height:\n stylesProp.imageAttachment?.height ||\n imageAttachment?.height ||\n styles.imageAttachment.height,\n url: (lastAttachment.image_url ||\n lastAttachment.thumb_url ||\n lastAttachment.og_scrape_url) as string,\n width:\n stylesProp.imageAttachment?.width ||\n imageAttachment?.width ||\n styles.imageAttachment.width,\n }),\n }}\n style={[styles.imageAttachment, imageAttachment, stylesProp.imageAttachment]}\n />\n ) : null\n ) : null}\n {messageType === 'video' && !lastAttachment.og_scrape_url ? (\n <VideoThumbnail style={[styles.videoAttachment]} />\n ) : null}\n <MessageTextContainer<StreamChatGenerics>\n markdownStyles={\n quotedMessage.deleted_at\n ? merge({ em: { color: grey } }, deletedText)\n : { text: styles.text, ...markdownStyles }\n }\n message={{\n ...quotedMessage,\n text: quotedMessage.deleted_at\n ? `_${t('Message deleted')}_`\n : quotedMessage.text\n ? quotedMessage.text.length > 170\n ? `${quotedMessage.text.slice(0, 170)}...`\n : quotedMessage.text\n : messageType === 'image'\n ? t('Photo')\n : messageType === 'video'\n ? 'Video'\n : messageType === 'file'\n ? lastAttachment?.title || ''\n : '',\n }}\n onlyEmojis={onlyEmojis}\n styles={{\n textContainer: [\n {\n marginRight:\n hasImage || messageType === 'video'\n ? Number(\n stylesProp.imageAttachment?.height ||\n imageAttachment.height ||\n styles.imageAttachment.height,\n ) +\n Number(\n stylesProp.imageAttachment?.marginLeft ||\n imageAttachment.marginLeft ||\n styles.imageAttachment.marginLeft,\n )\n : messageType === 'file'\n ? attachmentSize +\n Number(\n stylesProp.fileAttachmentContainer?.paddingLeft ||\n fileAttachmentContainer.paddingLeft ||\n styles.fileAttachmentContainer.paddingLeft,\n )\n : undefined,\n },\n styles.textContainer,\n textContainer,\n stylesProp.textContainer,\n ],\n }}\n />\n </View>\n </View>\n );\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: ReplyPropsWithContext<StreamChatGenerics>,\n nextProps: ReplyPropsWithContext<StreamChatGenerics>,\n) => {\n const { quotedMessage: prevQuotedMessage } = prevProps;\n const { quotedMessage: nextQuotedMessage } = nextProps;\n\n const quotedMessageEqual =\n !!prevQuotedMessage &&\n !!nextQuotedMessage &&\n typeof prevQuotedMessage !== 'boolean' &&\n typeof nextQuotedMessage !== 'boolean'\n ? prevQuotedMessage.id === nextQuotedMessage.id &&\n prevQuotedMessage.deleted_at === nextQuotedMessage.deleted_at\n : !!prevQuotedMessage === !!nextQuotedMessage;\n\n if (!quotedMessageEqual) return false;\n\n return true;\n};\n\nconst MemoizedReply = React.memo(ReplyWithContext, areEqual) as typeof ReplyWithContext;\n\nexport type ReplyProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<ReplyPropsWithContext<StreamChatGenerics>>;\n\n/**\n * UI Component for reply\n */\nexport const Reply = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: ReplyProps<StreamChatGenerics>,\n) => {\n const { message } = useMessageContext<StreamChatGenerics>();\n\n const { FileAttachmentIcon = FileIconDefault, MessageAvatar = MessageAvatarDefault } =\n useMessagesContext<StreamChatGenerics>();\n\n const { editing, quotedMessage } = useMessageInputContext<StreamChatGenerics>();\n\n const quotedEditingMessage = (\n typeof editing !== 'boolean' ? editing?.quoted_message || false : false\n ) as MessageInputContextValue<StreamChatGenerics>['quotedMessage'];\n\n const { t } = useTranslationContext();\n\n return (\n <MemoizedReply\n {...{\n FileAttachmentIcon,\n MessageAvatar,\n quotedMessage: message\n ? (message.quoted_message as MessageInputContextValue<StreamChatGenerics>['quotedMessage'])\n : quotedMessage || quotedEditingMessage,\n t,\n }}\n {...props}\n />\n );\n};\n\nReply.displayName = 'Reply{reply}';\n"]}
1
+ {"version":3,"sources":["Reply.tsx"],"names":["styles","StyleSheet","create","container","alignItems","flexDirection","fileAttachmentContainer","paddingLeft","paddingVertical","imageAttachment","borderRadius","height","marginLeft","marginVertical","width","messageContainer","borderBottomLeftRadius","borderBottomRightRadius","borderTopLeftRadius","borderTopRightRadius","flexGrow","flexShrink","text","fontSize","textContainer","maxWidth","undefined","paddingHorizontal","videoAttachment","getMessageType","lastAttachment","messageType","isLastAttachmentFile","type","isLastAttachmentVideo","isLastAttachmentGiphy","isLastAttachmentImageOrGiphy","title_link","og_scrape_url","isLastAttachmentImage","image_url","thumb_url","ReplyWithContext","props","FileAttachmentIcon","attachmentSize","MessageAvatar","quotedMessage","stylesProp","t","error","setError","theme","colors","blue_alice","border","grey","transparent","white","deletedText","messageSimple","content","reply","markdownStyles","attachments","slice","hasImage","onlyEmojis","emojiRegex","test","backgroundColor","borderColor","borderWidth","mime_type","uri","url","deleted_at","em","color","length","title","marginRight","Number","useMessageInputContextIfAvailable","contextValue","MessageInputContext","areEqual","prevProps","nextProps","prevQuotedMessage","nextQuotedMessage","quotedMessageEqual","id","MemoizedReply","React","memo","Reply","message","FileIconDefault","MessageAvatarDefault","editing","quotedEditingMessage","quoted_message","displayName"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AAIA;;AACA;;AAIA;;AAIA;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;AAEA,IAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AAC/BC,EAAAA,SAAS,EAAE;AACTC,IAAAA,UAAU,EAAE,UADH;AAETC,IAAAA,aAAa,EAAE;AAFN,GADoB;AAK/BC,EAAAA,uBAAuB,EAAE;AAAEC,IAAAA,WAAW,EAAE,CAAf;AAAkBC,IAAAA,eAAe,EAAE;AAAnC,GALM;AAM/BC,EAAAA,eAAe,EAAE;AACfC,IAAAA,YAAY,EAAE,CADC;AAEfC,IAAAA,MAAM,EAAE,EAFO;AAGfC,IAAAA,UAAU,EAAE,CAHG;AAIfC,IAAAA,cAAc,EAAE,CAJD;AAKfC,IAAAA,KAAK,EAAE;AALQ,GANc;AAa/BC,EAAAA,gBAAgB,EAAE;AAChBX,IAAAA,UAAU,EAAE,Y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sourcesContent":["import React, { useContext, useState } from 'react';\nimport { Image, ImageStyle, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport merge from 'lodash/merge';\n\nimport type { Attachment } from 'stream-chat';\n\nimport { useMessageContext } from '../../contexts/messageContext/MessageContext';\nimport {\n MessageInputContext,\n MessageInputContextValue,\n} from '../../contexts/messageInputContext/MessageInputContext';\nimport {\n MessagesContextValue,\n useMessagesContext,\n} from '../../contexts/messagesContext/MessagesContext';\nimport { useTheme } from '../../contexts/themeContext/ThemeContext';\nimport {\n TranslationContextValue,\n useTranslationContext,\n} from '../../contexts/translationContext/TranslationContext';\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { getResizedImageUrl } from '../../utils/getResizedImageUrl';\nimport { emojiRegex } from '../../utils/utils';\n\nimport { FileIcon as FileIconDefault } from '../Attachment/FileIcon';\nimport { VideoThumbnail } from '../Attachment/VideoThumbnail';\nimport { MessageAvatar as MessageAvatarDefault } from '../Message/MessageSimple/MessageAvatar';\nimport { MessageTextContainer } from '../Message/MessageSimple/MessageTextContainer';\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: 'flex-end',\n flexDirection: 'row',\n },\n fileAttachmentContainer: { paddingLeft: 8, paddingVertical: 8 },\n imageAttachment: {\n borderRadius: 8,\n height: 32,\n marginLeft: 8,\n marginVertical: 8,\n width: 32,\n },\n messageContainer: {\n alignItems: 'flex-start',\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 12,\n borderTopLeftRadius: 12,\n borderTopRightRadius: 12,\n flexDirection: 'row',\n flexGrow: 1,\n flexShrink: 1,\n },\n text: { fontSize: 12 },\n textContainer: { maxWidth: undefined, paddingHorizontal: 8 },\n videoAttachment: {\n borderRadius: 8,\n height: 50,\n marginLeft: 8,\n marginVertical: 8,\n width: 50,\n },\n});\n\ntype ReplyPropsWithContext<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Pick<MessageInputContextValue<StreamChatGenerics>, 'quotedMessage'> &\n Pick<MessagesContextValue<StreamChatGenerics>, 'FileAttachmentIcon' | 'MessageAvatar'> &\n Pick<TranslationContextValue, 't'> & {\n attachmentSize?: number;\n styles?: Partial<{\n container: ViewStyle;\n fileAttachmentContainer: ViewStyle;\n imageAttachment: ImageStyle;\n messageContainer: ViewStyle;\n textContainer: ViewStyle;\n }>;\n };\n\nconst getMessageType = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n lastAttachment: Attachment<StreamChatGenerics>,\n) => {\n let messageType;\n\n const isLastAttachmentFile = lastAttachment.type === 'file' || lastAttachment.type === 'audio';\n\n const isLastAttachmentVideo = lastAttachment.type === 'video';\n\n const isLastAttachmentGiphy =\n lastAttachment?.type === 'giphy' || lastAttachment?.type === 'imgur';\n\n const isLastAttachmentImageOrGiphy =\n lastAttachment?.type === 'image' &&\n !lastAttachment?.title_link &&\n !lastAttachment?.og_scrape_url;\n\n const isLastAttachmentImage = lastAttachment?.image_url || lastAttachment?.thumb_url;\n\n if (isLastAttachmentFile) {\n messageType = 'file';\n } else if (isLastAttachmentVideo) {\n messageType = 'video';\n } else if (isLastAttachmentImageOrGiphy) {\n if (isLastAttachmentImage) messageType = 'image';\n else messageType = undefined;\n } else if (isLastAttachmentGiphy) messageType = 'giphy';\n else messageType = 'other';\n\n return messageType;\n};\n\nconst ReplyWithContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: ReplyPropsWithContext<StreamChatGenerics>,\n) => {\n const {\n FileAttachmentIcon,\n attachmentSize = 40,\n MessageAvatar,\n quotedMessage,\n styles: stylesProp = {},\n t,\n } = props;\n\n const [error, setError] = useState(false);\n\n const {\n theme: {\n colors: { blue_alice, border, grey, transparent, white },\n messageSimple: {\n content: { deletedText },\n },\n reply: {\n container,\n fileAttachmentContainer,\n imageAttachment,\n markdownStyles,\n messageContainer,\n textContainer,\n },\n },\n } = useTheme();\n\n if (typeof quotedMessage === 'boolean') return null;\n\n const lastAttachment = quotedMessage.attachments?.slice(-1)[0] as Attachment<StreamChatGenerics>;\n const messageType = lastAttachment && getMessageType(lastAttachment);\n\n const hasImage =\n !error &&\n lastAttachment &&\n messageType !== 'file' &&\n (lastAttachment.image_url || lastAttachment.thumb_url || lastAttachment.og_scrape_url);\n\n const onlyEmojis = !lastAttachment && !!quotedMessage.text && emojiRegex.test(quotedMessage.text);\n\n return (\n <View style={[styles.container, container, stylesProp.container]}>\n <MessageAvatar alignment={'left'} lastGroupMessage message={quotedMessage} size={24} />\n <View\n style={[\n styles.messageContainer,\n {\n backgroundColor:\n messageType === 'other' ? blue_alice : messageType === 'giphy' ? transparent : white,\n borderColor: border,\n borderWidth: messageType === 'other' ? 0 : 1,\n },\n messageContainer,\n stylesProp.messageContainer,\n ]}\n >\n {!error && lastAttachment ? (\n messageType === 'file' ? (\n <View\n style={[\n styles.fileAttachmentContainer,\n fileAttachmentContainer,\n stylesProp.fileAttachmentContainer,\n ]}\n >\n <FileAttachmentIcon mimeType={lastAttachment.mime_type} size={attachmentSize} />\n </View>\n ) : hasImage ? (\n <Image\n onError={() => setError(true)}\n source={{\n uri: getResizedImageUrl({\n height:\n stylesProp.imageAttachment?.height ||\n imageAttachment?.height ||\n styles.imageAttachment.height,\n url: (lastAttachment.image_url ||\n lastAttachment.thumb_url ||\n lastAttachment.og_scrape_url) as string,\n width:\n stylesProp.imageAttachment?.width ||\n imageAttachment?.width ||\n styles.imageAttachment.width,\n }),\n }}\n style={[styles.imageAttachment, imageAttachment, stylesProp.imageAttachment]}\n />\n ) : null\n ) : null}\n {messageType === 'video' && !lastAttachment.og_scrape_url ? (\n <VideoThumbnail style={[styles.videoAttachment]} />\n ) : null}\n <MessageTextContainer<StreamChatGenerics>\n markdownStyles={\n quotedMessage.deleted_at\n ? merge({ em: { color: grey } }, deletedText)\n : { text: styles.text, ...markdownStyles }\n }\n message={{\n ...quotedMessage,\n text: quotedMessage.deleted_at\n ? `_${t('Message deleted')}_`\n : quotedMessage.text\n ? quotedMessage.text.length > 170\n ? `${quotedMessage.text.slice(0, 170)}...`\n : quotedMessage.text\n : messageType === 'image'\n ? t('Photo')\n : messageType === 'video'\n ? 'Video'\n : messageType === 'file'\n ? lastAttachment?.title || ''\n : '',\n }}\n onlyEmojis={onlyEmojis}\n styles={{\n textContainer: [\n {\n marginRight:\n hasImage || messageType === 'video'\n ? Number(\n stylesProp.imageAttachment?.height ||\n imageAttachment.height ||\n styles.imageAttachment.height,\n ) +\n Number(\n stylesProp.imageAttachment?.marginLeft ||\n imageAttachment.marginLeft ||\n styles.imageAttachment.marginLeft,\n )\n : messageType === 'file'\n ? attachmentSize +\n Number(\n stylesProp.fileAttachmentContainer?.paddingLeft ||\n fileAttachmentContainer.paddingLeft ||\n styles.fileAttachmentContainer.paddingLeft,\n )\n : undefined,\n },\n styles.textContainer,\n textContainer,\n stylesProp.textContainer,\n ],\n }}\n />\n </View>\n </View>\n );\n};\n\n/**\n * When a reply is rendered in a MessageSimple, it does\n * not have a MessageInputContext. As this is deliberate,\n * this function exists to avoid the error thrown when\n * using a context outside of its provider.\n * */\nconst useMessageInputContextIfAvailable = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() => {\n const contextValue = useContext(\n MessageInputContext,\n ) as unknown as MessageInputContextValue<StreamChatGenerics>;\n\n return contextValue;\n};\n\nconst areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(\n prevProps: ReplyPropsWithContext<StreamChatGenerics>,\n nextProps: ReplyPropsWithContext<StreamChatGenerics>,\n) => {\n const { quotedMessage: prevQuotedMessage } = prevProps;\n const { quotedMessage: nextQuotedMessage } = nextProps;\n\n const quotedMessageEqual =\n !!prevQuotedMessage &&\n !!nextQuotedMessage &&\n typeof prevQuotedMessage !== 'boolean' &&\n typeof nextQuotedMessage !== 'boolean'\n ? prevQuotedMessage.id === nextQuotedMessage.id &&\n prevQuotedMessage.deleted_at === nextQuotedMessage.deleted_at\n : !!prevQuotedMessage === !!nextQuotedMessage;\n\n if (!quotedMessageEqual) return false;\n\n return true;\n};\n\nconst MemoizedReply = React.memo(ReplyWithContext, areEqual) as typeof ReplyWithContext;\n\nexport type ReplyProps<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = Partial<ReplyPropsWithContext<StreamChatGenerics>>;\n\n/**\n * UI Component for reply\n */\nexport const Reply = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n props: ReplyProps<StreamChatGenerics>,\n) => {\n const { message } = useMessageContext<StreamChatGenerics>();\n\n const { FileAttachmentIcon = FileIconDefault, MessageAvatar = MessageAvatarDefault } =\n useMessagesContext<StreamChatGenerics>();\n\n const { editing, quotedMessage } = useMessageInputContextIfAvailable<StreamChatGenerics>();\n\n const quotedEditingMessage = (\n typeof editing !== 'boolean' ? editing?.quoted_message || false : false\n ) as MessageInputContextValue<StreamChatGenerics>['quotedMessage'];\n\n const { t } = useTranslationContext();\n\n return (\n <MemoizedReply\n {...{\n FileAttachmentIcon,\n MessageAvatar,\n quotedMessage: message\n ? (message.quoted_message as MessageInputContextValue<StreamChatGenerics>['quotedMessage'])\n : quotedMessage || quotedEditingMessage,\n t,\n }}\n {...props}\n />\n );\n};\n\nReply.displayName = 'Reply{reply}';\n"]}
@@ -36,7 +36,7 @@ var MessagesProvider = function MessagesProvider(_ref) {
36
36
  __self: _this,
37
37
  __source: {
38
38
  fileName: _jsxFileName,
39
- lineNumber: 480,
39
+ lineNumber: 495,
40
40
  columnNumber: 3
41
41
  }
42
42
  }, children);
@@ -63,7 +63,7 @@ var withMessagesContext = function withMessagesContext(Component) {
63
63
  __self: _this,
64
64
  __source: {
65
65
  fileName: _jsxFileName,
66
- lineNumber: 517,
66
+ lineNumber: 532,
67
67
  columnNumber: 12
68
68
  }
69
69
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["MessagesContext.tsx"],"names":["MessagesContext","React","createContext","DEFAULT_BASE_CONTEXT_VALUE","MessagesProvider","children","value","useMessagesContext","contextValue","Error","withMessagesContext","Component","WithMessagesContextComponent","props","messagesContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAmDA;;AAEA;;AACA;;;;;;;;;AA6ZO,IAAMA,eAAe,GAAGC,kBAAMC,aAAN,CAC7BC,mDAD6B,CAAxB;;;;AAIA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAAA,MAG9BC,QAH8B,QAG9BA,QAH8B;AAAA,MAI9BC,KAJ8B,QAI9BA,KAJ8B;AAAA,SAQ9B,gCAAC,eAAD,CAAiB,QAAjB;AAA0B,IAAA,KAAK,EAAEA,KAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAR8B;AAAA,CAAzB;;;;AAaA,IAAME,kBAAkB,GAAG,SAArBA,kBAAqB,GAE3B;AACL,MAAMC,YAAY,GAAG,uBACnBR,eADmB,CAArB;;AAIA,MAAIQ,YAAY,KAAKL,mDAAjB,IAA+C,CAAC,2CAApD,EAAyE;AACvE,UAAM,IAAIM,KAAJ,yOAAN;AAGD;;AAED,SAAOD,YAAP;AACD,CAdM;;;;AAqBA,IAAME,mBAAmB,GAAG,SAAtBA,mBAAsB,CAIjCC,SAJiC,EAKqC;AACtE,MAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CACnCC,KADmC,EAEhC;AACH,QAAMC,eAAe,GAAGP,kBAAkB,EAA1C;AAEA,WAAO,gCAAC,SAAD,gCAAgBM,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,CAfM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport type { TouchableOpacityProps } from 'react-native';\n\nimport type { MessagePinnedHeaderProps } from 'src/components/Message/MessageSimple/MessagePinnedHeader';\n\nimport type { Attachment, ChannelState, MessageResponse } from 'stream-chat';\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 { VideoThumbnailProps } from '../../components/Attachment/VideoThumbnail';\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';\n\nimport type { MessageRepliesProps } from '../../components/Message/MessageSimple/MessageReplies';\nimport type { MessageRepliesAvatarsProps } from '../../components/Message/MessageSimple/MessageRepliesAvatars';\nimport type { MessageSimpleProps } from '../../components/Message/MessageSimple/MessageSimple';\nimport type { MessageStatusProps } from '../../components/Message/MessageSimple/MessageStatus';\nimport type { MessageTextProps } from '../../components/Message/MessageSimple/MessageTextContainer';\nimport type { ReactionListProps } from '../../components/Message/MessageSimple/ReactionList';\nimport type { MarkdownRules } from '../../components/Message/MessageSimple/utils/renderText';\nimport type { MessageActionsParams } from '../../components/Message/utils/messageActions';\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 { MessageSystemProps } from '../../components/MessageList/MessageSystem';\nimport type { ScrollToBottomButtonProps } from '../../components/MessageList/ScrollToBottomButton';\nimport type { MessageActionType } from '../../components/MessageOverlay/MessageActionListItem';\nimport type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList';\nimport type { ReplyProps } from '../../components/Reply/Reply';\nimport type { FlatList } from '../../native';\nimport type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';\nimport type { ReactionData } from '../../utils/utils';\nimport type { Alignment } from '../messageContext/MessageContext';\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';\nimport { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';\n\nimport { getDisplayName } from '../utils/getDisplayName';\nimport { isTestEnvironment } from '../utils/isTestEnvironment';\n\nexport type MessageContentType = 'attachments' | 'files' | 'gallery' | 'quoted_reply' | 'text';\n\nexport type MessagesContextValue<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n /**\n * UI component for Attachment.\n * Defaults to: [Attachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Attachment.tsx)\n */\n Attachment: React.ComponentType<AttachmentProps<StreamChatGenerics>>;\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/main/package/src/components/Attachment/AttachmentActions.tsx)\n */\n AttachmentActions: React.ComponentType<AttachmentActionsProps<StreamChatGenerics>>;\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/main/package/src/components/Attachment/Card.tsx)\n */\n Card: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * UI component for DateHeader\n * Defaults to: [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/DateHeader.tsx)\n **/\n DateHeader: React.ComponentType<DateHeaderProps>;\n\n /** Should keyboard be dismissed when messaged is touched */\n dismissKeyboardOnMessageTouch: boolean;\n\n enableMessageGroupingByUser: boolean;\n\n /**\n * UI component to display File type attachment.\n * Defaults to: [FileAttachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileAttachment.tsx)\n */\n FileAttachment: React.ComponentType<FileAttachmentProps<StreamChatGenerics>>;\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/main/package/src/components/Attachment/FileAttachmentGroup.tsx)\n */\n FileAttachmentGroup: React.ComponentType<FileAttachmentGroupProps<StreamChatGenerics>>;\n /**\n * UI component for attachment icon for type 'file' attachment.\n * Defaults to: https://github.com/GetStream/stream-chat-react-native/blob/main/package/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/main/package/src/components/Attachment/Gallery.tsx)\n */\n Gallery: React.ComponentType<GalleryProps<StreamChatGenerics>>;\n /**\n * UI component for Giphy\n * Defaults to: [Giphy](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Giphy.tsx)\n */\n Giphy: React.ComponentType<GiphyProps<StreamChatGenerics>>;\n /**\n * The giphy version to render - check the keys of the [Image Object](https://developers.giphy.com/docs/api/schema#image-object) for possible values. Uses 'fixed_height' by default\n * */\n giphyVersion: keyof NonNullable<Attachment['giphy']>;\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/main/package/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/main/package/src/components/Message/MessageSimple/InlineUnreadIndicator.tsx)\n **/\n InlineUnreadIndicator: React.ComponentType;\n Message: React.ComponentType<MessageProps<StreamChatGenerics>>;\n /**\n * UI component for MessageAvatar\n * Defaults to: [MessageAvatar](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageAvatar.tsx)\n **/\n MessageAvatar: React.ComponentType<MessageAvatarProps<StreamChatGenerics>>;\n /**\n * UI component for MessageContent\n * Defaults to: [MessageContent](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageContent.tsx)\n */\n MessageContent: React.ComponentType<MessageContentProps<StreamChatGenerics>>;\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/main/package/src/components/MessageSimple/MessageDeleted.tsx)\n */\n MessageDeleted: React.ComponentType<MessageDeletedProps<StreamChatGenerics>>;\n /**\n * Custom message footer component\n */\n MessageFooter: React.ComponentType<MessageFooterProps<StreamChatGenerics>>;\n MessageList: React.ComponentType<MessageListProps<StreamChatGenerics>>;\n /**\n * Custom message pinned component\n */\n MessagePinnedHeader: React.ComponentType<MessagePinnedHeaderProps<StreamChatGenerics>>;\n /**\n * UI component for MessageReplies\n * Defaults to: [MessageReplies](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageReplies.tsx)\n */\n\n MessageReplies: React.ComponentType<MessageRepliesProps<StreamChatGenerics>>;\n /**\n * UI Component for MessageRepliesAvatars\n * Defaults to: [MessageRepliesAvatars](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageRepliesAvatars.tsx)\n */\n MessageRepliesAvatars: React.ComponentType<MessageRepliesAvatarsProps<StreamChatGenerics>>;\n /**\n * UI component for MessageSimple\n * Defaults to: [MessageSimple](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageSimple.tsx)\n */\n MessageSimple: React.ComponentType<MessageSimpleProps<StreamChatGenerics>>;\n /**\n * UI component for MessageStatus (delivered/read)\n * Defaults to: [MessageStatus](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageStatus.tsx)\n */\n MessageStatus: React.ComponentType<MessageStatusProps<StreamChatGenerics>>;\n /**\n * UI component for MessageSystem\n * Defaults to: [MessageSystem](https://getstream.io/chat/docs/sdk/reactnative/ui-components/message-system/)\n */\n MessageSystem: React.ComponentType<MessageSystemProps<StreamChatGenerics>>;\n /**\n * UI component for OverlayReactionList\n */\n OverlayReactionList: React.ComponentType<OverlayReactionListProps<StreamChatGenerics>>;\n /**\n * UI component for ReactionList\n * Defaults to: [ReactionList](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Reaction/ReactionList.tsx)\n */\n ReactionList: React.ComponentType<ReactionListProps<StreamChatGenerics>>;\n removeMessage: (message: { id: string; parent_id?: string }) => void;\n /**\n * UI component for Reply\n * Defaults to: [Reply](https://getstream.io/chat/docs/sdk/reactnative/ui-components/reply/)\n */\n Reply: React.ComponentType<ReplyProps<StreamChatGenerics>>;\n /**\n * Override the api request for retry message functionality.\n */\n retrySendMessage: (message: MessageResponse<StreamChatGenerics>) => Promise<void>;\n /**\n * UI component for ScrollToBottomButton\n * Defaults to: [ScrollToBottomButton](https://getstream.io/chat/docs/sdk/reactnative/ui-components/scroll-to-bottom-button/)\n */\n ScrollToBottomButton: React.ComponentType<ScrollToBottomButtonProps>;\n setEditingState: (message: MessageType<StreamChatGenerics>) => void;\n setQuotedMessageState: (message: MessageType<StreamChatGenerics>) => void;\n supportedReactions: ReactionData[];\n /**\n * UI component for TypingIndicator\n * Defaults to: [TypingIndicator](https://getstream.io/chat/docs/sdk/reactnative/ui-components/typing-indicator/)\n */\n TypingIndicator: React.ComponentType;\n /**\n * UI component for TypingIndicatorContainer\n * Defaults to: [TypingIndicatorContainer](https://getstream.io/chat/docs/sdk/reactnative/contexts/messages-context/#typingindicatorcontainer)\n */\n TypingIndicatorContainer: React.ComponentType;\n updateMessage: (\n updatedMessage: MessageResponse<StreamChatGenerics>,\n extraState?: {\n commands?: SuggestionCommand<StreamChatGenerics>[];\n messageInput?: string;\n threadMessages?: ChannelState<StreamChatGenerics>['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/main/package/src/components/Attachment/Card.tsx\n */\n UrlPreview: React.ComponentType<CardProps<StreamChatGenerics>>;\n VideoThumbnail: React.ComponentType<VideoThumbnailProps>;\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 * 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<StreamChatGenerics>>;\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<StreamChatGenerics>>;\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<StreamChatGenerics>>;\n\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\n /** Control if the deleted message is visible to both the send and reciever, either of them or none */\n deletedMessagesVisibilityType?: 'always' | 'never' | 'receiver' | 'sender';\n\n disableTypingIndicator?: boolean;\n\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<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a copy message action is invoked */\n handleCopy?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a delete message action is invoked */\n handleDelete?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when an edit message action is invoked */\n handleEdit?: (message: MessageType<StreamChatGenerics>) => void;\n /** Handler to access when a flag message action is invoked */\n handleFlag?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a mute user action is invoked */\n handleMute?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a pin/unpin user action is invoked*/\n handlePinMessage?: ((message: MessageType<StreamChatGenerics>) => MessageActionType) | null;\n /** Handler to access when a quoted reply action is invoked */\n handleQuotedReply?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to process a reaction */\n handleReaction?: (\n message: MessageType<StreamChatGenerics>,\n reactionType: string,\n ) => Promise<void>;\n /** Handler to access when a retry action is invoked */\n handleRetry?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a thread reply action is invoked */\n handleThreadReply?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to deal with custom memoization logic of Attachment */\n isAttachmentEqual?: (\n prevAttachment: Attachment<StreamChatGenerics>,\n nextAttachment: Attachment<StreamChatGenerics>,\n ) => boolean;\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?: (param: MessageActionsParams<StreamChatGenerics>) => MessageActionType[];\n /**\n * Custom message header component\n */\n MessageHeader?: React.ComponentType<MessageFooterProps<StreamChatGenerics>>;\n /** Custom UI component for message text */\n MessageText?: React.ComponentType<MessageTextProps<StreamChatGenerics>>;\n\n /**\n * Theme provided only to messages that are the current users\n */\n myMessageTheme?: DeepPartial<Theme>;\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?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => 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<StreamChatGenerics>) => 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<StreamChatGenerics>) => void;\n\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<StreamChatGenerics>,\n ) => (reactionType: string) => Promise<void>;\n\n targetedMessage?: string;\n};\n\nexport const MessagesContext = React.createContext(\n DEFAULT_BASE_CONTEXT_VALUE as MessagesContextValue,\n);\n\nexport const MessagesProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value?: MessagesContextValue<StreamChatGenerics>;\n}>) => (\n <MessagesContext.Provider value={value as unknown as MessagesContextValue}>\n {children}\n </MessagesContext.Provider>\n);\n\nexport const useMessagesContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() => {\n const contextValue = useContext(\n MessagesContext,\n ) as unknown as MessagesContextValue<StreamChatGenerics>;\n\n if (contextValue === DEFAULT_BASE_CONTEXT_VALUE && !isTestEnvironment()) {\n throw new Error(\n `The useMessagesContext hook was called outside of the MessagesContext provider. Make sure you have configured MessageList component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#message-list`,\n );\n }\n\n return contextValue;\n};\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 StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof MessagesContextValue<StreamChatGenerics>>> => {\n const WithMessagesContextComponent = (\n props: Omit<P, keyof MessagesContextValue<StreamChatGenerics>>,\n ) => {\n const messagesContext = useMessagesContext<StreamChatGenerics>();\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","DEFAULT_BASE_CONTEXT_VALUE","MessagesProvider","children","value","useMessagesContext","contextValue","Error","withMessagesContext","Component","WithMessagesContextComponent","props","messagesContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAsDA;;AAEA;;AACA;;;;;;;;;AAyaO,IAAMA,eAAe,GAAGC,kBAAMC,aAAN,CAC7BC,mDAD6B,CAAxB;;;;AAIA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAAA,MAG9BC,QAH8B,QAG9BA,QAH8B;AAAA,MAI9BC,KAJ8B,QAI9BA,KAJ8B;AAAA,SAQ9B,gCAAC,eAAD,CAAiB,QAAjB;AAA0B,IAAA,KAAK,EAAEA,KAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAR8B;AAAA,CAAzB;;;;AAaA,IAAME,kBAAkB,GAAG,SAArBA,kBAAqB,GAE3B;AACL,MAAMC,YAAY,GAAG,uBACnBR,eADmB,CAArB;;AAIA,MAAIQ,YAAY,KAAKL,mDAAjB,IAA+C,CAAC,2CAApD,EAAyE;AACvE,UAAM,IAAIM,KAAJ,yOAAN;AAGD;;AAED,SAAOD,YAAP;AACD,CAdM;;;;AAqBA,IAAME,mBAAmB,GAAG,SAAtBA,mBAAsB,CAIjCC,SAJiC,EAKqC;AACtE,MAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CACnCC,KADmC,EAEhC;AACH,QAAMC,eAAe,GAAGP,kBAAkB,EAA1C;AAEA,WAAO,gCAAC,SAAD,gCAAgBM,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,CAfM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport type { TouchableOpacityProps } from 'react-native';\n\nimport type { ImageLoadingFailedIndicatorProps } from 'src/components/Attachment/ImageLoadingFailedIndicator';\nimport type { ImageLoadingIndicatorProps } from 'src/components/Attachment/ImageLoadingIndicator';\n\nimport type { MessagePinnedHeaderProps } from 'src/components/Message/MessageSimple/MessagePinnedHeader';\n\nimport type { Attachment, ChannelState, MessageResponse } from 'stream-chat';\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 { VideoThumbnailProps } from '../../components/Attachment/VideoThumbnail';\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';\n\nimport type { MessageRepliesProps } from '../../components/Message/MessageSimple/MessageReplies';\nimport type { MessageRepliesAvatarsProps } from '../../components/Message/MessageSimple/MessageRepliesAvatars';\nimport type { MessageSimpleProps } from '../../components/Message/MessageSimple/MessageSimple';\nimport type { MessageStatusProps } from '../../components/Message/MessageSimple/MessageStatus';\nimport type { MessageTextProps } from '../../components/Message/MessageSimple/MessageTextContainer';\nimport type { ReactionListProps } from '../../components/Message/MessageSimple/ReactionList';\nimport type { MarkdownRules } from '../../components/Message/MessageSimple/utils/renderText';\nimport type { MessageActionsParams } from '../../components/Message/utils/messageActions';\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 { MessageSystemProps } from '../../components/MessageList/MessageSystem';\nimport type { ScrollToBottomButtonProps } from '../../components/MessageList/ScrollToBottomButton';\nimport type { MessageActionType } from '../../components/MessageOverlay/MessageActionListItem';\nimport type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList';\nimport type { ReplyProps } from '../../components/Reply/Reply';\nimport type { FlatList } from '../../native';\nimport type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';\nimport type { ReactionData } from '../../utils/utils';\nimport type { Alignment } from '../messageContext/MessageContext';\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';\nimport { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';\n\nimport { getDisplayName } from '../utils/getDisplayName';\nimport { isTestEnvironment } from '../utils/isTestEnvironment';\n\nexport type MessageContentType = 'attachments' | 'files' | 'gallery' | 'quoted_reply' | 'text';\n\nexport type MessagesContextValue<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n /**\n * UI component for Attachment.\n * Defaults to: [Attachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Attachment.tsx)\n */\n Attachment: React.ComponentType<AttachmentProps<StreamChatGenerics>>;\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/main/package/src/components/Attachment/AttachmentActions.tsx)\n */\n AttachmentActions: React.ComponentType<AttachmentActionsProps<StreamChatGenerics>>;\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/main/package/src/components/Attachment/Card.tsx)\n */\n Card: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * UI component for DateHeader\n * Defaults to: [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/DateHeader.tsx)\n **/\n DateHeader: React.ComponentType<DateHeaderProps>;\n\n /** Should keyboard be dismissed when messaged is touched */\n dismissKeyboardOnMessageTouch: boolean;\n\n enableMessageGroupingByUser: boolean;\n\n /**\n * UI component to display File type attachment.\n * Defaults to: [FileAttachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileAttachment.tsx)\n */\n FileAttachment: React.ComponentType<FileAttachmentProps<StreamChatGenerics>>;\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/main/package/src/components/Attachment/FileAttachmentGroup.tsx)\n */\n FileAttachmentGroup: React.ComponentType<FileAttachmentGroupProps<StreamChatGenerics>>;\n /**\n * UI component for attachment icon for type 'file' attachment.\n * Defaults to: https://github.com/GetStream/stream-chat-react-native/blob/main/package/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/main/package/src/components/Attachment/Gallery.tsx)\n */\n Gallery: React.ComponentType<GalleryProps<StreamChatGenerics>>;\n /**\n * UI component for Giphy\n * Defaults to: [Giphy](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Giphy.tsx)\n */\n Giphy: React.ComponentType<GiphyProps<StreamChatGenerics>>;\n /**\n * The giphy version to render - check the keys of the [Image Object](https://developers.giphy.com/docs/api/schema#image-object) for possible values. Uses 'fixed_height' by default\n * */\n giphyVersion: keyof NonNullable<Attachment['giphy']>;\n\n /**\n * The indicator rendered when loading an image fails.\n */\n ImageLoadingFailedIndicator: React.ComponentType<ImageLoadingFailedIndicatorProps>;\n\n /**\n * The indicator rendered when image is loading. By default renders <ActivityIndicator/>\n */\n ImageLoadingIndicator: React.ComponentType<ImageLoadingIndicatorProps>;\n\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/main/package/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/main/package/src/components/Message/MessageSimple/InlineUnreadIndicator.tsx)\n **/\n InlineUnreadIndicator: React.ComponentType;\n\n Message: React.ComponentType<MessageProps<StreamChatGenerics>>;\n /**\n * UI component for MessageAvatar\n * Defaults to: [MessageAvatar](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageAvatar.tsx)\n **/\n MessageAvatar: React.ComponentType<MessageAvatarProps<StreamChatGenerics>>;\n /**\n * UI component for MessageContent\n * Defaults to: [MessageContent](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageContent.tsx)\n */\n MessageContent: React.ComponentType<MessageContentProps<StreamChatGenerics>>;\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/main/package/src/components/MessageSimple/MessageDeleted.tsx)\n */\n MessageDeleted: React.ComponentType<MessageDeletedProps<StreamChatGenerics>>;\n /**\n * Custom message footer component\n */\n MessageFooter: React.ComponentType<MessageFooterProps<StreamChatGenerics>>;\n MessageList: React.ComponentType<MessageListProps<StreamChatGenerics>>;\n /**\n * Custom message pinned component\n */\n MessagePinnedHeader: React.ComponentType<MessagePinnedHeaderProps<StreamChatGenerics>>;\n /**\n * UI component for MessageReplies\n * Defaults to: [MessageReplies](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageReplies.tsx)\n */\n\n MessageReplies: React.ComponentType<MessageRepliesProps<StreamChatGenerics>>;\n /**\n * UI Component for MessageRepliesAvatars\n * Defaults to: [MessageRepliesAvatars](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageRepliesAvatars.tsx)\n */\n MessageRepliesAvatars: React.ComponentType<MessageRepliesAvatarsProps<StreamChatGenerics>>;\n /**\n * UI component for MessageSimple\n * Defaults to: [MessageSimple](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageSimple.tsx)\n */\n MessageSimple: React.ComponentType<MessageSimpleProps<StreamChatGenerics>>;\n /**\n * UI component for MessageStatus (delivered/read)\n * Defaults to: [MessageStatus](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageStatus.tsx)\n */\n MessageStatus: React.ComponentType<MessageStatusProps<StreamChatGenerics>>;\n /**\n * UI component for MessageSystem\n * Defaults to: [MessageSystem](https://getstream.io/chat/docs/sdk/reactnative/ui-components/message-system/)\n */\n MessageSystem: React.ComponentType<MessageSystemProps<StreamChatGenerics>>;\n /**\n * UI component for OverlayReactionList\n */\n OverlayReactionList: React.ComponentType<OverlayReactionListProps<StreamChatGenerics>>;\n /**\n * UI component for ReactionList\n * Defaults to: [ReactionList](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Reaction/ReactionList.tsx)\n */\n ReactionList: React.ComponentType<ReactionListProps<StreamChatGenerics>>;\n removeMessage: (message: { id: string; parent_id?: string }) => void;\n /**\n * UI component for Reply\n * Defaults to: [Reply](https://getstream.io/chat/docs/sdk/reactnative/ui-components/reply/)\n */\n Reply: React.ComponentType<ReplyProps<StreamChatGenerics>>;\n /**\n * Override the api request for retry message functionality.\n */\n retrySendMessage: (message: MessageResponse<StreamChatGenerics>) => Promise<void>;\n /**\n * UI component for ScrollToBottomButton\n * Defaults to: [ScrollToBottomButton](https://getstream.io/chat/docs/sdk/reactnative/ui-components/scroll-to-bottom-button/)\n */\n ScrollToBottomButton: React.ComponentType<ScrollToBottomButtonProps>;\n setEditingState: (message: MessageType<StreamChatGenerics>) => void;\n setQuotedMessageState: (message: MessageType<StreamChatGenerics>) => void;\n supportedReactions: ReactionData[];\n /**\n * UI component for TypingIndicator\n * Defaults to: [TypingIndicator](https://getstream.io/chat/docs/sdk/reactnative/ui-components/typing-indicator/)\n */\n TypingIndicator: React.ComponentType;\n /**\n * UI component for TypingIndicatorContainer\n * Defaults to: [TypingIndicatorContainer](https://getstream.io/chat/docs/sdk/reactnative/contexts/messages-context/#typingindicatorcontainer)\n */\n TypingIndicatorContainer: React.ComponentType;\n updateMessage: (\n updatedMessage: MessageResponse<StreamChatGenerics>,\n extraState?: {\n commands?: SuggestionCommand<StreamChatGenerics>[];\n messageInput?: string;\n threadMessages?: ChannelState<StreamChatGenerics>['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/main/package/src/components/Attachment/Card.tsx\n */\n UrlPreview: React.ComponentType<CardProps<StreamChatGenerics>>;\n VideoThumbnail: React.ComponentType<VideoThumbnailProps>;\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 * 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<StreamChatGenerics>>;\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<StreamChatGenerics>>;\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<StreamChatGenerics>>;\n\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\n /** Control if the deleted message is visible to both the send and reciever, either of them or none */\n deletedMessagesVisibilityType?: 'always' | 'never' | 'receiver' | 'sender';\n\n disableTypingIndicator?: boolean;\n\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<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a copy message action is invoked */\n handleCopy?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a delete message action is invoked */\n handleDelete?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when an edit message action is invoked */\n handleEdit?: (message: MessageType<StreamChatGenerics>) => void;\n /** Handler to access when a flag message action is invoked */\n handleFlag?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a mute user action is invoked */\n handleMute?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a pin/unpin user action is invoked*/\n handlePinMessage?: ((message: MessageType<StreamChatGenerics>) => MessageActionType) | null;\n /** Handler to access when a quoted reply action is invoked */\n handleQuotedReply?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to process a reaction */\n handleReaction?: (\n message: MessageType<StreamChatGenerics>,\n reactionType: string,\n ) => Promise<void>;\n /** Handler to access when a retry action is invoked */\n handleRetry?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a thread reply action is invoked */\n handleThreadReply?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to deal with custom memoization logic of Attachment */\n isAttachmentEqual?: (\n prevAttachment: Attachment<StreamChatGenerics>,\n nextAttachment: Attachment<StreamChatGenerics>,\n ) => boolean;\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?: (param: MessageActionsParams<StreamChatGenerics>) => MessageActionType[];\n /**\n * Custom message header component\n */\n MessageHeader?: React.ComponentType<MessageFooterProps<StreamChatGenerics>>;\n /** Custom UI component for message text */\n MessageText?: React.ComponentType<MessageTextProps<StreamChatGenerics>>;\n\n /**\n * Theme provided only to messages that are the current users\n */\n myMessageTheme?: DeepPartial<Theme>;\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?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => 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<StreamChatGenerics>) => 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<StreamChatGenerics>) => void;\n\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<StreamChatGenerics>,\n ) => (reactionType: string) => Promise<void>;\n\n targetedMessage?: string;\n};\n\nexport const MessagesContext = React.createContext(\n DEFAULT_BASE_CONTEXT_VALUE as MessagesContextValue,\n);\n\nexport const MessagesProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value?: MessagesContextValue<StreamChatGenerics>;\n}>) => (\n <MessagesContext.Provider value={value as unknown as MessagesContextValue}>\n {children}\n </MessagesContext.Provider>\n);\n\nexport const useMessagesContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() => {\n const contextValue = useContext(\n MessagesContext,\n ) as unknown as MessagesContextValue<StreamChatGenerics>;\n\n if (contextValue === DEFAULT_BASE_CONTEXT_VALUE && !isTestEnvironment()) {\n throw new Error(\n `The useMessagesContext hook was called outside of the MessagesContext provider. Make sure you have configured MessageList component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#message-list`,\n );\n }\n\n return contextValue;\n};\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 StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof MessagesContextValue<StreamChatGenerics>>> => {\n const WithMessagesContextComponent = (\n props: Omit<P, keyof MessagesContextValue<StreamChatGenerics>>,\n ) => {\n const messagesContext = useMessagesContext<StreamChatGenerics>();\n\n return <Component {...(props as P)} {...messagesContext} />;\n };\n WithMessagesContextComponent.displayName = `WithMessagesContext${getDisplayName(Component)}`;\n return WithMessagesContextComponent;\n};\n"]}
@@ -466,6 +466,10 @@ var defaultTheme = {
466
466
  shuffle: {},
467
467
  title: {}
468
468
  },
469
+ loadingIndicator: {
470
+ container: {},
471
+ roundedView: {}
472
+ },
469
473
  pinnedHeader: {
470
474
  container: {},
471
475
  label: {}