stream-chat-react-native-core 9.0.0-beta.26 → 9.0.0-beta.28

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 (273) hide show
  1. package/lib/commonjs/components/Attachment/Giphy/Giphy.js +19 -7
  2. package/lib/commonjs/components/Attachment/Giphy/Giphy.js.map +1 -1
  3. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js +3 -3
  4. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
  5. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerGenericContent.js +24 -16
  6. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerGenericContent.js.map +1 -1
  7. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js +2 -1
  8. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
  9. package/lib/commonjs/components/Channel/Channel.js +1 -1
  10. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  11. package/lib/commonjs/components/ChannelList/hooks/useChannelActionItems.js +0 -15
  12. package/lib/commonjs/components/ChannelList/hooks/useChannelActionItems.js.map +1 -1
  13. package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js +15 -13
  14. package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
  15. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessage.js +2 -0
  16. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessage.js.map +1 -1
  17. package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js +1 -0
  18. package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
  19. package/lib/commonjs/components/ChannelPreview/ChannelSwipableWrapper.js +11 -9
  20. package/lib/commonjs/components/ChannelPreview/ChannelSwipableWrapper.js.map +1 -1
  21. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +5 -4
  22. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
  23. package/lib/commonjs/components/Indicators/LoadingIndicator.js +3 -3
  24. package/lib/commonjs/components/Indicators/LoadingIndicator.js.map +1 -1
  25. package/lib/commonjs/components/Message/Message.js +2 -10
  26. package/lib/commonjs/components/Message/Message.js.map +1 -1
  27. package/lib/commonjs/components/Message/MessageItemView/MessageContent.js +39 -5
  28. package/lib/commonjs/components/Message/MessageItemView/MessageContent.js.map +1 -1
  29. package/lib/commonjs/components/Message/MessageItemView/MessageItemView.js +11 -7
  30. package/lib/commonjs/components/Message/MessageItemView/MessageItemView.js.map +1 -1
  31. package/lib/commonjs/components/Message/MessageItemView/MessageReplies.js +1 -1
  32. package/lib/commonjs/components/Message/MessageItemView/MessageReplies.js.map +1 -1
  33. package/lib/commonjs/components/Message/MessageItemView/MessageStatus.js +18 -8
  34. package/lib/commonjs/components/Message/MessageItemView/MessageStatus.js.map +1 -1
  35. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +3 -1
  36. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  37. package/lib/commonjs/components/MessageInput/ShowThreadMessageInChannelButton.js +2 -1
  38. package/lib/commonjs/components/MessageInput/ShowThreadMessageInChannelButton.js.map +1 -1
  39. package/lib/commonjs/components/MessageMenu/MessageUserReactions.js +0 -1
  40. package/lib/commonjs/components/MessageMenu/MessageUserReactions.js.map +1 -1
  41. package/lib/commonjs/components/Poll/components/MultipleVotesSettings.js +8 -0
  42. package/lib/commonjs/components/Poll/components/MultipleVotesSettings.js.map +1 -1
  43. package/lib/commonjs/components/Poll/components/PollInputDialog.js +1 -1
  44. package/lib/commonjs/components/Poll/components/PollInputDialog.js.map +1 -1
  45. package/lib/commonjs/components/Poll/components/PollOption.js +15 -5
  46. package/lib/commonjs/components/Poll/components/PollOption.js.map +1 -1
  47. package/lib/commonjs/components/ThreadList/ThreadList.js +3 -1
  48. package/lib/commonjs/components/ThreadList/ThreadList.js.map +1 -1
  49. package/lib/commonjs/components/UIComponents/BottomSheetModal.js +141 -40
  50. package/lib/commonjs/components/UIComponents/BottomSheetModal.js.map +1 -1
  51. package/lib/commonjs/components/UIComponents/BottomSheetModal.utils.js +53 -0
  52. package/lib/commonjs/components/UIComponents/BottomSheetModal.utils.js.map +1 -0
  53. package/lib/commonjs/components/UIComponents/StreamBottomSheetModalFlatList.js +9 -5
  54. package/lib/commonjs/components/UIComponents/StreamBottomSheetModalFlatList.js.map +1 -1
  55. package/lib/commonjs/components/ui/Avatar/ChannelAvatar.js +1 -1
  56. package/lib/commonjs/components/ui/Avatar/ChannelAvatar.js.map +1 -1
  57. package/lib/commonjs/components/ui/Button/hooks/useButtonStyles.js +1 -1
  58. package/lib/commonjs/components/ui/Button/hooks/useButtonStyles.js.map +1 -1
  59. package/lib/commonjs/contexts/bottomSheetContext/BottomSheetContext.js.map +1 -1
  60. package/lib/commonjs/contexts/messageComposerContext/MessageComposerContext.js +4 -4
  61. package/lib/commonjs/contexts/messageComposerContext/MessageComposerContext.js.map +1 -1
  62. package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
  63. package/lib/commonjs/contexts/themeContext/utils/theme.js +1 -0
  64. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  65. package/lib/commonjs/hooks/messagePreview/useMessagePreviewText.js +4 -4
  66. package/lib/commonjs/hooks/messagePreview/useMessagePreviewText.js.map +1 -1
  67. package/lib/commonjs/i18n/en.json +3 -2
  68. package/lib/commonjs/i18n/es.json +3 -2
  69. package/lib/commonjs/i18n/fr.json +3 -2
  70. package/lib/commonjs/i18n/he.json +3 -2
  71. package/lib/commonjs/i18n/hi.json +3 -2
  72. package/lib/commonjs/i18n/it.json +3 -2
  73. package/lib/commonjs/i18n/ja.json +3 -2
  74. package/lib/commonjs/i18n/ko.json +3 -2
  75. package/lib/commonjs/i18n/nl.json +3 -2
  76. package/lib/commonjs/i18n/pt-br.json +3 -2
  77. package/lib/commonjs/i18n/ru.json +3 -2
  78. package/lib/commonjs/i18n/tr.json +3 -2
  79. package/lib/commonjs/version.json +1 -1
  80. package/lib/module/components/Attachment/Giphy/Giphy.js +19 -7
  81. package/lib/module/components/Attachment/Giphy/Giphy.js.map +1 -1
  82. package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js +3 -3
  83. package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
  84. package/lib/module/components/AttachmentPicker/components/AttachmentPickerGenericContent.js +24 -16
  85. package/lib/module/components/AttachmentPicker/components/AttachmentPickerGenericContent.js.map +1 -1
  86. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js +2 -1
  87. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
  88. package/lib/module/components/Channel/Channel.js +1 -1
  89. package/lib/module/components/Channel/Channel.js.map +1 -1
  90. package/lib/module/components/ChannelList/hooks/useChannelActionItems.js +0 -15
  91. package/lib/module/components/ChannelList/hooks/useChannelActionItems.js.map +1 -1
  92. package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js +15 -13
  93. package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
  94. package/lib/module/components/ChannelPreview/ChannelPreviewMessage.js +2 -0
  95. package/lib/module/components/ChannelPreview/ChannelPreviewMessage.js.map +1 -1
  96. package/lib/module/components/ChannelPreview/ChannelPreviewView.js +1 -0
  97. package/lib/module/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
  98. package/lib/module/components/ChannelPreview/ChannelSwipableWrapper.js +11 -9
  99. package/lib/module/components/ChannelPreview/ChannelSwipableWrapper.js.map +1 -1
  100. package/lib/module/components/ImageGallery/components/ImageGrid.js +5 -4
  101. package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
  102. package/lib/module/components/Indicators/LoadingIndicator.js +3 -3
  103. package/lib/module/components/Indicators/LoadingIndicator.js.map +1 -1
  104. package/lib/module/components/Message/Message.js +2 -10
  105. package/lib/module/components/Message/Message.js.map +1 -1
  106. package/lib/module/components/Message/MessageItemView/MessageContent.js +39 -5
  107. package/lib/module/components/Message/MessageItemView/MessageContent.js.map +1 -1
  108. package/lib/module/components/Message/MessageItemView/MessageItemView.js +11 -7
  109. package/lib/module/components/Message/MessageItemView/MessageItemView.js.map +1 -1
  110. package/lib/module/components/Message/MessageItemView/MessageReplies.js +1 -1
  111. package/lib/module/components/Message/MessageItemView/MessageReplies.js.map +1 -1
  112. package/lib/module/components/Message/MessageItemView/MessageStatus.js +18 -8
  113. package/lib/module/components/Message/MessageItemView/MessageStatus.js.map +1 -1
  114. package/lib/module/components/Message/hooks/useCreateMessageContext.js +3 -1
  115. package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  116. package/lib/module/components/MessageInput/ShowThreadMessageInChannelButton.js +2 -1
  117. package/lib/module/components/MessageInput/ShowThreadMessageInChannelButton.js.map +1 -1
  118. package/lib/module/components/MessageMenu/MessageUserReactions.js +0 -1
  119. package/lib/module/components/MessageMenu/MessageUserReactions.js.map +1 -1
  120. package/lib/module/components/Poll/components/MultipleVotesSettings.js +8 -0
  121. package/lib/module/components/Poll/components/MultipleVotesSettings.js.map +1 -1
  122. package/lib/module/components/Poll/components/PollInputDialog.js +1 -1
  123. package/lib/module/components/Poll/components/PollInputDialog.js.map +1 -1
  124. package/lib/module/components/Poll/components/PollOption.js +15 -5
  125. package/lib/module/components/Poll/components/PollOption.js.map +1 -1
  126. package/lib/module/components/ThreadList/ThreadList.js +3 -1
  127. package/lib/module/components/ThreadList/ThreadList.js.map +1 -1
  128. package/lib/module/components/UIComponents/BottomSheetModal.js +141 -40
  129. package/lib/module/components/UIComponents/BottomSheetModal.js.map +1 -1
  130. package/lib/module/components/UIComponents/BottomSheetModal.utils.js +53 -0
  131. package/lib/module/components/UIComponents/BottomSheetModal.utils.js.map +1 -0
  132. package/lib/module/components/UIComponents/StreamBottomSheetModalFlatList.js +9 -5
  133. package/lib/module/components/UIComponents/StreamBottomSheetModalFlatList.js.map +1 -1
  134. package/lib/module/components/ui/Avatar/ChannelAvatar.js +1 -1
  135. package/lib/module/components/ui/Avatar/ChannelAvatar.js.map +1 -1
  136. package/lib/module/components/ui/Button/hooks/useButtonStyles.js +1 -1
  137. package/lib/module/components/ui/Button/hooks/useButtonStyles.js.map +1 -1
  138. package/lib/module/contexts/bottomSheetContext/BottomSheetContext.js.map +1 -1
  139. package/lib/module/contexts/messageComposerContext/MessageComposerContext.js +4 -4
  140. package/lib/module/contexts/messageComposerContext/MessageComposerContext.js.map +1 -1
  141. package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
  142. package/lib/module/contexts/themeContext/utils/theme.js +1 -0
  143. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  144. package/lib/module/hooks/messagePreview/useMessagePreviewText.js +4 -4
  145. package/lib/module/hooks/messagePreview/useMessagePreviewText.js.map +1 -1
  146. package/lib/module/i18n/en.json +3 -2
  147. package/lib/module/i18n/es.json +3 -2
  148. package/lib/module/i18n/fr.json +3 -2
  149. package/lib/module/i18n/he.json +3 -2
  150. package/lib/module/i18n/hi.json +3 -2
  151. package/lib/module/i18n/it.json +3 -2
  152. package/lib/module/i18n/ja.json +3 -2
  153. package/lib/module/i18n/ko.json +3 -2
  154. package/lib/module/i18n/nl.json +3 -2
  155. package/lib/module/i18n/pt-br.json +3 -2
  156. package/lib/module/i18n/ru.json +3 -2
  157. package/lib/module/i18n/tr.json +3 -2
  158. package/lib/module/version.json +1 -1
  159. package/lib/typescript/components/Attachment/Giphy/Giphy.d.ts +1 -1
  160. package/lib/typescript/components/Attachment/Giphy/Giphy.d.ts.map +1 -1
  161. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerGenericContent.d.ts.map +1 -1
  162. package/lib/typescript/components/AutoCompleteInput/AutoCompleteSuggestionList.d.ts.map +1 -1
  163. package/lib/typescript/components/ChannelList/hooks/useChannelActionItems.d.ts.map +1 -1
  164. package/lib/typescript/components/ChannelPreview/ChannelDetailsBottomSheet.d.ts +2 -2
  165. package/lib/typescript/components/ChannelPreview/ChannelDetailsBottomSheet.d.ts.map +1 -1
  166. package/lib/typescript/components/ChannelPreview/ChannelPreviewMessage.d.ts.map +1 -1
  167. package/lib/typescript/components/ChannelPreview/ChannelPreviewStatus.d.ts +1 -1
  168. package/lib/typescript/components/ChannelPreview/ChannelPreviewStatus.d.ts.map +1 -1
  169. package/lib/typescript/components/ChannelPreview/ChannelPreviewView.d.ts +2 -2
  170. package/lib/typescript/components/ChannelPreview/ChannelPreviewView.d.ts.map +1 -1
  171. package/lib/typescript/components/ChannelPreview/ChannelSwipableWrapper.d.ts +3 -3
  172. package/lib/typescript/components/ChannelPreview/ChannelSwipableWrapper.d.ts.map +1 -1
  173. package/lib/typescript/components/ImageGallery/components/ImageGrid.d.ts.map +1 -1
  174. package/lib/typescript/components/Indicators/LoadingIndicator.d.ts.map +1 -1
  175. package/lib/typescript/components/Message/Message.d.ts.map +1 -1
  176. package/lib/typescript/components/Message/MessageItemView/MessageContent.d.ts.map +1 -1
  177. package/lib/typescript/components/Message/MessageItemView/MessageItemView.d.ts +1 -1
  178. package/lib/typescript/components/Message/MessageItemView/MessageItemView.d.ts.map +1 -1
  179. package/lib/typescript/components/Message/MessageItemView/MessageStatus.d.ts.map +1 -1
  180. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
  181. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts.map +1 -1
  182. package/lib/typescript/components/MessageInput/ShowThreadMessageInChannelButton.d.ts.map +1 -1
  183. package/lib/typescript/components/MessageMenu/MessageUserReactions.d.ts.map +1 -1
  184. package/lib/typescript/components/Poll/components/MultipleVotesSettings.d.ts.map +1 -1
  185. package/lib/typescript/components/Poll/components/PollOption.d.ts.map +1 -1
  186. package/lib/typescript/components/ThreadList/ThreadList.d.ts.map +1 -1
  187. package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts +5 -1
  188. package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts.map +1 -1
  189. package/lib/typescript/components/UIComponents/BottomSheetModal.utils.d.ts +28 -0
  190. package/lib/typescript/components/UIComponents/BottomSheetModal.utils.d.ts.map +1 -0
  191. package/lib/typescript/components/UIComponents/StreamBottomSheetModalFlatList.d.ts.map +1 -1
  192. package/lib/typescript/components/ui/Avatar/ChannelAvatar.d.ts.map +1 -1
  193. package/lib/typescript/contexts/bottomSheetContext/BottomSheetContext.d.ts +1 -0
  194. package/lib/typescript/contexts/bottomSheetContext/BottomSheetContext.d.ts.map +1 -1
  195. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +4 -2
  196. package/lib/typescript/contexts/messageContext/MessageContext.d.ts.map +1 -1
  197. package/lib/typescript/contexts/themeContext/ThemeContext.d.ts +1 -0
  198. package/lib/typescript/contexts/themeContext/ThemeContext.d.ts.map +1 -1
  199. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +1 -0
  200. package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
  201. package/lib/typescript/hooks/messagePreview/useMessagePreviewText.d.ts.map +1 -1
  202. package/lib/typescript/i18n/en.json +3 -2
  203. package/lib/typescript/i18n/es.json +3 -2
  204. package/lib/typescript/i18n/fr.json +3 -2
  205. package/lib/typescript/i18n/he.json +3 -2
  206. package/lib/typescript/i18n/hi.json +3 -2
  207. package/lib/typescript/i18n/it.json +3 -2
  208. package/lib/typescript/i18n/ja.json +3 -2
  209. package/lib/typescript/i18n/ko.json +3 -2
  210. package/lib/typescript/i18n/nl.json +3 -2
  211. package/lib/typescript/i18n/pt-br.json +3 -2
  212. package/lib/typescript/i18n/ru.json +3 -2
  213. package/lib/typescript/i18n/tr.json +3 -2
  214. package/lib/typescript/utils/i18n/Streami18n.d.ts +3 -2
  215. package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
  216. package/package.json +1 -1
  217. package/src/components/Attachment/Giphy/Giphy.tsx +19 -7
  218. package/src/components/Attachment/__tests__/Giphy.test.js +33 -1
  219. package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx +3 -3
  220. package/src/components/AttachmentPicker/components/AttachmentPickerGenericContent.tsx +23 -13
  221. package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx +3 -1
  222. package/src/components/Channel/Channel.tsx +1 -1
  223. package/src/components/ChannelList/hooks/__tests__/useChannelActionItems.test.tsx +12 -45
  224. package/src/components/ChannelList/hooks/useChannelActionItems.tsx +1 -19
  225. package/src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx +10 -8
  226. package/src/components/ChannelPreview/ChannelPreviewMessage.tsx +3 -1
  227. package/src/components/ChannelPreview/ChannelPreviewStatus.tsx +1 -1
  228. package/src/components/ChannelPreview/ChannelPreviewView.tsx +3 -2
  229. package/src/components/ChannelPreview/ChannelSwipableWrapper.tsx +8 -7
  230. package/src/components/ChannelPreview/__tests__/ChannelDetailsBottomSheet.test.tsx +1 -1
  231. package/src/components/ChannelPreview/__tests__/ChannelLastMessagePreview.test.tsx +32 -0
  232. package/src/components/ChannelPreview/__tests__/ChannelSwipableWrapper.test.tsx +5 -2
  233. package/src/components/ImageGallery/components/ImageGrid.tsx +3 -1
  234. package/src/components/Indicators/LoadingIndicator.tsx +7 -5
  235. package/src/components/Message/Message.tsx +2 -12
  236. package/src/components/Message/MessageItemView/MessageContent.tsx +44 -7
  237. package/src/components/Message/MessageItemView/MessageItemView.tsx +15 -7
  238. package/src/components/Message/MessageItemView/MessageReplies.tsx +1 -1
  239. package/src/components/Message/MessageItemView/MessageStatus.tsx +16 -5
  240. package/src/components/Message/MessageItemView/__tests__/MessageContent.test.js +72 -1
  241. package/src/components/Message/MessageItemView/__tests__/MessageItemView.test.js +52 -1
  242. package/src/components/Message/hooks/useCreateMessageContext.ts +3 -0
  243. package/src/components/MessageInput/ShowThreadMessageInChannelButton.tsx +1 -0
  244. package/src/components/MessageInput/__tests__/__snapshots__/AttachButton.test.js.snap +1 -1
  245. package/src/components/MessageMenu/MessageUserReactions.tsx +1 -5
  246. package/src/components/Poll/components/MultipleVotesSettings.tsx +8 -0
  247. package/src/components/Poll/components/PollInputDialog.tsx +1 -1
  248. package/src/components/Poll/components/PollOption.tsx +25 -9
  249. package/src/components/ThreadList/ThreadList.tsx +1 -1
  250. package/src/components/UIComponents/BottomSheetModal.tsx +237 -53
  251. package/src/components/UIComponents/BottomSheetModal.utils.ts +82 -0
  252. package/src/components/UIComponents/StreamBottomSheetModalFlatList.tsx +14 -5
  253. package/src/components/UIComponents/__tests__/BottomSheetModal.utils.test.ts +111 -0
  254. package/src/components/ui/Avatar/ChannelAvatar.tsx +5 -1
  255. package/src/components/ui/Button/hooks/useButtonStyles.ts +1 -1
  256. package/src/contexts/bottomSheetContext/BottomSheetContext.tsx +1 -0
  257. package/src/contexts/messageComposerContext/MessageComposerContext.tsx +1 -1
  258. package/src/contexts/messageContext/MessageContext.tsx +4 -2
  259. package/src/contexts/themeContext/utils/theme.ts +2 -0
  260. package/src/hooks/messagePreview/useMessagePreviewText.tsx +5 -6
  261. package/src/i18n/en.json +3 -2
  262. package/src/i18n/es.json +3 -2
  263. package/src/i18n/fr.json +3 -2
  264. package/src/i18n/he.json +3 -2
  265. package/src/i18n/hi.json +3 -2
  266. package/src/i18n/it.json +3 -2
  267. package/src/i18n/ja.json +3 -2
  268. package/src/i18n/ko.json +3 -2
  269. package/src/i18n/nl.json +3 -2
  270. package/src/i18n/pt-br.json +3 -2
  271. package/src/i18n/ru.json +3 -2
  272. package/src/i18n/tr.json +3 -2
  273. package/src/version.json +1 -1
@@ -1800,7 +1800,7 @@ exports[`AttachButton should render an disabled AttachButton 1`] = `
1800
1800
  },
1801
1801
  {
1802
1802
  "backgroundColor": undefined,
1803
- "borderColor": "#d5dbe1",
1803
+ "borderColor": "#ebeef1",
1804
1804
  "borderWidth": 1,
1805
1805
  "height": 48,
1806
1806
  "width": 48,
@@ -280,11 +280,7 @@ export const MessageUserReactions = (props: MessageUserReactionsProps) => {
280
280
  <EmojiPickerList onSelectReaction={handleSelectReaction} renderFullInitially={false} />
281
281
  </Animated.View>
282
282
  ) : (
283
- <Animated.View
284
- key={'reaction-details'}
285
- entering={FadeIn.duration(200)}
286
- exiting={FadeOut.duration(200)}
287
- >
283
+ <Animated.View key={'reaction-details'} exiting={FadeOut.duration(200)}>
288
284
  <Text style={[styles.reactionsText, reactionsText]}>
289
285
  {t('{{count}} Reactions', { count: totalReactionCount })}
290
286
  </Text>
@@ -169,6 +169,7 @@ export const MultipleVotesSettings = () => {
169
169
  LeadingIcon={Minus}
170
170
  onPress={decrementMaxVotes}
171
171
  disabled={decrementDisabled}
172
+ style={decrementDisabled ? styles.buttonDisabled : styles.buttonEnabled}
172
173
  testID='max-votes-decrement'
173
174
  />
174
175
  <MaxVotesTextInput />
@@ -180,6 +181,7 @@ export const MultipleVotesSettings = () => {
180
181
  LeadingIcon={Plus}
181
182
  onPress={incrementMaxVotes}
182
183
  disabled={incrementDisabled}
184
+ style={incrementDisabled ? styles.buttonDisabled : styles.buttonEnabled}
183
185
  testID='max-votes-increment'
184
186
  />
185
187
  </Animated.View>
@@ -235,6 +237,12 @@ const useStyles = () => {
235
237
  paddingVertical: primitives.spacingMd,
236
238
  textAlign: I18nManager.isRTL ? 'right' : 'left',
237
239
  },
240
+ buttonEnabled: {
241
+ borderColor: semantics.borderCoreOnSurface,
242
+ },
243
+ buttonDisabled: {
244
+ borderColor: semantics.borderUtilityDisabledOnSurface,
245
+ },
238
246
  });
239
247
  }, [semantics]);
240
248
  };
@@ -81,7 +81,7 @@ export const PollInputDialog = ({
81
81
  style={styles.button}
82
82
  />
83
83
  <Button
84
- variant={'secondary'}
84
+ variant={'primary'}
85
85
  type={'solid'}
86
86
  label={t('Send')}
87
87
  size='md'
@@ -124,14 +124,18 @@ export const PollOption = ({ option, showProgressBar = true, forceIncoming }: Po
124
124
  <VoteButton option={option} />
125
125
  <View style={[styles.info, info]}>
126
126
  <View style={[styles.header, header]}>
127
- <Text style={[styles.text, text]}>{option.text}</Text>
127
+ <Text ellipsizeMode='tail' numberOfLines={2} style={[styles.text, text]}>
128
+ {option.text}
129
+ </Text>
128
130
  <View style={[styles.votesContainer, votesContainer]}>
129
- <UserAvatarStack
130
- users={relevantVotes.map((vote: PollVote) => vote.user as UserResponse)}
131
- overlap={0.2}
132
- maxVisible={3}
133
- avatarSize='xs'
134
- />
131
+ {relevantVotes.length > 0 ? (
132
+ <UserAvatarStack
133
+ users={relevantVotes.map((vote: PollVote) => vote.user as UserResponse)}
134
+ overlap={0.2}
135
+ maxVisible={3}
136
+ avatarSize='xs'
137
+ />
138
+ ) : null}
135
139
 
136
140
  <Text style={[styles.votesText, votesText]}>{voteCountsByOption[option.id] || 0}</Text>
137
141
  </View>
@@ -223,10 +227,14 @@ const useStyles = () => {
223
227
  },
224
228
  header: {
225
229
  flexDirection: 'row',
226
- justifyContent: 'space-between',
230
+ alignItems: 'flex-start',
231
+ gap: primitives.spacingXs,
232
+ minWidth: 0,
227
233
  },
228
234
  text: {
229
235
  color: semantics.chatTextIncoming,
236
+ flexGrow: 1,
237
+ flexShrink: 1,
230
238
  fontSize: primitives.typographyFontSizeSm,
231
239
  fontWeight: primitives.typographyFontWeightRegular,
232
240
  lineHeight: primitives.typographyLineHeightTight,
@@ -234,9 +242,17 @@ const useStyles = () => {
234
242
  },
235
243
  info: {
236
244
  flexGrow: 1,
245
+ flexShrink: 1,
246
+ gap: primitives.spacingXs,
247
+ minWidth: 0,
248
+ },
249
+ votesContainer: {
250
+ alignItems: 'center',
251
+ flexDirection: 'row',
252
+ flexShrink: 0,
237
253
  gap: primitives.spacingXs,
254
+ minHeight: 20,
238
255
  },
239
- votesContainer: { flexDirection: 'row', gap: primitives.spacingXs, alignItems: 'center' },
240
256
  votesText: {
241
257
  color: semantics.chatTextIncoming,
242
258
  fontSize: primitives.typographyFontSizeXs,
@@ -45,7 +45,7 @@ export const DefaultThreadListLoadingIndicator = () => (
45
45
  ))}
46
46
  </View>
47
47
  );
48
- export const DefaultThreadListLoadingNextIndicator = () => <LoadingIndicator />;
48
+ export const DefaultThreadListLoadingNextIndicator = () => <LoadingIndicator listType='threads' />;
49
49
 
50
50
  const renderItem = (props: { item: Thread }) => <ThreadListItem thread={props.item} />;
51
51
 
@@ -10,6 +10,7 @@ import {
10
10
  EventSubscription,
11
11
  Keyboard,
12
12
  KeyboardEvent,
13
+ LayoutChangeEvent,
13
14
  Modal,
14
15
  Platform,
15
16
  Pressable,
@@ -23,12 +24,20 @@ import Animated, {
23
24
  Easing,
24
25
  FadeIn,
25
26
  runOnJS,
27
+ useAnimatedReaction,
26
28
  useAnimatedStyle,
29
+ useDerivedValue,
27
30
  useSharedValue,
28
31
  withTiming,
29
32
  } from 'react-native-reanimated';
30
33
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
31
34
 
35
+ import {
36
+ getBottomSheetBaseHeight,
37
+ getBottomSheetSnapPointTranslateY,
38
+ getBottomSheetTopSnapIndex,
39
+ } from './BottomSheetModal.utils';
40
+
32
41
  import { BottomSheetProvider } from '../../contexts/bottomSheetContext/BottomSheetContext';
33
42
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
34
43
  import { useStableCallback } from '../../hooks';
@@ -49,6 +58,10 @@ export type BottomSheetModalProps = {
49
58
  * The height of the modal.
50
59
  */
51
60
  height?: number;
61
+ /**
62
+ * Whether the sheet should wrap its content up to the provided `height`.
63
+ */
64
+ enableDynamicSizing?: boolean;
52
65
  /**
53
66
  * Whether the sheet content should be lazy loaded or not. Particularly
54
67
  * useful when the content is something heavy and we don't want to disrupt
@@ -57,10 +70,17 @@ export type BottomSheetModalProps = {
57
70
  lazy?: boolean;
58
71
  };
59
72
 
60
- export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>) => {
73
+ const BottomSheetModalInner = (props: PropsWithChildren<BottomSheetModalProps>) => {
61
74
  const { height: windowHeight } = useWindowDimensions();
62
75
  const { top: topInset, bottom: bottomInset } = useSafeAreaInsets();
63
- const { children, height = windowHeight / 2, onClose, visible, lazy = false } = props;
76
+ const {
77
+ children,
78
+ enableDynamicSizing = false,
79
+ height = windowHeight / 2,
80
+ onClose,
81
+ visible,
82
+ lazy = false,
83
+ } = props;
64
84
 
65
85
  const {
66
86
  theme: {
@@ -73,12 +93,26 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
73
93
  0,
74
94
  windowHeight - topInset - (Platform.OS === 'android' ? bottomInset + 16 : 0),
75
95
  );
96
+ const fixedBaseHeight = Math.min(height, maxHeight);
76
97
 
77
- const baseHeight = Math.min(height, maxHeight);
78
- const snapPoints = useMemo(() => [baseHeight, maxHeight], [baseHeight, maxHeight]);
79
- const snapPointsTranslateY = useMemo(
80
- () => snapPoints.map((point) => maxHeight - point),
81
- [maxHeight, snapPoints],
98
+ const contentHeight = useSharedValue<number | undefined>(undefined);
99
+ const baseHeight = useDerivedValue(
100
+ () =>
101
+ getBottomSheetBaseHeight({
102
+ contentHeight: contentHeight.value,
103
+ enableDynamicSizing,
104
+ height,
105
+ maxHeight,
106
+ }),
107
+ [contentHeight, enableDynamicSizing, height, maxHeight],
108
+ );
109
+ const topSnapIndex = useDerivedValue<number>(
110
+ () =>
111
+ getBottomSheetTopSnapIndex({
112
+ baseHeight: baseHeight.value,
113
+ maxHeight,
114
+ }),
115
+ [baseHeight, maxHeight],
82
116
  );
83
117
 
84
118
  const sheetTranslateY = useSharedValue(maxHeight);
@@ -100,6 +134,36 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
100
134
  }
101
135
  });
102
136
 
137
+ const handleDynamicContentLayout = useStableCallback((event: LayoutChangeEvent) => {
138
+ if (!enableDynamicSizing) {
139
+ return;
140
+ }
141
+
142
+ const nextContentHeight = Math.ceil(event.nativeEvent.layout.height);
143
+
144
+ if (contentHeight.value === nextContentHeight) {
145
+ return;
146
+ }
147
+
148
+ contentHeight.value = nextContentHeight;
149
+ });
150
+
151
+ const open = useStableCallback((shouldShowContentAfterOpen = true) => {
152
+ sheetTranslateY.value = withTiming(
153
+ maxHeight - fixedBaseHeight,
154
+ { duration: 250, easing: Easing.out(Easing.cubic) },
155
+ (finished) => {
156
+ if (!finished) return;
157
+
158
+ isOpening.value = false;
159
+
160
+ if (shouldShowContentAfterOpen) {
161
+ runOnJS(showContent)();
162
+ }
163
+ },
164
+ );
165
+ });
166
+
103
167
  const finishClose = useStableCallback((closeAnimationFinishedCallback?: () => void) => {
104
168
  onClose();
105
169
  if (closeAnimationFinishedCallback) {
@@ -161,27 +225,66 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
161
225
  currentSnapIndex.value = 0;
162
226
  sheetTranslateY.value = maxHeight;
163
227
 
164
- sheetTranslateY.value = withTiming(
165
- snapPointsTranslateY[0],
166
- { duration: 250, easing: Easing.out(Easing.cubic) },
167
- (finished) => {
168
- if (!finished) return;
228
+ if (enableDynamicSizing) {
229
+ setRenderContent(true);
230
+ return;
231
+ }
169
232
 
170
- isOpening.value = false;
171
- runOnJS(showContent)();
172
- },
173
- );
233
+ open();
174
234
  }, [
235
+ enableDynamicSizing,
175
236
  visible,
176
237
  isOpen,
177
238
  isOpening,
178
239
  maxHeight,
179
- showContent,
240
+ open,
180
241
  sheetTranslateY,
181
242
  currentSnapIndex,
182
- snapPointsTranslateY,
183
243
  ]);
184
244
 
245
+ useAnimatedReaction(
246
+ () => {
247
+ if (
248
+ !visible ||
249
+ !enableDynamicSizing ||
250
+ !isOpening.value ||
251
+ contentHeight.value === undefined
252
+ ) {
253
+ return undefined;
254
+ }
255
+
256
+ return getBottomSheetSnapPointTranslateY({
257
+ baseHeight: baseHeight.value,
258
+ maxHeight,
259
+ snapIndex: 0,
260
+ });
261
+ },
262
+ (nextTranslateY, prevTranslateY) => {
263
+ if (nextTranslateY === undefined || nextTranslateY === prevTranslateY) {
264
+ return;
265
+ }
266
+
267
+ sheetTranslateY.value = withTiming(
268
+ nextTranslateY,
269
+ { duration: 250, easing: Easing.out(Easing.cubic) },
270
+ (finished) => {
271
+ if (finished) {
272
+ isOpening.value = false;
273
+ }
274
+ },
275
+ );
276
+ },
277
+ [
278
+ baseHeight,
279
+ contentHeight,
280
+ enableDynamicSizing,
281
+ isOpening,
282
+ maxHeight,
283
+ sheetTranslateY,
284
+ visible,
285
+ ],
286
+ );
287
+
185
288
  // if `visible` gets hard changed, we force a cleanup
186
289
  useEffect(() => {
187
290
  if (visible) return;
@@ -191,8 +294,10 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
191
294
  keyboardOffset.value = 0;
192
295
  currentSnapIndex.value = 0;
193
296
  sheetTranslateY.value = maxHeight;
297
+ contentHeight.value = undefined;
194
298
  setRenderContent(!lazy);
195
299
  }, [
300
+ contentHeight,
196
301
  visible,
197
302
  lazy,
198
303
  isOpen,
@@ -204,16 +309,52 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
204
309
  ]);
205
310
 
206
311
  // Keep the sheet aligned with the active snap if dimensions change while visible.
207
- useEffect(() => {
208
- if (!visible || !isOpen.value || isOpening.value) {
209
- return;
210
- }
211
-
212
- sheetTranslateY.value = withTiming(snapPointsTranslateY[currentSnapIndex.value], {
213
- duration: 250,
214
- easing: Easing.inOut(Easing.ease),
215
- });
216
- }, [visible, isOpen, isOpening, sheetTranslateY, currentSnapIndex, snapPointsTranslateY]);
312
+ useAnimatedReaction(
313
+ () => {
314
+ if (!visible || !isOpen.value || isOpening.value) {
315
+ return undefined;
316
+ }
317
+
318
+ const clampedSnapIndex = Math.min(currentSnapIndex.value, topSnapIndex.value);
319
+
320
+ return {
321
+ snapIndex: clampedSnapIndex,
322
+ translateY: getBottomSheetSnapPointTranslateY({
323
+ baseHeight: baseHeight.value,
324
+ maxHeight,
325
+ snapIndex: clampedSnapIndex,
326
+ }),
327
+ };
328
+ },
329
+ (nextTarget) => {
330
+ if (!nextTarget) {
331
+ return;
332
+ }
333
+
334
+ if (currentSnapIndex.value !== nextTarget.snapIndex) {
335
+ currentSnapIndex.value = nextTarget.snapIndex;
336
+ }
337
+
338
+ if (Math.abs(sheetTranslateY.value - nextTarget.translateY) < 1) {
339
+ return;
340
+ }
341
+
342
+ sheetTranslateY.value = withTiming(nextTarget.translateY, {
343
+ duration: 250,
344
+ easing: Easing.inOut(Easing.ease),
345
+ });
346
+ },
347
+ [
348
+ baseHeight,
349
+ currentSnapIndex,
350
+ isOpen,
351
+ isOpening,
352
+ maxHeight,
353
+ sheetTranslateY,
354
+ topSnapIndex,
355
+ visible,
356
+ ],
357
+ );
217
358
 
218
359
  const animateKeyboardOffset = useStableCallback((offset: number) => {
219
360
  keyboardOffset.value = withTiming(offset, {
@@ -258,10 +399,10 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
258
399
 
259
400
  const overlayAnimatedStyle = useAnimatedStyle(() => {
260
401
  const visibleHeight = Math.max(0, maxHeight - sheetTranslateY.value);
261
- const threshold = Math.max(1, Math.min(baseHeight, maxHeight));
402
+ const threshold = Math.max(1, Math.min(baseHeight.value, maxHeight));
262
403
  const progress = Math.min(1, visibleHeight / threshold);
263
404
  return { opacity: progress };
264
- });
405
+ }, [baseHeight, maxHeight]);
265
406
 
266
407
  const panGesture = useMemo(
267
408
  () =>
@@ -275,11 +416,24 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
275
416
  sheetTranslateY.value = Math.min(Math.max(nextTranslateY, 0), maxHeight);
276
417
  })
277
418
  .onEnd((event) => {
278
- const openTranslateY = snapPointsTranslateY[currentSnapIndex.value];
419
+ const openTranslateY = getBottomSheetSnapPointTranslateY({
420
+ baseHeight: baseHeight.value,
421
+ maxHeight,
422
+ snapIndex: currentSnapIndex.value,
423
+ });
279
424
  const draggedDown = Math.max(sheetTranslateY.value - openTranslateY, 0);
280
- const topSnapIndex = snapPoints.length - 1;
281
- const isAtTopSnap = currentSnapIndex.value === topSnapIndex;
282
- const snap0TranslateY = snapPointsTranslateY[0];
425
+ const hasMultipleSnapPoints = topSnapIndex.value > 0;
426
+ const isAtTopSnap = currentSnapIndex.value === topSnapIndex.value;
427
+ const snap0TranslateY = getBottomSheetSnapPointTranslateY({
428
+ baseHeight: baseHeight.value,
429
+ maxHeight,
430
+ snapIndex: 0,
431
+ });
432
+ const topSnapTranslateY = getBottomSheetSnapPointTranslateY({
433
+ baseHeight: baseHeight.value,
434
+ maxHeight,
435
+ snapIndex: topSnapIndex.value,
436
+ });
283
437
  const projectedTranslateY = sheetTranslateY.value + event.velocityY * 0.2;
284
438
 
285
439
  const shouldCloseFromLowerSnap = event.velocityY > 500 || draggedDown > maxHeight / 2;
@@ -287,49 +441,61 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
287
441
  event.velocityY > 2200 ||
288
442
  projectedTranslateY > snap0TranslateY + (maxHeight - snap0TranslateY) * 0.96;
289
443
 
290
- const shouldClose = isAtTopSnap ? shouldCloseFromTopSnap : shouldCloseFromLowerSnap;
444
+ const shouldClose = !hasMultipleSnapPoints
445
+ ? shouldCloseFromLowerSnap
446
+ : isAtTopSnap
447
+ ? shouldCloseFromTopSnap
448
+ : shouldCloseFromLowerSnap;
291
449
 
292
450
  if (shouldClose) {
293
451
  runOnJS(closeFromGesture)();
294
452
  } else {
295
453
  isOpen.value = true;
296
454
  let nearestIndex = 0;
297
- let minDistance = Number.POSITIVE_INFINITY;
298
- for (let i = 0; i < snapPointsTranslateY.length; i += 1) {
299
- const candidate = snapPointsTranslateY[i];
300
- const distance = Math.abs(sheetTranslateY.value - candidate);
301
- if (distance < minDistance) {
302
- minDistance = distance;
303
- nearestIndex = i;
455
+ let minDistance = Math.abs(sheetTranslateY.value - snap0TranslateY);
456
+
457
+ if (hasMultipleSnapPoints) {
458
+ const topDistance = Math.abs(sheetTranslateY.value - topSnapTranslateY);
459
+ if (topDistance < minDistance) {
460
+ minDistance = topDistance;
461
+ nearestIndex = topSnapIndex.value;
304
462
  }
305
463
  }
464
+
306
465
  // velocity-based snapping, fast upward swipe goes to top snap point
307
- if (event.velocityY < -800) {
308
- nearestIndex = snapPointsTranslateY.length - 1;
466
+ if (hasMultipleSnapPoints && event.velocityY < -800) {
467
+ nearestIndex = topSnapIndex.value;
309
468
  }
310
469
  // From top snap, a gentle downward flick should settle to snap 0
311
470
  // without requiring a large drag distance.
312
- if (isAtTopSnap && event.velocityY > 120) {
471
+ if (hasMultipleSnapPoints && isAtTopSnap && event.velocityY > 120) {
313
472
  nearestIndex = 0;
314
473
  }
315
474
 
316
475
  currentSnapIndex.value = nearestIndex;
317
- sheetTranslateY.value = withTiming(snapPointsTranslateY[nearestIndex], {
318
- duration: 250,
319
- easing: Easing.inOut(Easing.ease),
320
- });
476
+ sheetTranslateY.value = withTiming(
477
+ getBottomSheetSnapPointTranslateY({
478
+ baseHeight: baseHeight.value,
479
+ maxHeight,
480
+ snapIndex: nearestIndex,
481
+ }),
482
+ {
483
+ duration: 250,
484
+ easing: Easing.inOut(Easing.ease),
485
+ },
486
+ );
321
487
  }
322
488
  }),
323
489
  [
490
+ baseHeight,
324
491
  currentSnapIndex,
325
492
  isOpen,
326
493
  maxHeight,
327
494
  closeFromGesture,
328
495
  panStartTranslateY,
329
496
  renderContent,
330
- snapPoints,
331
- snapPointsTranslateY,
332
497
  sheetTranslateY,
498
+ topSnapIndex,
333
499
  ],
334
500
  );
335
501
 
@@ -339,8 +505,9 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
339
505
  () => ({
340
506
  close,
341
507
  currentSnapIndex,
508
+ topSnapIndex,
342
509
  }),
343
- [close, currentSnapIndex],
510
+ [close, currentSnapIndex, topSnapIndex],
344
511
  );
345
512
 
346
513
  return (
@@ -364,7 +531,16 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
364
531
  entering={FadeIn.duration(250)}
365
532
  style={styles.sheetContentContainer}
366
533
  >
367
- {children}
534
+ {enableDynamicSizing ? (
535
+ <View
536
+ onLayout={handleDynamicContentLayout}
537
+ style={{ paddingBottom: bottomInset }}
538
+ >
539
+ {children}
540
+ </View>
541
+ ) : (
542
+ children
543
+ )}
368
544
  </Animated.View>
369
545
  </BottomSheetProvider>
370
546
  ) : null}
@@ -378,6 +554,14 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
378
554
  );
379
555
  };
380
556
 
557
+ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>) => {
558
+ if (!props.visible) {
559
+ return null;
560
+ }
561
+
562
+ return <BottomSheetModalInner {...props} />;
563
+ };
564
+
381
565
  const useStyles = () => {
382
566
  const {
383
567
  theme: { semantics },
@@ -0,0 +1,82 @@
1
+ export const BOTTOM_SHEET_HANDLE_HEIGHT = 4;
2
+ export const BOTTOM_SHEET_HANDLE_MARGIN_VERTICAL = 8;
3
+ export const BOTTOM_SHEET_HANDLE_TOTAL_HEIGHT =
4
+ BOTTOM_SHEET_HANDLE_HEIGHT + BOTTOM_SHEET_HANDLE_MARGIN_VERTICAL * 2;
5
+
6
+ type GetBottomSheetBaseHeightParams = {
7
+ contentHeight: number | undefined;
8
+ enableDynamicSizing: boolean;
9
+ height: number;
10
+ maxHeight: number;
11
+ };
12
+
13
+ export const getBottomSheetBaseHeight = ({
14
+ contentHeight,
15
+ enableDynamicSizing,
16
+ height,
17
+ maxHeight,
18
+ }: GetBottomSheetBaseHeightParams) => {
19
+ 'worklet';
20
+
21
+ const cappedHeight = Math.min(height, maxHeight);
22
+
23
+ if (!enableDynamicSizing || contentHeight === undefined) {
24
+ return cappedHeight;
25
+ }
26
+
27
+ const measuredHeight = Math.max(0, contentHeight) + BOTTOM_SHEET_HANDLE_TOTAL_HEIGHT;
28
+
29
+ return Math.min(measuredHeight, cappedHeight);
30
+ };
31
+
32
+ type GetBottomSheetSnapPointsParams = {
33
+ baseHeight: number;
34
+ maxHeight: number;
35
+ };
36
+
37
+ export const getBottomSheetSnapPoints = ({
38
+ baseHeight,
39
+ maxHeight,
40
+ }: GetBottomSheetSnapPointsParams) => {
41
+ 'worklet';
42
+
43
+ if (baseHeight === maxHeight) {
44
+ return [baseHeight];
45
+ }
46
+
47
+ return [baseHeight, maxHeight];
48
+ };
49
+
50
+ type GetBottomSheetTopSnapIndexParams = {
51
+ baseHeight: number;
52
+ maxHeight: number;
53
+ };
54
+
55
+ export const getBottomSheetTopSnapIndex = ({
56
+ baseHeight,
57
+ maxHeight,
58
+ }: GetBottomSheetTopSnapIndexParams) => {
59
+ 'worklet';
60
+
61
+ return baseHeight === maxHeight ? 0 : 1;
62
+ };
63
+
64
+ type GetBottomSheetSnapPointTranslateYParams = {
65
+ baseHeight: number;
66
+ maxHeight: number;
67
+ snapIndex: number;
68
+ };
69
+
70
+ export const getBottomSheetSnapPointTranslateY = ({
71
+ baseHeight,
72
+ maxHeight,
73
+ snapIndex,
74
+ }: GetBottomSheetSnapPointTranslateYParams) => {
75
+ 'worklet';
76
+
77
+ if (getBottomSheetTopSnapIndex({ baseHeight, maxHeight }) === 0) {
78
+ return 0;
79
+ }
80
+
81
+ return snapIndex <= 0 ? maxHeight - baseHeight : 0;
82
+ };
@@ -12,7 +12,7 @@ export const StreamBottomSheetModalFlatList = <ItemT,>({
12
12
  scrollEnabled: scrollEnabledProp,
13
13
  ...props
14
14
  }: StreamBottomSheetModalFlatListProps<ItemT>) => {
15
- const { currentSnapIndex } = useBottomSheetContext();
15
+ const { currentSnapIndex, topSnapIndex } = useBottomSheetContext();
16
16
  const listRef = useRef<FlatList<ItemT>>(null);
17
17
 
18
18
  const setNativeScrollEnabled = useStableCallback((value: boolean) =>
@@ -20,14 +20,23 @@ export const StreamBottomSheetModalFlatList = <ItemT,>({
20
20
  );
21
21
 
22
22
  useAnimatedReaction(
23
- () => currentSnapIndex.value,
23
+ () => ({
24
+ currentSnapIndex: currentSnapIndex.value,
25
+ topSnapIndex: topSnapIndex.value,
26
+ }),
24
27
  (value, prev) => {
25
- if (value === prev || scrollEnabledProp !== undefined) {
28
+ if (
29
+ scrollEnabledProp !== undefined ||
30
+ (prev &&
31
+ value.currentSnapIndex === prev.currentSnapIndex &&
32
+ value.topSnapIndex === prev.topSnapIndex)
33
+ ) {
26
34
  return;
27
35
  }
28
- runOnJS(setNativeScrollEnabled)(value === 1);
36
+
37
+ runOnJS(setNativeScrollEnabled)(value.currentSnapIndex === value.topSnapIndex);
29
38
  },
30
- [currentSnapIndex],
39
+ [currentSnapIndex, topSnapIndex],
31
40
  );
32
41
 
33
42
  return <FlatList ref={listRef} {...props} scrollEnabled={false} />;