@planningcenter/chat-react-native 3.17.0-rc.1 → 3.17.0
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.
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +11 -1
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/message_form.d.ts +2 -1
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +6 -4
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversation/reply_shadow_message.js +1 -1
- package/build/components/conversation/reply_shadow_message.js.map +1 -1
- package/build/hooks/use_conversation_message.d.ts +2 -1
- package/build/hooks/use_conversation_message.d.ts.map +1 -1
- package/build/hooks/use_conversation_message.js +5 -2
- package/build/hooks/use_conversation_message.js.map +1 -1
- package/build/navigation/index.d.ts +6 -2
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +3 -3
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_screen.d.ts +1 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +19 -10
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/message_actions_screen.d.ts +1 -0
- package/build/screens/message_actions_screen.d.ts.map +1 -1
- package/build/screens/message_actions_screen.js +5 -5
- package/build/screens/message_actions_screen.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversation/message.tsx +12 -1
- package/src/components/conversation/message_form.tsx +8 -2
- package/src/components/conversation/reply_shadow_message.tsx +1 -1
- package/src/hooks/use_conversation_message.ts +6 -1
- package/src/navigation/index.tsx +3 -3
- package/src/screens/conversation_screen.tsx +20 -10
- package/src/screens/message_actions_screen.tsx +13 -3
package/src/navigation/index.tsx
CHANGED
|
@@ -187,9 +187,9 @@ export const ChatStack = createNativeStackNavigator({
|
|
|
187
187
|
},
|
|
188
188
|
ConversationReply: {
|
|
189
189
|
screen: ConversationScreen,
|
|
190
|
-
options: {
|
|
191
|
-
title: 'Reply',
|
|
192
|
-
},
|
|
190
|
+
options: ({ route }) => ({
|
|
191
|
+
title: (route.params as ConversationRouteProps)?.title ?? 'Reply',
|
|
192
|
+
}),
|
|
193
193
|
},
|
|
194
194
|
TeamConversation: {
|
|
195
195
|
screen: TeamConversationScreen,
|
|
@@ -40,7 +40,7 @@ import { REPLIES_FEATURE_ENABLED } from '../utils'
|
|
|
40
40
|
export type ConversationRouteProps = {
|
|
41
41
|
conversation_id: number
|
|
42
42
|
reply_root_id?: string | null
|
|
43
|
-
|
|
43
|
+
reply_root_author_name?: string
|
|
44
44
|
chat_group_graph_id?: string
|
|
45
45
|
clear_input?: boolean
|
|
46
46
|
editing_message_id?: number | null
|
|
@@ -55,7 +55,8 @@ export type ConversationScreenProps = StaticScreenProps<ConversationRouteProps>
|
|
|
55
55
|
export function ConversationScreen({ route }: ConversationScreenProps) {
|
|
56
56
|
const styles = useStyles()
|
|
57
57
|
const navigation = useNavigation()
|
|
58
|
-
const { conversation_id, editing_message_id, reply_root_id } =
|
|
58
|
+
const { conversation_id, editing_message_id, reply_root_id, reply_root_author_name } =
|
|
59
|
+
route.params
|
|
59
60
|
const { data: conversation } = useConversation(route.params)
|
|
60
61
|
const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({
|
|
61
62
|
conversation_id,
|
|
@@ -73,6 +74,10 @@ export function ConversationScreen({ route }: ConversationScreenProps) {
|
|
|
73
74
|
const showLeaderDisabledReplyBanner = canReply && repliesDisabled
|
|
74
75
|
const canDeleteNonAuthoredMessages = memberAbility?.canDeleteNonAuthoredMessages ?? false
|
|
75
76
|
const currentlyEditingMessage = messages.find(m => String(m.id) === String(editing_message_id))
|
|
77
|
+
const replyRootAuthorFirstName = reply_root_author_name?.split(' ')[0]
|
|
78
|
+
const replyHeaderTitle = replyRootAuthorFirstName
|
|
79
|
+
? `Reply to ${replyRootAuthorFirstName}`
|
|
80
|
+
: 'Reply'
|
|
76
81
|
|
|
77
82
|
const listRef = useRef<FlatList>(null)
|
|
78
83
|
const [showJumpToBottomButton, setShowJumpToBottomButton] = useState(false)
|
|
@@ -89,14 +94,18 @@ export function ConversationScreen({ route }: ConversationScreenProps) {
|
|
|
89
94
|
}, [])
|
|
90
95
|
|
|
91
96
|
useEffect(() => {
|
|
92
|
-
if (reply_root_id)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
if (reply_root_id) {
|
|
98
|
+
navigation.setParams({
|
|
99
|
+
title: replyHeaderTitle,
|
|
100
|
+
})
|
|
101
|
+
} else {
|
|
102
|
+
navigation.setParams({
|
|
103
|
+
title: title,
|
|
104
|
+
badge: badges?.[0],
|
|
105
|
+
deleted: conversation?.deleted,
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
}, [navigation, title, badges, conversation?.deleted, reply_root_id, replyHeaderTitle])
|
|
100
109
|
|
|
101
110
|
if (!conversation || conversation.deleted) {
|
|
102
111
|
return (
|
|
@@ -167,6 +176,7 @@ export function ConversationScreen({ route }: ConversationScreenProps) {
|
|
|
167
176
|
{showLeaderDisabledReplyBanner && <LeaderDisabledRepliesBanner />}
|
|
168
177
|
{canReply ? (
|
|
169
178
|
<MessageForm.Root
|
|
179
|
+
replyRootAuthorFirstName={replyRootAuthorFirstName}
|
|
170
180
|
conversation={conversation}
|
|
171
181
|
replyRootId={reply_root_id}
|
|
172
182
|
currentlyEditingMessage={currentlyEditingMessage}
|
|
@@ -23,13 +23,20 @@ export const MessageActionsScreenOptions = getFormSheetScreenOptions({
|
|
|
23
23
|
|
|
24
24
|
export type MessageActionsScreenProps = StaticScreenProps<{
|
|
25
25
|
message_id: string
|
|
26
|
+
reply_root_author_name?: string
|
|
26
27
|
conversation_id: number
|
|
27
28
|
canDeleteNonAuthoredMessages?: boolean
|
|
28
29
|
inReplyScreen?: boolean
|
|
29
30
|
}>
|
|
30
31
|
|
|
31
32
|
export function MessageActionsScreen({ route }: MessageActionsScreenProps) {
|
|
32
|
-
const {
|
|
33
|
+
const {
|
|
34
|
+
conversation_id,
|
|
35
|
+
message_id,
|
|
36
|
+
canDeleteNonAuthoredMessages,
|
|
37
|
+
inReplyScreen,
|
|
38
|
+
reply_root_author_name,
|
|
39
|
+
} = route.params
|
|
33
40
|
|
|
34
41
|
const { messages, refetch } = useConversationMessages(
|
|
35
42
|
{ conversation_id },
|
|
@@ -46,6 +53,7 @@ export function MessageActionsScreen({ route }: MessageActionsScreenProps) {
|
|
|
46
53
|
canDeleteNonAuthoredMessages={canDeleteNonAuthoredMessages || false}
|
|
47
54
|
refetchMessages={refetch}
|
|
48
55
|
inReplyScreen={inReplyScreen}
|
|
56
|
+
replyRootAuthorName={reply_root_author_name}
|
|
49
57
|
/>
|
|
50
58
|
)
|
|
51
59
|
}
|
|
@@ -56,12 +64,14 @@ function MessageActionsScreenContent({
|
|
|
56
64
|
canDeleteNonAuthoredMessages,
|
|
57
65
|
refetchMessages,
|
|
58
66
|
inReplyScreen,
|
|
67
|
+
replyRootAuthorName,
|
|
59
68
|
}: {
|
|
60
69
|
message: MessageResource
|
|
61
70
|
conversation_id: number
|
|
62
71
|
canDeleteNonAuthoredMessages: boolean
|
|
63
72
|
refetchMessages: () => void
|
|
64
73
|
inReplyScreen?: boolean
|
|
74
|
+
replyRootAuthorName?: string
|
|
65
75
|
}) {
|
|
66
76
|
const navigation = useNavigation()
|
|
67
77
|
const apiClient = useApiClient()
|
|
@@ -95,10 +105,10 @@ function MessageActionsScreenContent({
|
|
|
95
105
|
navigation.navigate('ConversationReply', {
|
|
96
106
|
conversation_id,
|
|
97
107
|
reply_root_id: message.replyRootId || message.id,
|
|
98
|
-
|
|
108
|
+
reply_root_author_name: replyRootAuthorName,
|
|
99
109
|
})
|
|
100
110
|
})
|
|
101
|
-
}, [navigation, conversation_id, message.id, message.replyRootId])
|
|
111
|
+
}, [navigation, conversation_id, message.id, message.replyRootId, replyRootAuthorName])
|
|
102
112
|
|
|
103
113
|
const handleCopyPress = () => {
|
|
104
114
|
Clipboard.setStringAsync(message?.text || attachmentForCopy() || '')
|