@planningcenter/chat-react-native 4.4.1-qa-staging.5 → 4.4.1-qa-staging.7
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 +140 -119
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/reply_shadow_message.d.ts.map +1 -1
- package/build/components/conversation/reply_shadow_message.js +36 -25
- package/build/components/conversation/reply_shadow_message.js.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +196 -16
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.js +65 -54
- package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -1
- package/build/hooks/use_api.d.ts +2 -1
- package/build/hooks/use_api.d.ts.map +1 -1
- package/build/hooks/use_api.js.map +1 -1
- package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
- package/build/screens/conversation_new/components/groups_form.js +37 -34
- package/build/screens/conversation_new/components/groups_form.js.map +1 -1
- package/build/utils/styles.d.ts +1 -0
- package/build/utils/styles.d.ts.map +1 -1
- package/build/utils/styles.js +1 -1
- package/build/utils/styles.js.map +1 -1
- package/package.json +3 -3
- package/src/components/conversation/message.tsx +16 -2
- package/src/components/conversation/reply_shadow_message.tsx +14 -3
- package/src/hooks/groups/use_group_members_for_new_conversation.ts +18 -16
- package/src/hooks/use_api.ts +2 -1
- package/src/screens/conversation_new/components/groups_form.tsx +1 -0
- package/src/utils/styles.ts +1 -0
|
@@ -30,6 +30,7 @@ import { Haptic } from '../../utils/native_adapters'
|
|
|
30
30
|
import {
|
|
31
31
|
CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,
|
|
32
32
|
MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,
|
|
33
|
+
MESSAGE_BACKGROUND_OUTSET,
|
|
33
34
|
platformFontWeightMedium,
|
|
34
35
|
} from '../../utils/styles'
|
|
35
36
|
import { ComponentErrorBoundary } from '../page/component_error_boundary'
|
|
@@ -225,7 +226,14 @@ export const Message = memo(function MessageRow({
|
|
|
225
226
|
onAccessibilityAction={isReplyRootMessage ? handleAccessibilityAction : undefined}
|
|
226
227
|
disabled={isDeletedReplyRootMessage || isDeleting}
|
|
227
228
|
>
|
|
228
|
-
<
|
|
229
|
+
<View style={styles.message}>
|
|
230
|
+
<Animated.View
|
|
231
|
+
style={[
|
|
232
|
+
styles.background,
|
|
233
|
+
{ bottom: messageBottomMargin - MESSAGE_BACKGROUND_OUTSET },
|
|
234
|
+
animatedBackgroundColor,
|
|
235
|
+
]}
|
|
236
|
+
/>
|
|
229
237
|
{!message.mine && (
|
|
230
238
|
<View>
|
|
231
239
|
{renderAuthor ? (
|
|
@@ -348,7 +356,7 @@ export const Message = memo(function MessageRow({
|
|
|
348
356
|
{message.mine && (
|
|
349
357
|
<MyReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />
|
|
350
358
|
)}
|
|
351
|
-
</
|
|
359
|
+
</View>
|
|
352
360
|
</Pressable>
|
|
353
361
|
)
|
|
354
362
|
})
|
|
@@ -368,6 +376,12 @@ const useMessageStyles = (mine: boolean, isDeleting: boolean) => {
|
|
|
368
376
|
paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,
|
|
369
377
|
opacity: isDeleting ? 0.5 : 1,
|
|
370
378
|
},
|
|
379
|
+
background: {
|
|
380
|
+
position: 'absolute',
|
|
381
|
+
left: 0,
|
|
382
|
+
right: 0,
|
|
383
|
+
top: -MESSAGE_BACKGROUND_OUTSET,
|
|
384
|
+
},
|
|
371
385
|
messageContent: {
|
|
372
386
|
flex: 1,
|
|
373
387
|
gap: 4,
|
|
@@ -24,11 +24,14 @@ import {
|
|
|
24
24
|
CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,
|
|
25
25
|
MAX_FONT_SIZE_MULTIPLIER,
|
|
26
26
|
MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,
|
|
27
|
+
MESSAGE_BACKGROUND_OUTSET,
|
|
27
28
|
platformFontWeightMedium,
|
|
28
29
|
} from '../../utils/styles'
|
|
29
30
|
import { Avatar, Icon, IconProps, Image, Text } from '../display'
|
|
30
31
|
import { TheirReplyConnector, MyReplyConnector } from './reply_connectors'
|
|
31
32
|
|
|
33
|
+
const SPACE_BELOW_MESSAGE = 12
|
|
34
|
+
|
|
32
35
|
interface ReplyShadowMessageProps extends MessageResource {
|
|
33
36
|
messageId: string
|
|
34
37
|
conversation_id: number
|
|
@@ -104,7 +107,8 @@ function ShadowMessageContent({ conversation_id, ...message }: ShadowMessageCont
|
|
|
104
107
|
accessibilityHint="Navigate to reply screen for this message"
|
|
105
108
|
accessibilityRole="link"
|
|
106
109
|
>
|
|
107
|
-
<
|
|
110
|
+
<View style={styles.message}>
|
|
111
|
+
<Animated.View style={[styles.background, animatedBackgroundColor]} />
|
|
108
112
|
{!message.mine && (
|
|
109
113
|
<View>
|
|
110
114
|
<View style={[styles.avatarWrapper, !isDeleted && styles.avatarOpacity]}>
|
|
@@ -145,7 +149,7 @@ function ShadowMessageContent({ conversation_id, ...message }: ShadowMessageCont
|
|
|
145
149
|
{message.mine && (
|
|
146
150
|
<MyReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />
|
|
147
151
|
)}
|
|
148
|
-
</
|
|
152
|
+
</View>
|
|
149
153
|
</Pressable>
|
|
150
154
|
)
|
|
151
155
|
}
|
|
@@ -287,10 +291,17 @@ const useStyles = ({ mine, imageWidth = 32, imageHeight = 32 }: StylesProps = {}
|
|
|
287
291
|
flexDirection: mine ? 'row-reverse' : 'row',
|
|
288
292
|
paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,
|
|
289
293
|
},
|
|
294
|
+
background: {
|
|
295
|
+
position: 'absolute',
|
|
296
|
+
left: 0,
|
|
297
|
+
right: 0,
|
|
298
|
+
top: -MESSAGE_BACKGROUND_OUTSET,
|
|
299
|
+
bottom: SPACE_BELOW_MESSAGE - MESSAGE_BACKGROUND_OUTSET,
|
|
300
|
+
},
|
|
290
301
|
messageContent: {
|
|
291
302
|
flex: 1,
|
|
292
303
|
gap: 4,
|
|
293
|
-
marginBottom:
|
|
304
|
+
marginBottom: SPACE_BELOW_MESSAGE,
|
|
294
305
|
},
|
|
295
306
|
avatarWrapper: {
|
|
296
307
|
width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
+
import { keepPreviousData } from '@tanstack/react-query'
|
|
1
2
|
import { useMemo } from 'react'
|
|
2
3
|
import { MemberResource, ResourceObject } from '../../types'
|
|
3
4
|
import { GroupsGroupMemberResource } from '../../types/resources/groups/groups_member_resource_with_person'
|
|
5
|
+
import { useApiPaginator } from '../use_api'
|
|
4
6
|
import { useEnrichPeople } from '../use_enrich_people'
|
|
5
|
-
import { useSuspensePaginator } from '../use_suspense_api'
|
|
6
7
|
|
|
7
|
-
type
|
|
8
|
-
typeof useSuspensePaginator<T>
|
|
9
|
-
>
|
|
8
|
+
type UseApiPaginatorResult<T extends ResourceObject> = ReturnType<typeof useApiPaginator<T>>
|
|
10
9
|
|
|
11
10
|
export type GroupMembersForNewConversationResult = Omit<
|
|
12
|
-
|
|
11
|
+
UseApiPaginatorResult<GroupsGroupMemberResource>, // We are passing our own "members" data shape
|
|
13
12
|
'data'
|
|
14
13
|
> & {
|
|
15
14
|
data: MemberResource[]
|
|
@@ -24,19 +23,22 @@ export function useGroupMembersForNewConversation({
|
|
|
24
23
|
id: number
|
|
25
24
|
gender: string | null
|
|
26
25
|
}) {
|
|
27
|
-
const response =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
const response = useApiPaginator<GroupsGroupMemberResource>(
|
|
27
|
+
{
|
|
28
|
+
url: `/me/groups/${id}/memberships`,
|
|
29
|
+
data: {
|
|
30
|
+
perPage: 100,
|
|
31
|
+
include: ['person'],
|
|
32
|
+
fields: {
|
|
33
|
+
Membership: ['person, role'],
|
|
34
|
+
Person: ['avatar_url', 'name', 'first_name', 'last_name', 'child', 'gender'],
|
|
35
|
+
},
|
|
36
|
+
...(gender ? { where: { gender } } : {}),
|
|
35
37
|
},
|
|
36
|
-
|
|
38
|
+
app: 'groups',
|
|
37
39
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
{ throwOnError: true, placeholderData: keepPreviousData }
|
|
41
|
+
)
|
|
40
42
|
|
|
41
43
|
const { data: memberships = [] } = response
|
|
42
44
|
const personIds = useMemo(() => memberships.map(m => +m.person.id), [memberships])
|
package/src/hooks/use_api.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InfiniteData, useInfiniteQuery, useQuery } from '@tanstack/react-query'
|
|
1
|
+
import { InfiniteData, keepPreviousData, useInfiniteQuery, useQuery } from '@tanstack/react-query'
|
|
2
2
|
import { useContext } from 'react'
|
|
3
3
|
import { ChatContext } from '../contexts/chat_context'
|
|
4
4
|
import { ApiCollection, ApiResource, ResourceObject } from '../types'
|
|
@@ -17,6 +17,7 @@ export type ApiGetQueryOptions = {
|
|
|
17
17
|
gcTime?: number
|
|
18
18
|
enabled?: boolean
|
|
19
19
|
throwOnError?: boolean | ((error: ResponseError) => boolean)
|
|
20
|
+
placeholderData?: typeof keepPreviousData
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export const useApiGet = <T extends ResourceObject | ResourceObject[]>(
|
|
@@ -125,6 +125,7 @@ export const GroupsForm = ({ groupId, chat_group_graph_id, avatarSelection }: Gr
|
|
|
125
125
|
memberData={groupMemberships.adultMembers}
|
|
126
126
|
loadingMore={groupMemberships.isFetchingNextPage}
|
|
127
127
|
onEndReached={groupMemberships.fetchNextPage}
|
|
128
|
+
listEmptyText={groupMemberships.isLoading ? 'Loading members...' : undefined}
|
|
128
129
|
FormContent={
|
|
129
130
|
<FormContent
|
|
130
131
|
group={group}
|
package/src/utils/styles.ts
CHANGED
|
@@ -6,6 +6,7 @@ export const MAX_FONT_SIZE_MULTIPLIER_LANDMARK = 1.2 // Use in headers, footers,
|
|
|
6
6
|
|
|
7
7
|
export const CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL = 16 // TODO: move to `screens/conversation/utils/styles` when `/screens/conversation` is created
|
|
8
8
|
export const MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH = 32 // TODO: move to `screens/conversation/utils/styles` when `/screens/conversation` is created
|
|
9
|
+
export const MESSAGE_BACKGROUND_OUTSET = 2
|
|
9
10
|
|
|
10
11
|
export const platformFontWeightMedium = Platform.select({
|
|
11
12
|
ios: tokens.fontWeightMedium,
|