@planningcenter/chat-react-native 3.21.2-rc.5 → 3.22.0-rc.1

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 (58) hide show
  1. package/build/components/conversation/attachments/attachment_card.js +1 -0
  2. package/build/components/conversation/attachments/attachment_card.js.map +1 -1
  3. package/build/components/conversation/attachments/attachment_deleting_overlay.d.ts +3 -0
  4. package/build/components/conversation/attachments/attachment_deleting_overlay.d.ts.map +1 -0
  5. package/build/components/conversation/attachments/attachment_deleting_overlay.js +29 -0
  6. package/build/components/conversation/attachments/attachment_deleting_overlay.js.map +1 -0
  7. package/build/components/conversation/attachments/audio_attachment.d.ts +2 -1
  8. package/build/components/conversation/attachments/audio_attachment.d.ts.map +1 -1
  9. package/build/components/conversation/attachments/audio_attachment.js +5 -3
  10. package/build/components/conversation/attachments/audio_attachment.js.map +1 -1
  11. package/build/components/conversation/attachments/generic_file_attachment.d.ts +2 -1
  12. package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -1
  13. package/build/components/conversation/attachments/generic_file_attachment.js +4 -2
  14. package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -1
  15. package/build/components/conversation/attachments/image_attachment.d.ts +2 -1
  16. package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -1
  17. package/build/components/conversation/attachments/image_attachment.js +9 -4
  18. package/build/components/conversation/attachments/image_attachment.js.map +1 -1
  19. package/build/components/conversation/attachments/video_attachment.d.ts +2 -1
  20. package/build/components/conversation/attachments/video_attachment.d.ts.map +1 -1
  21. package/build/components/conversation/attachments/video_attachment.js +5 -3
  22. package/build/components/conversation/attachments/video_attachment.js.map +1 -1
  23. package/build/components/conversation/message.d.ts.map +1 -1
  24. package/build/components/conversation/message.js +7 -3
  25. package/build/components/conversation/message.js.map +1 -1
  26. package/build/components/conversation/message_attachments.d.ts.map +1 -1
  27. package/build/components/conversation/message_attachments.js +8 -6
  28. package/build/components/conversation/message_attachments.js.map +1 -1
  29. package/build/hooks/index.d.ts +1 -0
  30. package/build/hooks/index.d.ts.map +1 -1
  31. package/build/hooks/index.js +1 -0
  32. package/build/hooks/index.js.map +1 -1
  33. package/build/hooks/use_deleting_ids.d.ts +4 -0
  34. package/build/hooks/use_deleting_ids.d.ts.map +1 -0
  35. package/build/hooks/use_deleting_ids.js +19 -0
  36. package/build/hooks/use_deleting_ids.js.map +1 -0
  37. package/build/screens/attachment_actions/attachment_actions_screen.d.ts.map +1 -1
  38. package/build/screens/attachment_actions/attachment_actions_screen.js +9 -2
  39. package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
  40. package/build/screens/attachment_actions/hooks/useDeleteAttachment.d.ts.map +1 -1
  41. package/build/screens/attachment_actions/hooks/useDeleteAttachment.js +1 -3
  42. package/build/screens/attachment_actions/hooks/useDeleteAttachment.js.map +1 -1
  43. package/build/screens/message_actions_screen.js +10 -3
  44. package/build/screens/message_actions_screen.js.map +1 -1
  45. package/package.json +2 -2
  46. package/src/components/conversation/attachments/attachment_card.tsx +1 -0
  47. package/src/components/conversation/attachments/attachment_deleting_overlay.tsx +34 -0
  48. package/src/components/conversation/attachments/audio_attachment.tsx +7 -2
  49. package/src/components/conversation/attachments/generic_file_attachment.tsx +6 -1
  50. package/src/components/conversation/attachments/image_attachment.tsx +11 -3
  51. package/src/components/conversation/attachments/video_attachment.tsx +7 -2
  52. package/src/components/conversation/message.tsx +11 -7
  53. package/src/components/conversation/message_attachments.tsx +9 -0
  54. package/src/hooks/index.ts +1 -0
  55. package/src/hooks/use_deleting_ids.ts +22 -0
  56. package/src/screens/attachment_actions/attachment_actions_screen.tsx +9 -2
  57. package/src/screens/attachment_actions/hooks/useDeleteAttachment.tsx +1 -3
  58. package/src/screens/message_actions_screen.tsx +10 -3
@@ -1 +1 @@
1
- {"version":3,"file":"message_actions_screen.js","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM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AChB,cAAc,EAAE,QAAQ;YACxB,QAAQ,EAAE,QAAQ;SACnB;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,EAAE;SACb;QACD,OAAO,EAAE;YACP,UAAU,EAAE,CAAC;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { useMutation } from '@tanstack/react-query'\nimport { isNil, omitBy } from 'lodash'\nimport React, { useCallback } from 'react'\nimport { Alert, Platform, StyleSheet, View } from 'react-native'\nimport { Text } from '../components'\nimport { useReactionStyles } from '../components/conversation/message_reaction'\nimport { REACTION_EMOJIS } from '../utils'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCreateAndroidRippleColor, useFontScale, useTheme } from '../hooks'\nimport { useApiClient } from '../hooks/use_api_client'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { Clipboard, Haptic } from '../utils/native_adapters'\nimport { MessageResource } from '../types'\nimport { availableFeatures, useFeatures } from '../hooks/use_features'\n\nexport const MessageActionsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: [0.5],\n headerTitle: 'Message actions',\n})\n\nexport type MessageActionsScreenProps = StaticScreenProps<{\n message_id: string\n reply_root_author_name?: string\n conversation_id: number\n canDeleteNonAuthoredMessages?: boolean\n inReplyScreen?: boolean\n}>\n\nexport function MessageActionsScreen({ route }: MessageActionsScreenProps) {\n const {\n conversation_id,\n message_id,\n canDeleteNonAuthoredMessages,\n inReplyScreen,\n reply_root_author_name,\n } = route.params\n\n const { messages, refetch } = useConversationMessages(\n { conversation_id },\n { refetchOnMount: false }\n )\n const message = messages.find(m => m.id === message_id)\n\n if (!message) return null\n\n return (\n <MessageActionsScreenContent\n message={message}\n conversation_id={conversation_id}\n canDeleteNonAuthoredMessages={canDeleteNonAuthoredMessages || false}\n refetchMessages={refetch}\n inReplyScreen={inReplyScreen}\n replyRootAuthorName={reply_root_author_name}\n />\n )\n}\n\nfunction MessageActionsScreenContent({\n message,\n conversation_id,\n canDeleteNonAuthoredMessages,\n refetchMessages,\n inReplyScreen,\n replyRootAuthorName,\n}: {\n message: MessageResource\n conversation_id: number\n canDeleteNonAuthoredMessages: boolean\n refetchMessages: () => void\n inReplyScreen?: boolean\n replyRootAuthorName?: string\n}) {\n const navigation = useNavigation()\n const apiClient = useApiClient()\n const styles = useStyles()\n const { featureEnabled } = useFeatures()\n const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)\n const expandedLink = message.attachments.find(attachment => attachment.type === 'ExpandedLink')\n const hasExpandedLink = !!expandedLink\n\n const myReactions = message?.reactionCounts\n .filter(reaction => reaction.mine)\n .map(reaction => reaction.value)\n\n const availableReactions = Object.entries(REACTION_EMOJIS).map(([value, emoji]) => {\n return {\n value: value as ReactionCountResource['value'],\n emoji,\n mine: myReactions?.includes(value as ReactionCountResource['value']),\n }\n })\n\n const attachmentForCopy = (): string => {\n const giphyTitleLink = message?.attachments.find(\n attachment => attachment.type === 'giphy'\n )?.titleLink\n\n if (giphyTitleLink) return giphyTitleLink\n return ''\n }\n\n const handleReplyPress = useCallback(() => {\n navigation.goBack()\n // Waits for the modal to be dismissed before pushing the reply screen\n requestAnimationFrame(() => {\n navigation.navigate('ConversationReply', {\n conversation_id,\n reply_root_id: message.replyRootId || message.id,\n reply_root_author_name: replyRootAuthorName,\n })\n })\n }, [navigation, conversation_id, message.id, message.replyRootId, replyRootAuthorName])\n\n const handleCopyPress = () => {\n Clipboard.setStringAsync(message?.text || attachmentForCopy() || '')\n navigation.goBack()\n }\n\n const { handleReactionToggle, isPending } = useMessageReactionToggle({\n conversation_id,\n message,\n })\n\n const deleteMessage = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message.id}/`\n\n return apiClient.chat.delete({ url })\n }, [apiClient, conversation_id, message.id])\n\n const { mutate: handleDeleteMessage } = useMutation({\n mutationFn: deleteMessage,\n onSuccess: () => {\n refetchMessages()\n Haptic.notificationSuccess()\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to delete this message. Please try again.')\n },\n })\n\n const handleDeleteConfirm = useCallback(() => {\n Alert.alert('Delete message', 'Are you sure you want to permanently delete this message?', [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Delete', style: 'destructive', onPress: () => handleDeleteMessage() },\n ])\n }, [handleDeleteMessage])\n\n const handleEditPress = useCallback(() => {\n const state = navigation.getState?.()\n const targetRouteName = inReplyScreen ? 'ConversationReply' : 'Conversation'\n const targetRoute = state?.routes?.find(r => r.name === targetRouteName)\n const params = omitBy(\n {\n ...(targetRoute?.params || {}),\n conversation_id,\n editing_message_id: message.id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo(targetRouteName, params))\n }, [navigation, conversation_id, message.id, inReplyScreen])\n\n const handleViewReadReceiptsPress = useCallback(() => {\n Haptic.impactLight()\n const params = omitBy(\n {\n conversation_id,\n message_id: message.id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('MessageReadReceipts', params))\n }, [navigation, conversation_id, message.id])\n\n const removeLinkPreview = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message.id}/remove_expanded_link`\n const data = {\n data: { type: 'ExpandedLink', attributes: { expanded_link_id: expandedLink?.id } },\n }\n\n return apiClient.chat.post({ url, data })\n }, [apiClient, conversation_id, message.id, expandedLink])\n\n const { mutate: handleRemoveLinkPreview } = useMutation({\n mutationFn: removeLinkPreview,\n onSuccess: () => {\n refetchMessages()\n Haptic.notificationSuccess()\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to remove the preview. Please try again.')\n },\n })\n\n const handleRemoveLinkPreviewConfirm = useCallback(() => {\n Alert.alert('Remove link preview?', 'This will remove the image preview but retain the link', [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Remove', style: 'destructive', onPress: () => handleRemoveLinkPreview() },\n ])\n }, [handleRemoveLinkPreview])\n\n return (\n <FormSheet.Root style={styles.formSheetContent}>\n <View style={styles.reactionList}>\n {availableReactions.map((reaction, index) => (\n <Reaction\n key={index}\n reaction={reaction}\n onPress={() => {\n Haptic.impactLight()\n handleReactionToggle({\n value: reaction.value,\n mine: reaction.mine,\n })\n navigation.goBack()\n }}\n />\n ))}\n </View>\n <View style={styles.actions}>\n {repliesEnabled && !inReplyScreen && (\n <FormSheet.Action\n onPress={handleReplyPress}\n title=\"Reply to message\"\n iconName=\"registrations.undo\"\n accessibilityHint=\"Navigates to the reply screen\"\n accessibilityRole=\"link\"\n />\n )}\n <FormSheet.Action\n onPress={handleCopyPress}\n title=\"Copy text\"\n iconName=\"services.fileCopy\"\n accessibilityHint=\"Copies text and links to clipboard\"\n />\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleEditPress()}\n title=\"Edit message\"\n iconName=\"accounts.editor\"\n accessibilityHint=\"Opens existing text in the message form input.\"\n />\n )}\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleViewReadReceiptsPress()}\n title=\"View read receipts\"\n iconName=\"general.checkPerson\"\n accessibilityHint=\"Opens a modal with a list of people who read your message.\"\n />\n )}\n {message?.mine && hasExpandedLink && (\n <FormSheet.Action\n onPress={() => handleRemoveLinkPreviewConfirm()}\n title=\"Remove link preview\"\n iconName=\"general.brokenLink\"\n accessibilityHint=\"Removes an expanded link preview from the message.\"\n />\n )}\n {(message?.mine || canDeleteNonAuthoredMessages) && (\n <FormSheet.Action\n onPress={() => handleDeleteConfirm()}\n title=\"Delete message\"\n iconName=\"publishing.trash\"\n appearance=\"danger\"\n disabled={isPending}\n accessibilityHint=\"Opens a confirmation alert to delete this message permanently.\"\n />\n )}\n </View>\n </FormSheet.Root>\n )\n}\n\nconst Reaction = ({\n reaction,\n onPress,\n}: {\n reaction: { value: ReactionCountResource['value']; emoji: string; mine: boolean | undefined }\n onPress: () => void\n}) => {\n const styles = useStyles()\n const reactionStyles = useReactionStyles({ mine: reaction.mine ? 1 : 0 })\n\n const { colors } = useTheme()\n const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={[reactionStyles.reaction, styles.reaction]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n onPress={onPress}\n >\n <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 })\n\n const btnBorderWidth = 1\n const baseSize = 46 * fontScale\n const reactionBtnSize = Platform.select({\n ios: baseSize,\n android: baseSize + btnBorderWidth * 2,\n })\n\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n reactionList: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n paddingTop: 8,\n paddingBottom: 16,\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n reaction: {\n height: reactionBtnSize,\n width: reactionBtnSize,\n borderWidth: btnBorderWidth,\n borderRadius: 32,\n justifyContent: 'center',\n overflow: 'hidden',\n },\n reactionEmoji: {\n fontSize: 24,\n },\n actions: {\n paddingTop: 4,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"message_actions_screen.js","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,E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AC;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { useMutation } from '@tanstack/react-query'\nimport { isNil, omitBy } from 'lodash'\nimport React, { useCallback } from 'react'\nimport { Alert, Platform, StyleSheet, View } from 'react-native'\nimport { Text } from '../components'\nimport { useReactionStyles } from '../components/conversation/message_reaction'\nimport { REACTION_EMOJIS } from '../utils'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCreateAndroidRippleColor, useFontScale, useTheme } from '../hooks'\nimport { useApiClient } from '../hooks/use_api_client'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { Clipboard, Haptic } from '../utils/native_adapters'\nimport { MessageResource } from '../types'\nimport { availableFeatures, useFeatures } from '../hooks/use_features'\n\nexport const MessageActionsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: [0.5],\n headerTitle: 'Message actions',\n})\n\nexport type MessageActionsScreenProps = StaticScreenProps<{\n message_id: string\n reply_root_author_name?: string\n conversation_id: number\n canDeleteNonAuthoredMessages?: boolean\n inReplyScreen?: boolean\n}>\n\nexport function MessageActionsScreen({ route }: MessageActionsScreenProps) {\n const {\n conversation_id,\n message_id,\n canDeleteNonAuthoredMessages,\n inReplyScreen,\n reply_root_author_name,\n } = route.params\n\n const { messages, refetch } = useConversationMessages(\n { conversation_id },\n { refetchOnMount: false }\n )\n const message = messages.find(m => m.id === message_id)\n\n if (!message) return null\n\n return (\n <MessageActionsScreenContent\n message={message}\n conversation_id={conversation_id}\n canDeleteNonAuthoredMessages={canDeleteNonAuthoredMessages || false}\n refetchMessages={refetch}\n inReplyScreen={inReplyScreen}\n replyRootAuthorName={reply_root_author_name}\n />\n )\n}\n\nfunction MessageActionsScreenContent({\n message,\n conversation_id,\n canDeleteNonAuthoredMessages,\n refetchMessages,\n inReplyScreen,\n replyRootAuthorName,\n}: {\n message: MessageResource\n conversation_id: number\n canDeleteNonAuthoredMessages: boolean\n refetchMessages: () => void\n inReplyScreen?: boolean\n replyRootAuthorName?: string\n}) {\n const navigation = useNavigation()\n const apiClient = useApiClient()\n const styles = useStyles()\n const { featureEnabled } = useFeatures()\n const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)\n const expandedLink = message.attachments.find(attachment => attachment.type === 'ExpandedLink')\n const hasExpandedLink = !!expandedLink\n\n const myReactions = message?.reactionCounts\n .filter(reaction => reaction.mine)\n .map(reaction => reaction.value)\n\n const availableReactions = Object.entries(REACTION_EMOJIS).map(([value, emoji]) => {\n return {\n value: value as ReactionCountResource['value'],\n emoji,\n mine: myReactions?.includes(value as ReactionCountResource['value']),\n }\n })\n\n const attachmentForCopy = (): string => {\n const giphyTitleLink = message?.attachments.find(\n attachment => attachment.type === 'giphy'\n )?.titleLink\n\n if (giphyTitleLink) return giphyTitleLink\n return ''\n }\n\n const handleReplyPress = useCallback(() => {\n navigation.goBack()\n // Waits for the modal to be dismissed before pushing the reply screen\n requestAnimationFrame(() => {\n navigation.navigate('ConversationReply', {\n conversation_id,\n reply_root_id: message.replyRootId || message.id,\n reply_root_author_name: replyRootAuthorName,\n })\n })\n }, [navigation, conversation_id, message.id, message.replyRootId, replyRootAuthorName])\n\n const handleCopyPress = () => {\n Clipboard.setStringAsync(message?.text || attachmentForCopy() || '')\n navigation.goBack()\n }\n\n const { handleReactionToggle, isPending } = useMessageReactionToggle({\n conversation_id,\n message,\n })\n\n const deleteMessage = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message.id}/`\n\n return apiClient.chat.delete({ url })\n }, [apiClient, conversation_id, message.id])\n\n const { mutate: handleDeleteMessage } = useMutation({\n mutationFn: deleteMessage,\n mutationKey: ['deleteMessage', message.id],\n onSuccess: () => {\n refetchMessages()\n Haptic.notificationSuccess()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to delete this message. Please try again.')\n },\n })\n\n const handleDeleteConfirm = useCallback(() => {\n Alert.alert('Delete message', 'Are you sure you want to permanently delete this message?', [\n { text: 'Cancel', style: 'cancel' },\n {\n text: 'Delete',\n style: 'destructive',\n onPress: () => {\n handleDeleteMessage()\n navigation.goBack()\n },\n },\n ])\n }, [handleDeleteMessage, navigation])\n\n const handleEditPress = useCallback(() => {\n const state = navigation.getState?.()\n const targetRouteName = inReplyScreen ? 'ConversationReply' : 'Conversation'\n const targetRoute = state?.routes?.find(r => r.name === targetRouteName)\n const params = omitBy(\n {\n ...(targetRoute?.params || {}),\n conversation_id,\n editing_message_id: message.id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo(targetRouteName, params))\n }, [navigation, conversation_id, message.id, inReplyScreen])\n\n const handleViewReadReceiptsPress = useCallback(() => {\n Haptic.impactLight()\n const params = omitBy(\n {\n conversation_id,\n message_id: message.id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('MessageReadReceipts', params))\n }, [navigation, conversation_id, message.id])\n\n const removeLinkPreview = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message.id}/remove_expanded_link`\n const data = {\n data: { type: 'ExpandedLink', attributes: { expanded_link_id: expandedLink?.id } },\n }\n\n return apiClient.chat.post({ url, data })\n }, [apiClient, conversation_id, message.id, expandedLink])\n\n const { mutate: handleRemoveLinkPreview } = useMutation({\n mutationFn: removeLinkPreview,\n onSuccess: () => {\n refetchMessages()\n Haptic.notificationSuccess()\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to remove the preview. Please try again.')\n },\n })\n\n const handleRemoveLinkPreviewConfirm = useCallback(() => {\n Alert.alert('Remove link preview?', 'This will remove the image preview but retain the link', [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Remove', style: 'destructive', onPress: () => handleRemoveLinkPreview() },\n ])\n }, [handleRemoveLinkPreview])\n\n return (\n <FormSheet.Root style={styles.formSheetContent}>\n <View style={styles.reactionList}>\n {availableReactions.map((reaction, index) => (\n <Reaction\n key={index}\n reaction={reaction}\n onPress={() => {\n Haptic.impactLight()\n handleReactionToggle({\n value: reaction.value,\n mine: reaction.mine,\n })\n navigation.goBack()\n }}\n />\n ))}\n </View>\n <View style={styles.actions}>\n {repliesEnabled && !inReplyScreen && (\n <FormSheet.Action\n onPress={handleReplyPress}\n title=\"Reply to message\"\n iconName=\"registrations.undo\"\n accessibilityHint=\"Navigates to the reply screen\"\n accessibilityRole=\"link\"\n />\n )}\n <FormSheet.Action\n onPress={handleCopyPress}\n title=\"Copy text\"\n iconName=\"services.fileCopy\"\n accessibilityHint=\"Copies text and links to clipboard\"\n />\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleEditPress()}\n title=\"Edit message\"\n iconName=\"accounts.editor\"\n accessibilityHint=\"Opens existing text in the message form input.\"\n />\n )}\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleViewReadReceiptsPress()}\n title=\"View read receipts\"\n iconName=\"general.checkPerson\"\n accessibilityHint=\"Opens a modal with a list of people who read your message.\"\n />\n )}\n {message?.mine && hasExpandedLink && (\n <FormSheet.Action\n onPress={() => handleRemoveLinkPreviewConfirm()}\n title=\"Remove link preview\"\n iconName=\"general.brokenLink\"\n accessibilityHint=\"Removes an expanded link preview from the message.\"\n />\n )}\n {(message?.mine || canDeleteNonAuthoredMessages) && (\n <FormSheet.Action\n onPress={() => handleDeleteConfirm()}\n title=\"Delete message\"\n iconName=\"publishing.trash\"\n appearance=\"danger\"\n disabled={isPending}\n accessibilityHint=\"Opens a confirmation alert to delete this message permanently.\"\n />\n )}\n </View>\n </FormSheet.Root>\n )\n}\n\nconst Reaction = ({\n reaction,\n onPress,\n}: {\n reaction: { value: ReactionCountResource['value']; emoji: string; mine: boolean | undefined }\n onPress: () => void\n}) => {\n const styles = useStyles()\n const reactionStyles = useReactionStyles({ mine: reaction.mine ? 1 : 0 })\n\n const { colors } = useTheme()\n const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={[reactionStyles.reaction, styles.reaction]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n onPress={onPress}\n >\n <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 })\n\n const btnBorderWidth = 1\n const baseSize = 46 * fontScale\n const reactionBtnSize = Platform.select({\n ios: baseSize,\n android: baseSize + btnBorderWidth * 2,\n })\n\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n reactionList: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n paddingTop: 8,\n paddingBottom: 16,\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n reaction: {\n height: reactionBtnSize,\n width: reactionBtnSize,\n borderWidth: btnBorderWidth,\n borderRadius: 32,\n justifyContent: 'center',\n overflow: 'hidden',\n },\n reactionEmoji: {\n fontSize: 24,\n },\n actions: {\n paddingTop: 4,\n },\n })\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "3.21.2-rc.5",
3
+ "version": "3.22.0-rc.1",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -58,5 +58,5 @@
58
58
  "react-native-url-polyfill": "^2.0.0",
59
59
  "typescript": "<5.6.0"
60
60
  },
61
- "gitHead": "c1a1960f32f77300be55537e4b34860322c12ff7"
61
+ "gitHead": "247959067da8bed9f46c6c10939ad5232cec0ff6"
62
62
  }
@@ -37,6 +37,7 @@ const useStyles = () => {
37
37
  minWidth: '100%',
38
38
  minHeight: 60,
39
39
  justifyContent: 'center',
40
+ position: 'relative',
40
41
  },
41
42
  title: {
42
43
  color: colors.textColorDefaultPrimary,
@@ -0,0 +1,34 @@
1
+ import React from 'react'
2
+ import { View, StyleSheet } from 'react-native'
3
+ import { Spinner } from '../../display'
4
+ import { useTheme } from '../../../hooks'
5
+
6
+ export function AttachmentDeletingOverlay() {
7
+ const styles = useStyles()
8
+
9
+ return (
10
+ <View style={styles.container}>
11
+ <View style={styles.overlay} />
12
+ <Spinner size={24} />
13
+ </View>
14
+ )
15
+ }
16
+
17
+ const useStyles = () => {
18
+ const { colors } = useTheme()
19
+
20
+ return StyleSheet.create({
21
+ container: {
22
+ ...StyleSheet.absoluteFillObject,
23
+ justifyContent: 'center',
24
+ alignItems: 'center',
25
+ borderRadius: 8,
26
+ overflow: 'hidden',
27
+ },
28
+ overlay: {
29
+ ...StyleSheet.absoluteFillObject,
30
+ backgroundColor: colors.fillColorNeutral070,
31
+ opacity: 0.5,
32
+ },
33
+ })
34
+ }
@@ -6,13 +6,16 @@ import { AttachmentCard, AttachmentCardTitle } from './attachment_card'
6
6
  import { useTheme } from '../../../hooks'
7
7
  import { Audio } from '../../../utils/native_adapters'
8
8
  import { PlatformPressable } from '@react-navigation/elements'
9
+ import { AttachmentDeletingOverlay } from './attachment_deleting_overlay'
9
10
 
10
11
  export function AudioAttachment({
11
12
  attachment,
12
13
  onMessageAttachmentLongPress,
14
+ isDeleting,
13
15
  }: {
14
16
  attachment: DenormalizedMessageAttachmentResource
15
17
  onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void
18
+ isDeleting: boolean
16
19
  }) {
17
20
  const styles = useStyles()
18
21
  const { colors } = useTheme()
@@ -34,9 +37,10 @@ export function AudioAttachment({
34
37
 
35
38
  return (
36
39
  <PlatformPressable
37
- onLongPress={() => onMessageAttachmentLongPress(attachment)}
40
+ onLongPress={() => !isDeleting && onMessageAttachmentLongPress(attachment)}
38
41
  android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}
39
42
  accessibilityHint="Long press for more options"
43
+ disabled={isDeleting}
40
44
  >
41
45
  <AttachmentCard>
42
46
  <View style={styles.container}>
@@ -46,7 +50,7 @@ export function AudioAttachment({
46
50
  size="md"
47
51
  accessibilityLabel={sound.isPlaying ? 'Pause' : 'Play'}
48
52
  onPress={toggleAudio}
49
- disabled={!sound}
53
+ disabled={!sound || isDeleting}
50
54
  style={styles.button}
51
55
  iconStyle={styles.buttonIcon}
52
56
  />
@@ -64,6 +68,7 @@ export function AudioAttachment({
64
68
  )}
65
69
  </View>
66
70
  </View>
71
+ {isDeleting && <AttachmentDeletingOverlay />}
67
72
  </AttachmentCard>
68
73
  </PlatformPressable>
69
74
  )
@@ -7,13 +7,16 @@ import { useTheme } from '../../../hooks'
7
7
  import { PlatformPressable } from '@react-navigation/elements'
8
8
  import { tokens } from '../../../vendor/tapestry/tokens'
9
9
  import { Linking } from '../../../utils'
10
+ import { AttachmentDeletingOverlay } from './attachment_deleting_overlay'
10
11
 
11
12
  export function GenericFileAttachment({
12
13
  attachment,
13
14
  onMessageAttachmentLongPress,
15
+ isDeleting,
14
16
  }: {
15
17
  attachment: DenormalizedMessageAttachmentResource
16
18
  onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void
19
+ isDeleting: boolean
17
20
  }) {
18
21
  const styles = useStyles()
19
22
  const { colors } = useTheme()
@@ -32,10 +35,11 @@ export function GenericFileAttachment({
32
35
  return (
33
36
  <PlatformPressable
34
37
  onPress={handleDownload}
35
- onLongPress={() => onMessageAttachmentLongPress(attachment)}
38
+ onLongPress={() => !isDeleting && onMessageAttachmentLongPress(attachment)}
36
39
  android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}
37
40
  accessibilityRole="link"
38
41
  accessibilityHint={`Press to open ${fileTypeLabel} in a browser. Long press for more options`}
42
+ disabled={isDeleting}
39
43
  >
40
44
  <AttachmentCard>
41
45
  <View style={styles.container}>
@@ -44,6 +48,7 @@ export function GenericFileAttachment({
44
48
  <AttachmentCardTitle>{filename}</AttachmentCardTitle>
45
49
  </View>
46
50
  </View>
51
+ {isDeleting && <AttachmentDeletingOverlay />}
47
52
  </AttachmentCard>
48
53
  </PlatformPressable>
49
54
  )
@@ -34,6 +34,7 @@ import { DenormalizedMessageAttachmentResource } from '../../../types/resources/
34
34
  import { PlatformPressable } from '@react-navigation/elements'
35
35
  import { useTheme } from '../../../hooks'
36
36
  import { Haptic, platformFontWeightMedium } from '../../../utils'
37
+ import { AttachmentDeletingOverlay } from './attachment_deleting_overlay'
37
38
 
38
39
  const { width: WINDOW_WIDTH, height: WINDOW_HEIGHT } = Dimensions.get('window')
39
40
  const DISMISS_PAN_THRESHOLD = 175
@@ -64,12 +65,14 @@ export function ImageAttachment({
64
65
  currentImageIndex,
65
66
  metaProps,
66
67
  onMessageAttachmentLongPress,
68
+ isDeleting,
67
69
  }: {
68
70
  attachment: DenormalizedMessageAttachmentResource
69
71
  imageAttachments: DenormalizedMessageAttachmentResource[]
70
72
  currentImageIndex: number
71
73
  metaProps: MetaProps
72
74
  onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void
75
+ isDeleting: boolean
73
76
  }) {
74
77
  const { attributes } = attachment
75
78
  const { url, urlMedium, filename, metadata = {} } = attributes
@@ -87,12 +90,15 @@ export function ImageAttachment({
87
90
  <PlatformPressable
88
91
  style={styles.container}
89
92
  onPress={() => {
90
- setModalKey(prev => prev + 1)
91
- setVisible(true)
93
+ if (!isDeleting) {
94
+ setModalKey(prev => prev + 1)
95
+ setVisible(true)
96
+ }
92
97
  }}
93
- onLongPress={() => onMessageAttachmentLongPress(attachment)}
98
+ onLongPress={() => !isDeleting && onMessageAttachmentLongPress(attachment)}
94
99
  android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}
95
100
  accessibilityHint="Long press for more options"
101
+ disabled={isDeleting}
96
102
  >
97
103
  <Image
98
104
  source={{ uri: urlMedium || url }}
@@ -100,6 +106,7 @@ export function ImageAttachment({
100
106
  wrapperStyle={styles.attachmentImageWrapper}
101
107
  alt={filename}
102
108
  />
109
+ {isDeleting && <AttachmentDeletingOverlay />}
103
110
  </PlatformPressable>
104
111
  <LightboxModal
105
112
  key={modalKey}
@@ -931,6 +938,7 @@ const useStyles = ({ imageWidth = 100, imageHeight = 100 }: UseStylesProps = {})
931
938
  return StyleSheet.create({
932
939
  container: {
933
940
  maxWidth: '100%',
941
+ position: 'relative',
934
942
  },
935
943
  touchEventIsolator: {
936
944
  flex: 1,
@@ -7,13 +7,16 @@ import { Video, VideoPlayerHandle } from '../../../utils/native_adapters'
7
7
  import { PlatformPressable } from '@react-navigation/elements'
8
8
  import { useTheme } from '../../../hooks'
9
9
  import { tokens } from '../../../vendor/tapestry/tokens'
10
+ import { AttachmentDeletingOverlay } from './attachment_deleting_overlay'
10
11
 
11
12
  export function VideoAttachment({
12
13
  attachment,
13
14
  onMessageAttachmentLongPress,
15
+ isDeleting,
14
16
  }: {
15
17
  attachment: DenormalizedMessageAttachmentResource
16
18
  onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void
19
+ isDeleting: boolean
17
20
  }) {
18
21
  const { colors } = useTheme()
19
22
  const styles = useStyles()
@@ -45,10 +48,11 @@ export function VideoAttachment({
45
48
  <View style={styles.container} ref={viewRef}>
46
49
  <PlatformPressable
47
50
  onPress={openVideo}
48
- onLongPress={() => onMessageAttachmentLongPress(attachment)}
51
+ onLongPress={() => !isDeleting && onMessageAttachmentLongPress(attachment)}
49
52
  android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}
50
53
  accessibilityLabel="Play Video"
51
54
  accessibilityHint="Press to play video. Long press for more options"
55
+ disabled={isDeleting}
52
56
  >
53
57
  <View style={styles.thumbnailOverlay} />
54
58
  <Video.Player
@@ -58,7 +62,7 @@ export function VideoAttachment({
58
62
  style={styles.video}
59
63
  onFullscreenPlayerWillDismiss={onFullscreenPlayerWillDismiss}
60
64
  />
61
- {!isOpen && (
65
+ {!isOpen && !isDeleting && (
62
66
  <View style={styles.playContainer}>
63
67
  <View style={styles.playCircle}>
64
68
  <Icon
@@ -69,6 +73,7 @@ export function VideoAttachment({
69
73
  </View>
70
74
  </View>
71
75
  )}
76
+ {isDeleting && <AttachmentDeletingOverlay />}
72
77
  </PlatformPressable>
73
78
  </View>
74
79
  )
@@ -35,6 +35,7 @@ import { pluralize } from '../../utils'
35
35
  import { useConversationMessage } from '../../hooks/use_conversation_message'
36
36
  import { some } from 'lodash'
37
37
  import { isNewMessage } from '../../utils/cache/messages_cache'
38
+ import { useDeletingIds } from '../../hooks'
38
39
 
39
40
  /** Message
40
41
  * Component for display of a message within a conversation list
@@ -56,7 +57,9 @@ export function Message({
56
57
  ...message
57
58
  }: MessageProps) {
58
59
  const { text, reactionCounts, pending, error, attachments, author } = message
59
- const styles = useMessageStyles(message)
60
+ const deletingMessageIds = useDeletingIds('deleteMessage')
61
+ const isDeleting = deletingMessageIds.has(message.id)
62
+ const styles = useMessageStyles(message.mine, isDeleting)
60
63
  const navigation = useNavigation()
61
64
  const { colors } = useTheme()
62
65
  const hasReactions = reactionCounts.length > 0
@@ -190,17 +193,17 @@ export function Message({
190
193
 
191
194
  return (
192
195
  <Pressable
193
- onLongPress={handleMessageLongPress}
194
- onPress={handleMessagePress}
195
- onPressIn={handleMessagePressIn}
196
- onPressOut={handleMessagePressOut}
196
+ onLongPress={isDeleting ? undefined : handleMessageLongPress}
197
+ onPress={isDeleting ? undefined : handleMessagePress}
198
+ onPressIn={isDeleting ? undefined : handleMessagePressIn}
199
+ onPressOut={isDeleting ? undefined : handleMessagePressOut}
197
200
  android_ripple={{ color: colors.androidRippleNeutral, borderless: false, foreground: true }}
198
201
  accessibilityRole="button"
199
202
  accessibilityLabel={accessibilityLabel}
200
203
  accessibilityHint="Long press to view message actions like reacting and copying."
201
204
  accessibilityActions={isReplyRootMessage ? accessibilityActions : undefined}
202
205
  onAccessibilityAction={isReplyRootMessage ? handleAccessibilityAction : undefined}
203
- disabled={isDeletedReplyRootMessage}
206
+ disabled={isDeletedReplyRootMessage || isDeleting}
204
207
  >
205
208
  <Animated.View style={[styles.message, animatedBackgroundColor]}>
206
209
  {!message.mine && (
@@ -337,7 +340,7 @@ export function Message({
337
340
  )
338
341
  }
339
342
 
340
- const useMessageStyles = ({ mine }: MessageResource) => {
343
+ const useMessageStyles = (mine: boolean, isDeleting: boolean) => {
341
344
  const { colors } = useTheme()
342
345
  const myMessageBackgroundColor = useInteractionGhostBackgroundColor()
343
346
  const { width } = useWindowDimensions()
@@ -350,6 +353,7 @@ const useMessageStyles = ({ mine }: MessageResource) => {
350
353
  gap: 8,
351
354
  flexDirection: mine ? 'row-reverse' : 'row',
352
355
  paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,
356
+ opacity: isDeleting ? 0.5 : 1,
353
357
  },
354
358
  messageContent: {
355
359
  flex: 1,
@@ -10,6 +10,7 @@ import { GiphyAttachment } from './attachments/giphy_attachment'
10
10
  import { GenericFileAttachment } from './attachments/generic_file_attachment'
11
11
  import { ExpandedLink } from './attachments/expanded_link'
12
12
  import { ImageAttachment, type MetaProps } from './attachments/image_attachment'
13
+ import { useDeletingIds } from '../../hooks'
13
14
 
14
15
  export function MessageAttachments(props: {
15
16
  attachments: DenormalizedAttachmentResource[]
@@ -19,6 +20,7 @@ export function MessageAttachments(props: {
19
20
  }) {
20
21
  const styles = useStyles()
21
22
  const { attachments, metaProps, onMessageAttachmentLongPress, onMessageLongPress } = props
23
+ const deletingAttachmentIds = useDeletingIds('deleteAttachment')
22
24
  if (!attachments || attachments.length === 0) return null
23
25
 
24
26
  const imageAttachments = attachments.filter(
@@ -40,6 +42,7 @@ export function MessageAttachments(props: {
40
42
  currentImageIndex={index}
41
43
  metaProps={metaProps}
42
44
  onMessageAttachmentLongPress={onMessageAttachmentLongPress}
45
+ isDeleting={deletingAttachmentIds.has(image.id)}
43
46
  />
44
47
  ))}
45
48
 
@@ -51,6 +54,7 @@ export function MessageAttachments(props: {
51
54
  key={`${attachment.id}-${index}`}
52
55
  attachment={attachment}
53
56
  onMessageAttachmentLongPress={onMessageAttachmentLongPress}
57
+ isDeleting={deletingAttachmentIds.has(attachment.id)}
54
58
  />
55
59
  )
56
60
  case 'giphy':
@@ -80,9 +84,11 @@ export function MessageAttachments(props: {
80
84
  function MessageAttachment({
81
85
  attachment,
82
86
  onMessageAttachmentLongPress,
87
+ isDeleting,
83
88
  }: {
84
89
  attachment: DenormalizedMessageAttachmentResource
85
90
  onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void
91
+ isDeleting: boolean
86
92
  }) {
87
93
  const { attributes } = attachment
88
94
  const contentType = attributes?.contentType
@@ -94,6 +100,7 @@ function MessageAttachment({
94
100
  <VideoAttachment
95
101
  attachment={attachment}
96
102
  onMessageAttachmentLongPress={onMessageAttachmentLongPress}
103
+ isDeleting={isDeleting}
97
104
  />
98
105
  )
99
106
  case 'audio':
@@ -101,6 +108,7 @@ function MessageAttachment({
101
108
  <AudioAttachment
102
109
  attachment={attachment}
103
110
  onMessageAttachmentLongPress={onMessageAttachmentLongPress}
111
+ isDeleting={isDeleting}
104
112
  />
105
113
  )
106
114
  case 'application':
@@ -108,6 +116,7 @@ function MessageAttachment({
108
116
  <GenericFileAttachment
109
117
  attachment={attachment}
110
118
  onMessageAttachmentLongPress={onMessageAttachmentLongPress}
119
+ isDeleting={isDeleting}
111
120
  />
112
121
  )
113
122
  default:
@@ -3,6 +3,7 @@ export * from './use_animated_message_background_color'
3
3
  export * from './use_theme'
4
4
  export * from './use_suspense_api'
5
5
  export * from './use_current_person'
6
+ export * from './use_deleting_ids'
6
7
  export * from './use_font_scale'
7
8
  export * from './use_create_android_ripple_color'
8
9
  export * from './use_chat_permissions'
@@ -0,0 +1,22 @@
1
+ import { useMutationState } from '@tanstack/react-query'
2
+ import { useMemo } from 'react'
3
+
4
+ type DeletableResourceEvent = 'deleteAttachment' | 'deleteMessage'
5
+
6
+ export function useDeletingIds(event: DeletableResourceEvent): Set<string> {
7
+ const ids = useMutationState({
8
+ filters: {
9
+ mutationKey: [event],
10
+ status: 'pending',
11
+ },
12
+ select: mutation => {
13
+ // Extract the item ID from the mutation key: [ event, id ]
14
+ const key = mutation.options.mutationKey
15
+ return key && Array.isArray(key) && typeof key[1] === 'string' ? key[1] : null
16
+ },
17
+ })
18
+
19
+ return useMemo(() => {
20
+ return new Set(ids.filter(id => id !== null))
21
+ }, [ids])
22
+ }
@@ -44,10 +44,17 @@ export function AttachmentActionsScreen({ route }: AttachmentActionsScreenProps)
44
44
  'Are you sure you want to permanently delete this attachment?',
45
45
  [
46
46
  { text: 'Cancel', style: 'cancel' },
47
- { text: 'Delete', style: 'destructive', onPress: () => handleDeleteAttachment() },
47
+ {
48
+ text: 'Delete',
49
+ style: 'destructive',
50
+ onPress: () => {
51
+ handleDeleteAttachment()
52
+ navigation.goBack()
53
+ },
54
+ },
48
55
  ]
49
56
  )
50
- }, [attachmentName, handleDeleteAttachment])
57
+ }, [attachmentName, handleDeleteAttachment, navigation])
51
58
 
52
59
  const handleOpenInBrowser = () => {
53
60
  Linking.openURL(attachmentUrl)
@@ -1,5 +1,4 @@
1
1
  import { Alert } from 'react-native'
2
- import { useNavigation } from '@react-navigation/native'
3
2
  import { useMutation } from '@tanstack/react-query'
4
3
  import { useApiClient } from '../../../hooks/use_api_client'
5
4
  import { useCallback } from 'react'
@@ -18,7 +17,6 @@ export function useDeleteAttachment({
18
17
  attachmentName,
19
18
  }: UseDeleteAttachmentProps) {
20
19
  const apiClient = useApiClient()
21
- const navigation = useNavigation()
22
20
  const { refetch } = useConversationMessages({ conversation_id }, { refetchOnMount: false })
23
21
 
24
22
  const deleteAttachment = useCallback(() => {
@@ -29,10 +27,10 @@ export function useDeleteAttachment({
29
27
 
30
28
  const { mutate: handleDeleteAttachment } = useMutation({
31
29
  mutationFn: deleteAttachment,
30
+ mutationKey: ['deleteAttachment', attachmentId],
32
31
  onSuccess: () => {
33
32
  refetch()
34
33
  Haptic.notificationSuccess()
35
- navigation.goBack()
36
34
  },
37
35
  onError: () => {
38
36
  Alert.alert(
@@ -133,10 +133,10 @@ function MessageActionsScreenContent({
133
133
 
134
134
  const { mutate: handleDeleteMessage } = useMutation({
135
135
  mutationFn: deleteMessage,
136
+ mutationKey: ['deleteMessage', message.id],
136
137
  onSuccess: () => {
137
138
  refetchMessages()
138
139
  Haptic.notificationSuccess()
139
- navigation.goBack()
140
140
  },
141
141
  onError: () => {
142
142
  Alert.alert('Oops', 'We were unable to delete this message. Please try again.')
@@ -146,9 +146,16 @@ function MessageActionsScreenContent({
146
146
  const handleDeleteConfirm = useCallback(() => {
147
147
  Alert.alert('Delete message', 'Are you sure you want to permanently delete this message?', [
148
148
  { text: 'Cancel', style: 'cancel' },
149
- { text: 'Delete', style: 'destructive', onPress: () => handleDeleteMessage() },
149
+ {
150
+ text: 'Delete',
151
+ style: 'destructive',
152
+ onPress: () => {
153
+ handleDeleteMessage()
154
+ navigation.goBack()
155
+ },
156
+ },
150
157
  ])
151
- }, [handleDeleteMessage])
158
+ }, [handleDeleteMessage, navigation])
152
159
 
153
160
  const handleEditPress = useCallback(() => {
154
161
  const state = navigation.getState?.()