@planningcenter/chat-react-native 3.4.1-rc.2 → 3.4.1-rc.4
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/empty_conversation_blank_state.d.ts +2 -0
- package/build/components/conversation/empty_conversation_blank_state.d.ts.map +1 -0
- package/build/components/conversation/empty_conversation_blank_state.js +12 -0
- package/build/components/conversation/empty_conversation_blank_state.js.map +1 -0
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +18 -8
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/display/blank_state.d.ts +13 -0
- package/build/components/display/blank_state.d.ts.map +1 -0
- package/build/components/display/blank_state.js +46 -0
- package/build/components/display/blank_state.js.map +1 -0
- package/build/components/display/keyboard_view.d.ts.map +1 -1
- package/build/components/display/keyboard_view.js +23 -22
- package/build/components/display/keyboard_view.js.map +1 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +8 -6
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/design_system_screen.d.ts.map +1 -1
- package/build/screens/design_system_screen.js +11 -0
- package/build/screens/design_system_screen.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversation/empty_conversation_blank_state.tsx +20 -0
- package/src/components/conversation/message_form.tsx +27 -16
- package/src/components/display/blank_state.tsx +61 -0
- package/src/components/display/keyboard_view.tsx +31 -25
- package/src/screens/conversation_screen.tsx +21 -15
- package/src/screens/design_system_screen.tsx +19 -0
|
@@ -22,6 +22,7 @@ import { useConversation } from '../hooks/use_conversation'
|
|
|
22
22
|
import { useConversationMessages } from '../hooks/use_conversation_messages'
|
|
23
23
|
import { MessageResource } from '../types'
|
|
24
24
|
import { getRelativeDateStatus } from '../utils/date'
|
|
25
|
+
import { EmptyConversationBlankState } from '../components/conversation/empty_conversation_blank_state'
|
|
25
26
|
|
|
26
27
|
type ConversationRouteProps = {
|
|
27
28
|
conversation_id: number
|
|
@@ -42,6 +43,7 @@ export function ConversationScreen({ route }: ConversationScreenProps) {
|
|
|
42
43
|
})
|
|
43
44
|
useEnsureConversationsRouteExists()
|
|
44
45
|
const messagesWithSeparators = groupMessages(messages)
|
|
46
|
+
const noMessages = messagesWithSeparators.length === 0
|
|
45
47
|
|
|
46
48
|
// Seems to be necessary to define this way so we get the route picked up
|
|
47
49
|
const headerTitle = useCallback(
|
|
@@ -56,22 +58,26 @@ export function ConversationScreen({ route }: ConversationScreenProps) {
|
|
|
56
58
|
return (
|
|
57
59
|
<View style={styles.container}>
|
|
58
60
|
<KeyboardView style={styles.keyboardView}>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
61
|
+
{noMessages ? (
|
|
62
|
+
<EmptyConversationBlankState />
|
|
63
|
+
) : (
|
|
64
|
+
<FlatList
|
|
65
|
+
inverted
|
|
66
|
+
contentContainerStyle={styles.listContainer}
|
|
67
|
+
refreshing={isRefetching}
|
|
68
|
+
onRefresh={refetch}
|
|
69
|
+
data={messagesWithSeparators}
|
|
70
|
+
keyExtractor={item => item.id}
|
|
71
|
+
renderItem={({ item }) => {
|
|
72
|
+
if (item.type === 'DateSeparator') {
|
|
73
|
+
return <InlineDateSeparator {...item} />
|
|
74
|
+
}
|
|
70
75
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
return <Message {...item} conversation_id={conversation_id} />
|
|
77
|
+
}}
|
|
78
|
+
onEndReached={() => fetchNextPage()}
|
|
79
|
+
/>
|
|
80
|
+
)}
|
|
75
81
|
<MessageForm.Root conversation={conversation}>
|
|
76
82
|
<MessageForm.AttachmentPicker />
|
|
77
83
|
<MessageForm.Commands />
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
platformFontWeightMedium,
|
|
29
29
|
} from '../utils'
|
|
30
30
|
import BannerPrimitive from '../components/primitive/banner_primitive'
|
|
31
|
+
import { BlankState } from '../components/display/blank_state'
|
|
31
32
|
|
|
32
33
|
// =================================
|
|
33
34
|
// ====== Docs Utils ===============
|
|
@@ -915,6 +916,24 @@ function MiscComponentsSection({ isLast }: SectionProps) {
|
|
|
915
916
|
<Person person={personChild} />
|
|
916
917
|
</Column>
|
|
917
918
|
</Group>
|
|
919
|
+
<Group
|
|
920
|
+
title="BlankState"
|
|
921
|
+
description="Displays a title and an optional icon, subtitle, and button. Button can be customized via `buttonProps`."
|
|
922
|
+
>
|
|
923
|
+
<Column>
|
|
924
|
+
<BlankState
|
|
925
|
+
iconName="general.outlinedTextMessage"
|
|
926
|
+
title="No messages"
|
|
927
|
+
subtitle="Conversation is hidden from everyone until you send a message."
|
|
928
|
+
buttonProps={{
|
|
929
|
+
onPress: buttonPress,
|
|
930
|
+
title: 'Go back',
|
|
931
|
+
accessibilityHint: 'Navigates back to the conversations list',
|
|
932
|
+
accessibilityRole: 'link',
|
|
933
|
+
}}
|
|
934
|
+
/>
|
|
935
|
+
</Column>
|
|
936
|
+
</Group>
|
|
918
937
|
</CollapsableSection>
|
|
919
938
|
)
|
|
920
939
|
}
|