@planningcenter/chat-react-native 1.7.0-rc.0 → 2.0.0-rc.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.
Files changed (56) hide show
  1. package/build/components/conversation/message.d.ts +9 -0
  2. package/build/components/conversation/message.d.ts.map +1 -0
  3. package/build/components/conversation/message.js +73 -0
  4. package/build/components/conversation/message.js.map +1 -0
  5. package/build/components/conversation/message_form.d.ts +20 -0
  6. package/build/components/conversation/message_form.d.ts.map +1 -0
  7. package/build/components/conversation/message_form.js +103 -0
  8. package/build/components/conversation/message_form.js.map +1 -0
  9. package/build/components/conversation/message_reaction.d.ts +23 -0
  10. package/build/components/conversation/message_reaction.d.ts.map +1 -1
  11. package/build/components/conversation/message_reaction.js +1 -4
  12. package/build/components/conversation/message_reaction.js.map +1 -1
  13. package/build/components/display/keyboard_view.d.ts +4 -0
  14. package/build/components/display/keyboard_view.d.ts.map +1 -0
  15. package/build/components/display/keyboard_view.js +46 -0
  16. package/build/components/display/keyboard_view.js.map +1 -0
  17. package/build/index.d.ts +4 -6
  18. package/build/index.d.ts.map +1 -1
  19. package/build/index.js +4 -6
  20. package/build/index.js.map +1 -1
  21. package/build/navigation/index.d.ts.map +1 -1
  22. package/build/screens/conversation_screen.d.ts.map +1 -1
  23. package/build/screens/conversation_screen.js +21 -84
  24. package/build/screens/conversation_screen.js.map +1 -1
  25. package/build/screens/message_actions_screen.d.ts.map +1 -1
  26. package/build/screens/message_actions_screen.js +69 -50
  27. package/build/screens/message_actions_screen.js.map +1 -1
  28. package/build/utils/index.d.ts +1 -0
  29. package/build/utils/index.d.ts.map +1 -1
  30. package/build/utils/index.js +1 -0
  31. package/build/utils/index.js.map +1 -1
  32. package/build/utils/native_adapters/clipboard.d.ts +6 -0
  33. package/build/utils/native_adapters/clipboard.d.ts.map +1 -0
  34. package/build/utils/native_adapters/clipboard.js +9 -0
  35. package/build/utils/native_adapters/clipboard.js.map +1 -0
  36. package/build/utils/native_adapters/configuration.d.ts +10 -0
  37. package/build/utils/native_adapters/configuration.d.ts.map +1 -0
  38. package/build/utils/native_adapters/configuration.js +18 -0
  39. package/build/utils/native_adapters/configuration.js.map +1 -0
  40. package/build/utils/native_adapters/index.d.ts +3 -0
  41. package/build/utils/native_adapters/index.d.ts.map +1 -0
  42. package/build/utils/native_adapters/index.js +3 -0
  43. package/build/utils/native_adapters/index.js.map +1 -0
  44. package/package.json +2 -2
  45. package/src/__tests__/utils/native_adapters/configuration.ts +21 -0
  46. package/src/components/conversation/message.tsx +87 -0
  47. package/src/components/conversation/message_form.tsx +159 -0
  48. package/src/components/conversation/message_reaction.tsx +1 -4
  49. package/src/components/display/keyboard_view.tsx +69 -0
  50. package/src/index.tsx +10 -6
  51. package/src/screens/conversation_screen.tsx +30 -115
  52. package/src/screens/message_actions_screen.tsx +114 -77
  53. package/src/utils/index.ts +1 -0
  54. package/src/utils/native_adapters/clipboard.ts +9 -0
  55. package/src/utils/native_adapters/configuration.ts +25 -0
  56. package/src/utils/native_adapters/index.ts +2 -0
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { MessageResource } from '../../types';
3
+ /** Message
4
+ * Component for display of a message within a conversation list
5
+ */
6
+ export declare function Message(props: MessageResource & {
7
+ conversation_id: string;
8
+ }): React.JSX.Element | null;
9
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,4BAuC3E"}
@@ -0,0 +1,73 @@
1
+ import { PlatformPressable } from '@react-navigation/elements';
2
+ import { useNavigation } from '@react-navigation/native';
3
+ import colorFunction from 'color';
4
+ import React from 'react';
5
+ import { StyleSheet, View } from 'react-native';
6
+ import { MessageReaction } from '../../components/conversation/message_reaction';
7
+ import { Avatar, Text } from '../../components/display';
8
+ import { useTheme } from '../../hooks';
9
+ /** Message
10
+ * Component for display of a message within a conversation list
11
+ */
12
+ export function Message(props) {
13
+ const { text, conversation_id, reactionCounts } = props;
14
+ const styles = useMessageStyles(props);
15
+ const navigation = useNavigation();
16
+ const handleMessagePress = () => {
17
+ navigation.navigate('MessageActions', {
18
+ message_id: props.id,
19
+ conversation_id,
20
+ });
21
+ };
22
+ // TODO: open the reaction screen to show who reacted
23
+ const handleReactionPress = handleMessagePress;
24
+ if (!text)
25
+ return null;
26
+ return (<View style={styles.message}>
27
+ {!props.mine && (<View style={styles.messageAuthor}>
28
+ <Avatar size={'md'} sourceUri={props.author.avatar}/>
29
+ </View>)}
30
+ <View style={styles.messageContent}>
31
+ {!props.mine && <Text variant="tertiary">{props.author.name}</Text>}
32
+ <PlatformPressable style={styles.messageBubble} onLongPress={handleMessagePress}>
33
+ <Text style={styles.messageText}>{text}</Text>
34
+ </PlatformPressable>
35
+ <View style={styles.messageReactions}>
36
+ {reactionCounts.map(reaction => (<MessageReaction key={reaction.value} reaction={reaction} onPress={handleReactionPress}/>))}
37
+ </View>
38
+ </View>
39
+ </View>);
40
+ }
41
+ const useMessageStyles = ({ mine }) => {
42
+ const { colors } = useTheme();
43
+ const activeColor = colorFunction(colors.interaction).alpha(0.2).string();
44
+ return StyleSheet.create({
45
+ message: {
46
+ gap: 8,
47
+ flexDirection: mine ? 'row-reverse' : 'row',
48
+ },
49
+ messageContent: {
50
+ gap: 8,
51
+ flexShrink: 1,
52
+ },
53
+ messageAuthor: {
54
+ flexDirection: 'row',
55
+ gap: 8,
56
+ },
57
+ messageBubble: {
58
+ backgroundColor: mine ? activeColor : colors.fillColorNeutral070,
59
+ borderRadius: 12,
60
+ paddingVertical: 6,
61
+ paddingHorizontal: 8,
62
+ },
63
+ messageText: {
64
+ color: colors.textColorDefaultPrimary,
65
+ },
66
+ messageReactions: {
67
+ flexDirection: 'row',
68
+ gap: 4,
69
+ justifyContent: mine ? 'flex-end' : 'flex-start',
70
+ },
71
+ });
72
+ };
73
+ //# sourceMappingURL=message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,aAAa,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAGtC;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,KAAoD;IAC1E,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,KAAK,CAAA;IACvD,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACtC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC9B,UAAU,CAAC,QAAQ,CAAC,gBAAgB,EAAE;YACpC,UAAU,EAAE,KAAK,CAAC,EAAE;YACpB,eAAe;SAChB,CAAC,CAAA;IACJ,CAAC,CAAA;IACD,qDAAqD;IACrD,MAAM,mBAAmB,GAAG,kBAAkB,CAAA;IAE9C,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAA;IAEtB,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAC1B;MAAA,CAA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EAAE,CAAA;IAC7B,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAA;IAEzE,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,OAAO,EAAE;YACP,GAAG,EAAE,CAAC;YACN,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK;SAC5C;QACD,cAAc,EAAE;YACd,GAAG,EAAE,CAAC;YACN,UAAU,EAAE,CAAC;SACd;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;SACP;QACD,aAAa,EAAE;YACb,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB;YAChE,YAAY,EAAE,EAAE;YAChB,eAAe,EAAE,CAAC;YAClB,iBAAiB,EAAE,CAAC;SACrB;QACD,WAAW,EAAE;YACX,KAAK,EAAE,MAAM,CAAC,uBAAuB;SACtC;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;SACjD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { useNavigation } from '@react-navigation/native'\nimport colorFunction from 'color'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { MessageReaction } from '../../components/conversation/message_reaction'\nimport { Avatar, Text } from '../../components/display'\nimport { useTheme } from '../../hooks'\nimport { MessageResource } from '../../types'\n\n/** Message\n * Component for display of a message within a conversation list\n */\nexport function Message(props: MessageResource & { conversation_id: string }) {\n const { text, conversation_id, reactionCounts } = props\n const styles = useMessageStyles(props)\n const navigation = useNavigation()\n const handleMessagePress = () => {\n navigation.navigate('MessageActions', {\n message_id: props.id,\n conversation_id,\n })\n }\n // TODO: open the reaction screen to show who reacted\n const handleReactionPress = handleMessagePress\n\n if (!text) return null\n\n return (\n <View style={styles.message}>\n {!props.mine && (\n <View style={styles.messageAuthor}>\n <Avatar size={'md'} sourceUri={props.author.avatar} />\n </View>\n )}\n <View style={styles.messageContent}>\n {!props.mine && <Text variant=\"tertiary\">{props.author.name}</Text>}\n <PlatformPressable style={styles.messageBubble} onLongPress={handleMessagePress}>\n <Text style={styles.messageText}>{text}</Text>\n </PlatformPressable>\n <View style={styles.messageReactions}>\n {reactionCounts.map(reaction => (\n <MessageReaction\n key={reaction.value}\n reaction={reaction}\n onPress={handleReactionPress}\n />\n ))}\n </View>\n </View>\n </View>\n )\n}\n\nconst useMessageStyles = ({ mine }: MessageResource) => {\n const { colors } = useTheme()\n const activeColor = colorFunction(colors.interaction).alpha(0.2).string()\n\n return StyleSheet.create({\n message: {\n gap: 8,\n flexDirection: mine ? 'row-reverse' : 'row',\n },\n messageContent: {\n gap: 8,\n flexShrink: 1,\n },\n messageAuthor: {\n flexDirection: 'row',\n gap: 8,\n },\n messageBubble: {\n backgroundColor: mine ? activeColor : colors.fillColorNeutral070,\n borderRadius: 12,\n paddingVertical: 6,\n paddingHorizontal: 8,\n },\n messageText: {\n color: colors.textColorDefaultPrimary,\n },\n messageReactions: {\n flexDirection: 'row',\n gap: 4,\n justifyContent: mine ? 'flex-end' : 'flex-start',\n },\n })\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { ViewProps } from 'react-native';
3
+ import { ConversationResource } from '../../types';
4
+ export declare const MessageForm: {
5
+ Root: typeof MessageFormRoot;
6
+ TextInput: typeof MessageFormInput;
7
+ SubmitButton: typeof MessageFormSubmitBtn;
8
+ AttachmentPicker: typeof MessageFormAttachmentPicker;
9
+ Commands: typeof MessageFormCommands;
10
+ };
11
+ interface MessagesFormRootProps extends ViewProps {
12
+ conversation: ConversationResource;
13
+ }
14
+ declare function MessageFormRoot({ conversation, children }: MessagesFormRootProps): React.JSX.Element;
15
+ declare function MessageFormInput(): React.JSX.Element;
16
+ declare function MessageFormSubmitBtn(): React.JSX.Element;
17
+ declare function MessageFormAttachmentPicker(): React.JSX.Element;
18
+ declare function MessageFormCommands(): React.JSX.Element;
19
+ export {};
20
+ //# sourceMappingURL=message_form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAA+B,SAAS,EAAE,MAAM,cAAc,CAAA;AAKrE,OAAO,EAA8B,oBAAoB,EAAmB,MAAM,aAAa,CAAA;AAG/F,eAAO,MAAM,WAAW;;;;;;CAMvB,CAAA;AAED,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,YAAY,EAAE,oBAAoB,CAAA;CACnC;AASD,iBAAS,eAAe,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,qBAAqB,qBA+CzE;AAED,iBAAS,gBAAgB,sBAcxB;AAED,iBAAS,oBAAoB,sBAe5B;AAED,iBAAS,2BAA2B,sBASnC;AAED,iBAAS,mBAAmB,sBAI3B"}
@@ -0,0 +1,103 @@
1
+ import { useTheme as useNavigationTheme } from '@react-navigation/native';
2
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
3
+ import React, { useContext } from 'react';
4
+ import { StyleSheet, TextInput, View } from 'react-native';
5
+ import { IconButton } from '../../components';
6
+ import { ChatContext } from '../../contexts';
7
+ import { useTheme } from '../../hooks';
8
+ import { getMessagesQueryKey, getMessagesRequestArgs } from '../../hooks/use_conversation_messages';
9
+ import { updateRecordInPagesData } from '../../utils';
10
+ export const MessageForm = {
11
+ Root: MessageFormRoot,
12
+ TextInput: MessageFormInput,
13
+ SubmitButton: MessageFormSubmitBtn,
14
+ AttachmentPicker: MessageFormAttachmentPicker,
15
+ Commands: MessageFormCommands,
16
+ };
17
+ const MessageFormContext = React.createContext({
18
+ text: '',
19
+ setText: (_text) => { },
20
+ onSubmit: () => { },
21
+ disabled: false,
22
+ });
23
+ function MessageFormRoot({ conversation, children }) {
24
+ const styles = useMessageFormStyles();
25
+ const [text, setText] = React.useState('');
26
+ const { client } = useContext(ChatContext);
27
+ const queryClient = useQueryClient();
28
+ const { mutate, isPending } = useMutation({
29
+ mutationFn: async () => {
30
+ const requestParams = getMessagesRequestArgs({ conversation_id: conversation.id });
31
+ const fieldsWithValueJoined = Object.fromEntries(Object.entries(requestParams.data.fields).map(([k, v]) => [k, v.join(',')]));
32
+ return client.post({
33
+ url: `/me/conversations/${conversation.id}/messages`,
34
+ data: {
35
+ ...requestParams.data,
36
+ data: {
37
+ type: 'Message',
38
+ attributes: { text },
39
+ },
40
+ fields: fieldsWithValueJoined,
41
+ },
42
+ });
43
+ },
44
+ onSuccess: (result) => {
45
+ const updatedMessage = result.data;
46
+ const queryKey = getMessagesQueryKey({ conversation_id: conversation.id });
47
+ setText('');
48
+ queryClient.setQueryData(queryKey, data => updateRecordInPagesData({
49
+ data,
50
+ record: updatedMessage,
51
+ }));
52
+ },
53
+ });
54
+ return (<MessageFormContext.Provider value={{ text, setText, onSubmit: () => mutate(), disabled: isPending }}>
55
+ <View style={styles.textInputContainer}>{children}</View>
56
+ </MessageFormContext.Provider>);
57
+ }
58
+ function MessageFormInput() {
59
+ const styles = useMessageFormStyles();
60
+ const { text, setText, onSubmit } = React.useContext(MessageFormContext);
61
+ return (<TextInput aria-disabled={true} placeholder="Send a message" onChangeText={setText} value={text} style={styles.textInput} onSubmitEditing={onSubmit}/>);
62
+ }
63
+ function MessageFormSubmitBtn() {
64
+ const styles = useMessageFormStyles();
65
+ const { onSubmit, disabled } = React.useContext(MessageFormContext);
66
+ return (<IconButton disabled={disabled} accessibilityLabel="Send message" size="md" appearance="neutral" style={styles.textInputSend} name={'general.upArrow'} onPress={onSubmit}/>);
67
+ }
68
+ function MessageFormAttachmentPicker() {
69
+ return (<IconButton accessibilityLabel="Shazam" size="md" appearance="neutral" name={'general.paperclip'}/>);
70
+ }
71
+ function MessageFormCommands() {
72
+ return (<IconButton accessibilityLabel="Shazam" size="md" appearance="neutral" name={'general.bolt'}/>);
73
+ }
74
+ const useMessageFormStyles = () => {
75
+ const theme = useTheme();
76
+ const navigationTheme = useNavigationTheme();
77
+ return StyleSheet.create({
78
+ textInputContainer: {
79
+ borderColor: theme.colors.fillColorNeutral050Base,
80
+ borderTopWidth: 1,
81
+ padding: 12,
82
+ backgroundColor: navigationTheme.colors.card,
83
+ flexDirection: 'row',
84
+ alignItems: 'center',
85
+ gap: 12,
86
+ },
87
+ textInput: {
88
+ borderRadius: 24,
89
+ borderWidth: 1,
90
+ padding: 12,
91
+ paddingHorizontal: 20,
92
+ borderColor: theme.colors.fillColorNeutral050Base,
93
+ flex: 1,
94
+ },
95
+ textInputSend: {
96
+ borderRadius: 24,
97
+ height: 36,
98
+ width: 36,
99
+ backgroundColor: theme.colors.fillColorNeutral040,
100
+ },
101
+ });
102
+ };
103
+ //# sourceMappingURL=message_form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message_form.js","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AACzE,OAAO,EAAgB,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,C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CAAC;QACvB,kBAAkB,EAAE;YAClB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;YACjD,cAAc,EAAE,CAAC;YACjB,OAAO,EAAE,EAAE;YACX,eAAe,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI;YAC5C,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,SAAS,EAAE;YACT,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,CAAC;YACd,OAAO,EAAE,EAAE;YACX,iBAAiB,EAAE,EAAE;YACrB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;YACjD,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,YAAY,EAAE,EAAE;YAChB,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;YACT,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB;SAClD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useTheme as useNavigationTheme } from '@react-navigation/native'\nimport { InfiniteData, useMutation, useQueryClient } from '@tanstack/react-query'\nimport React, { useContext } from 'react'\nimport { StyleSheet, TextInput, View, ViewProps } from 'react-native'\nimport { IconButton } from '../../components'\nimport { ChatContext } from '../../contexts'\nimport { useTheme } from '../../hooks'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../../hooks/use_conversation_messages'\nimport { ApiCollection, ApiResource, ConversationResource, MessageResource } from '../../types'\nimport { updateRecordInPagesData } from '../../utils'\n\nexport const MessageForm = {\n Root: MessageFormRoot,\n TextInput: MessageFormInput,\n SubmitButton: MessageFormSubmitBtn,\n AttachmentPicker: MessageFormAttachmentPicker,\n Commands: MessageFormCommands,\n}\n\ninterface MessagesFormRootProps extends ViewProps {\n conversation: ConversationResource\n}\n\nconst MessageFormContext = React.createContext({\n text: '',\n setText: (_text: string) => {},\n onSubmit: () => {},\n disabled: false,\n})\n\nfunction MessageFormRoot({ conversation, children }: MessagesFormRootProps) {\n const styles = useMessageFormStyles()\n const [text, setText] = React.useState('')\n const { client } = useContext(ChatContext)\n const queryClient = useQueryClient()\n\n const { mutate, isPending } = useMutation({\n mutationFn: async () => {\n const requestParams = getMessagesRequestArgs({ conversation_id: conversation.id })\n const fieldsWithValueJoined = Object.fromEntries(\n Object.entries(requestParams.data.fields).map(([k, v]) => [k, v.join(',')])\n )\n\n return client.post({\n url: `/me/conversations/${conversation.id}/messages`,\n data: {\n ...requestParams.data,\n data: {\n type: 'Message',\n attributes: { text },\n },\n fields: fieldsWithValueJoined,\n },\n })\n },\n onSuccess: (result: ApiResource<MessageResource>) => {\n const updatedMessage = result.data\n type QueryData = InfiniteData<ApiCollection<MessageResource>>\n const queryKey = getMessagesQueryKey({ conversation_id: conversation.id })\n\n setText('')\n queryClient.setQueryData<QueryData>(queryKey, data =>\n updateRecordInPagesData({\n data,\n record: updatedMessage,\n })\n )\n },\n })\n\n return (\n <MessageFormContext.Provider\n value={{ text, setText, onSubmit: () => mutate(), disabled: isPending }}\n >\n <View style={styles.textInputContainer}>{children}</View>\n </MessageFormContext.Provider>\n )\n}\n\nfunction MessageFormInput() {\n const styles = useMessageFormStyles()\n const { text, setText, onSubmit } = React.useContext(MessageFormContext)\n\n return (\n <TextInput\n aria-disabled={true}\n placeholder=\"Send a message\"\n onChangeText={setText}\n value={text}\n style={styles.textInput}\n onSubmitEditing={onSubmit}\n />\n )\n}\n\nfunction MessageFormSubmitBtn() {\n const styles = useMessageFormStyles()\n const { onSubmit, disabled } = React.useContext(MessageFormContext)\n\n return (\n <IconButton\n disabled={disabled}\n accessibilityLabel=\"Send message\"\n size=\"md\"\n appearance=\"neutral\"\n style={styles.textInputSend}\n name={'general.upArrow'}\n onPress={onSubmit}\n />\n )\n}\n\nfunction MessageFormAttachmentPicker() {\n return (\n <IconButton\n accessibilityLabel=\"Shazam\"\n size=\"md\"\n appearance=\"neutral\"\n name={'general.paperclip'}\n />\n )\n}\n\nfunction MessageFormCommands() {\n return (\n <IconButton accessibilityLabel=\"Shazam\" size=\"md\" appearance=\"neutral\" name={'general.bolt'} />\n )\n}\n\nconst useMessageFormStyles = () => {\n const theme = useTheme()\n const navigationTheme = useNavigationTheme()\n\n return StyleSheet.create({\n textInputContainer: {\n borderColor: theme.colors.fillColorNeutral050Base,\n borderTopWidth: 1,\n padding: 12,\n backgroundColor: navigationTheme.colors.card,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n },\n textInput: {\n borderRadius: 24,\n borderWidth: 1,\n padding: 12,\n paddingHorizontal: 20,\n borderColor: theme.colors.fillColorNeutral050Base,\n flex: 1,\n },\n textInputSend: {\n borderRadius: 24,\n height: 36,\n width: 36,\n backgroundColor: theme.colors.fillColorNeutral040,\n },\n })\n}\n"]}
@@ -5,4 +5,27 @@ export declare function MessageReaction({ reaction, onPress, }: {
5
5
  reaction: ReactionCountResource;
6
6
  onPress: () => void;
7
7
  }): React.JSX.Element;
8
+ export declare const useReactionStyles: ({ mine }: {
9
+ mine: number;
10
+ }) => {
11
+ reaction: {
12
+ borderWidth: number;
13
+ borderColor: any;
14
+ backgroundColor: any;
15
+ borderRadius: number;
16
+ paddingVertical: number;
17
+ paddingHorizontal: number;
18
+ flexDirection: "row";
19
+ alignItems: "center";
20
+ gap: number;
21
+ };
22
+ reactionEmoji: {
23
+ fontSize: number;
24
+ paddingTop: number;
25
+ };
26
+ reactionText: {
27
+ fontSize: number;
28
+ color: string;
29
+ };
30
+ };
8
31
  //# sourceMappingURL=message_reaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message_reaction.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_reaction.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAEtE,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,MAAM,CAM1E,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,qBAAqB,CAAA;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,qBASA"}
1
+ {"version":3,"file":"message_reaction.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_reaction.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAEtE,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,MAAM,CAM1E,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,qBAAqB,CAAA;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,qBASA;AAED,eAAO,MAAM,iBAAiB,aAAc;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;CAoB3D,CAAA"}
@@ -18,7 +18,7 @@ export function MessageReaction({ reaction, onPress, }) {
18
18
  <Text style={styles.reactionText}>{reaction.count}</Text>
19
19
  </PlatformPressable>);
20
20
  }
21
- const useReactionStyles = ({ mine }) => {
21
+ export const useReactionStyles = ({ mine }) => {
22
22
  const { colors } = useTheme();
23
23
  const activeBorderColor = colorFunction(colors.interaction).alpha(0.8).string();
24
24
  const activeColor = colorFunction(colors.interaction).alpha(0.2).string();
@@ -36,9 +36,6 @@ const useReactionStyles = ({ mine }) => {
36
36
  },
37
37
  reactionEmoji: { fontSize: 12, paddingTop: 0 },
38
38
  reactionText: { fontSize: 12, color: colors.textColorDefaultPrimary },
39
- pressed: {
40
- opacity: 0.5,
41
- },
42
39
  });
43
40
  };
44
41
  //# sourceMappingURL=message_reaction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"message_reaction.js","sourceRoot":"","sources":["../../../src/components/conversation/message_reaction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CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAA;IAC/E,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAA;IAEzE,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,QAAQ,EAAE;YACR,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB;YAClE,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,uBAAuB;YACpE,YAAY,EAAE,EAAE;YAChB,eAAe,EAAE,CAAC;YAClB,iBAAiB,EAAE,EAAE;YACrB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,aAAa,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;QAC9C,YAAY,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,uBAAuB,EAAE;QACrE,OAAO,EAAE;YACP,OAAO,EAAE,GAAG;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport colorFunction from 'color'\nimport React from 'react'\nimport { StyleSheet } from 'react-native'\nimport { Text } from '../../components/display'\nimport { useTheme } from '../../hooks'\nimport { ReactionCountResource } from '../../types/resources/reaction'\n\nexport const REACTION_EMOJIS: Record<ReactionCountResource['value'], string> = {\n thumbs_up: '👍',\n thumbs_down: '👎',\n pray: '🙏',\n laugh: '😂',\n heart: '❤️',\n}\n\nexport function MessageReaction({\n reaction,\n onPress,\n}: {\n reaction: ReactionCountResource\n onPress: () => void\n}) {\n const styles = useReactionStyles(reaction)\n\n return (\n <PlatformPressable key={reaction.value} style={styles.reaction} onPress={onPress}>\n <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n <Text style={styles.reactionText}>{reaction.count}</Text>\n </PlatformPressable>\n )\n}\n\nconst useReactionStyles = ({ mine }: { mine: number }) => {\n const { colors } = useTheme()\n const activeBorderColor = colorFunction(colors.interaction).alpha(0.8).string()\n const activeColor = colorFunction(colors.interaction).alpha(0.2).string()\n\n return StyleSheet.create({\n reaction: {\n borderWidth: 1,\n borderColor: mine ? activeBorderColor : colors.fillColorNeutral040,\n backgroundColor: mine ? activeColor : colors.fillColorNeutral050Base,\n borderRadius: 16,\n paddingVertical: 2,\n paddingHorizontal: 12,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n reactionEmoji: { fontSize: 12, paddingTop: 0 },\n reactionText: { fontSize: 12, color: colors.textColorDefaultPrimary },\n pressed: {\n opacity: 0.5,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"message_reaction.js","sourceRoot":"","sources":["../../../src/components/conversation/message_reaction.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,aAAa,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAGtC,MAAM,CAAC,MAAM,eAAe,GAAmD;IAC7E,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;CACZ,CAAA;AAED,MAAM,UAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,OAAO,GAIR;IACC,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;IAE1C,OAAO,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E,CAAC;SACP;QACD,aAAa,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;QAC9C,YAAY,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,uBAAuB,EAAE;KACtE,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport colorFunction from 'color'\nimport React from 'react'\nimport { StyleSheet } from 'react-native'\nimport { Text } from '../../components/display'\nimport { useTheme } from '../../hooks'\nimport { ReactionCountResource } from '../../types/resources/reaction'\n\nexport const REACTION_EMOJIS: Record<ReactionCountResource['value'], string> = {\n thumbs_up: '👍',\n thumbs_down: '👎',\n pray: '🙏',\n laugh: '😂',\n heart: '❤️',\n}\n\nexport function MessageReaction({\n reaction,\n onPress,\n}: {\n reaction: ReactionCountResource\n onPress: () => void\n}) {\n const styles = useReactionStyles(reaction)\n\n return (\n <PlatformPressable key={reaction.value} style={styles.reaction} onPress={onPress}>\n <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n <Text style={styles.reactionText}>{reaction.count}</Text>\n </PlatformPressable>\n )\n}\n\nexport const useReactionStyles = ({ mine }: { mine: number }) => {\n const { colors } = useTheme()\n const activeBorderColor = colorFunction(colors.interaction).alpha(0.8).string()\n const activeColor = colorFunction(colors.interaction).alpha(0.2).string()\n\n return StyleSheet.create({\n reaction: {\n borderWidth: 1,\n borderColor: mine ? activeBorderColor : colors.fillColorNeutral040,\n backgroundColor: mine ? activeColor : colors.fillColorNeutral050Base,\n borderRadius: 16,\n paddingVertical: 2,\n paddingHorizontal: 12,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n reactionEmoji: { fontSize: 12, paddingTop: 0 },\n reactionText: { fontSize: 12, color: colors.textColorDefaultPrimary },\n })\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ViewProps } from 'react-native';
3
+ export declare function KeyboardView({ children }: ViewProps): React.JSX.Element;
4
+ //# sourceMappingURL=keyboard_view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard_view.d.ts","sourceRoot":"","sources":["../../../src/components/display/keyboard_view.tsx"],"names":[],"mappings":"AACA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAChD,OAAO,EAML,SAAS,EACV,MAAM,cAAc,CAAA;AAGrB,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE,SAAS,qBA4BnD"}
@@ -0,0 +1,46 @@
1
+ import { useTheme as useNavigationTheme } from '@react-navigation/native';
2
+ import React, { useMemo, useState } from 'react';
3
+ import { KeyboardAvoidingView, Platform, StyleSheet, useWindowDimensions, View, } from 'react-native';
4
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
+ export function KeyboardView({ children }) {
6
+ const styles = useStyles();
7
+ const { height } = useWindowDimensions();
8
+ const insets = useSafeAreaInsets();
9
+ const [pageSheetGap, setPageSheetGap] = useState(0);
10
+ const keyboardVerticalOffset = useMemo(() => pageSheetGap + insets.top - insets.bottom, [pageSheetGap, insets.top, insets.bottom]);
11
+ return (<View style={styles.pageGapView} onLayout={event => {
12
+ const { height: viewHeight } = event.nativeEvent.layout;
13
+ setPageSheetGap(height - viewHeight - insets.top);
14
+ }}>
15
+ <KeyboardAvoidingView keyboardVerticalOffset={keyboardVerticalOffset} behavior={Platform.select({ ios: 'padding' })} style={styles.container}>
16
+ {children}
17
+ </KeyboardAvoidingView>
18
+ </View>);
19
+ }
20
+ const useStyles = () => {
21
+ const navigationTheme = useNavigationTheme();
22
+ return StyleSheet.create({
23
+ container: {
24
+ flex: 1,
25
+ justifyContent: 'center',
26
+ },
27
+ pageGapView: {
28
+ flex: 1,
29
+ },
30
+ keyboardView: {
31
+ flex: 1,
32
+ },
33
+ listContainer: {
34
+ gap: 12,
35
+ paddingHorizontal: 16,
36
+ paddingVertical: 12,
37
+ },
38
+ textInputContainer: {
39
+ borderTopWidth: 1,
40
+ padding: 12,
41
+ backgroundColor: navigationTheme.colors.card,
42
+ },
43
+ textInput: { borderRadius: 16, borderWidth: 1, padding: 12 },
44
+ });
45
+ };
46
+ //# sourceMappingURL=keyboard_view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard_view.js","sourceRoot":"","sources":["../../../src/components/display/keyboard_view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AACzE,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChD,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,IAAI,GAEL,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAa;IAClD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,MAAM,EAAE,MAAM,EAAE,GAAG,mBAAmB,EAAE,CAAA;IACxC,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAA;IAClC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAS,CAAC,CAAC,CAAA;IAC3D,MAAM,sBAAsB,GAAG,OAAO,CACpC,GAAG,EAAE,CAAC,YAAY,GAAG,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,EAC/C,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAC1C,CAAA;IAED,OAAO,CACL,CAAC,IAAI,CACH,KAAK,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAC1B,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE;YAChB,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAA;YACvD,eAAe,CAAC,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;QACnD,CAAC,CAAC,CAEF;MAAA,CAAC,oBAAoB,CACnB,sBAAsB,CAAC,CAAC,sBAAsB,CAAC,CAC/C,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAC9C,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAExB;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,oBAAoB,CACxB;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAA;IAE5C,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;SACzB;QACD,WAAW,EAAE;YACX,IAAI,EAAE,CAAC;SACR;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,EAAE;SACpB;QACD,kBAAkB,EAAE;YAClB,cAAc,EAAE,CAAC;YACjB,OAAO,EAAE,EAAE;YACX,eAAe,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI;SAC7C;QACD,SAAS,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;KAC7D,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useTheme as useNavigationTheme } from '@react-navigation/native'\nimport React, { useMemo, useState } from 'react'\nimport {\n KeyboardAvoidingView,\n Platform,\n StyleSheet,\n useWindowDimensions,\n View,\n ViewProps,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nexport function KeyboardView({ children }: ViewProps) {\n const styles = useStyles()\n\n const { height } = useWindowDimensions()\n const insets = useSafeAreaInsets()\n const [pageSheetGap, setPageSheetGap] = useState<number>(0)\n const keyboardVerticalOffset = useMemo(\n () => pageSheetGap + insets.top - insets.bottom,\n [pageSheetGap, insets.top, insets.bottom]\n )\n\n return (\n <View\n style={styles.pageGapView}\n onLayout={event => {\n const { height: viewHeight } = event.nativeEvent.layout\n setPageSheetGap(height - viewHeight - insets.top)\n }}\n >\n <KeyboardAvoidingView\n keyboardVerticalOffset={keyboardVerticalOffset}\n behavior={Platform.select({ ios: 'padding' })}\n style={styles.container}\n >\n {children}\n </KeyboardAvoidingView>\n </View>\n )\n}\n\nconst useStyles = () => {\n const navigationTheme = useNavigationTheme()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n },\n pageGapView: {\n flex: 1,\n },\n keyboardView: {\n flex: 1,\n },\n listContainer: {\n gap: 12,\n paddingHorizontal: 16,\n paddingVertical: 12,\n },\n textInputContainer: {\n borderTopWidth: 1,\n padding: 12,\n backgroundColor: navigationTheme.colors.card,\n },\n textInput: { borderRadius: 16, borderWidth: 1, padding: 12 },\n })\n}\n"]}
package/build/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- export * from './components';
2
- export * from './contexts';
3
- export * from './hooks';
4
- export * from './screens';
5
- export * from './utils';
6
- export * from './navigation';
1
+ export { ChatProvider, ChatContext, CreateChatThemeProps } from './contexts';
2
+ export { DesignSystemScreen } from './screens';
3
+ export { ChatStack } from './navigation';
4
+ export { TemporaryDefaultColorsType, ChatAdapters, ClipboardAdapter, Session, Client, } from './utils';
7
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EACL,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,MAAM,GACP,MAAM,SAAS,CAAA"}
package/build/index.js CHANGED
@@ -1,7 +1,5 @@
1
- export * from './components';
2
- export * from './contexts';
3
- export * from './hooks';
4
- export * from './screens';
5
- export * from './utils';
6
- export * from './navigation';
1
+ export { ChatProvider, ChatContext } from './contexts';
2
+ export { DesignSystemScreen } from './screens';
3
+ export { ChatStack } from './navigation';
4
+ export { ChatAdapters, ClipboardAdapter, Session, Client, } from './utils';
7
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA","sourcesContent":["export * from './components'\nexport * from './contexts'\nexport * from './hooks'\nexport * from './screens'\nexport * from './utils'\nexport * from './navigation'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwB,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAEL,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,MAAM,GACP,MAAM,SAAS,CAAA","sourcesContent":["export { ChatProvider, ChatContext, CreateChatThemeProps } from './contexts'\nexport { DesignSystemScreen } from './screens'\nexport { ChatStack } from './navigation'\nexport {\n TemporaryDefaultColorsType,\n ChatAdapters,\n ClipboardAdapter,\n Session,\n Client,\n} from './utils'\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAGnE,OAAO,EAAE,oBAAoB,EAAsB,MAAM,mCAAmC,CAAA;AAE5F,eAAO,MAAM,SAAS;;;;;;;;;uOAFb,mBAAkB;;;;;;;;;uBAiDq3gB,gBAAiB,KAAK;;;;;;;;;;;;;;;;;;;;;;;;EATp6gB,CAAA;AAEF,KAAK,kBAAkB,GAAG,eAAe,CAAC,OAAO,SAAS,CAAC,CAAA;AAE3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,eAAe,CAAC;QACxB,UAAU,aAAc,SAAQ,kBAAkB;SAAG;KACtD;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAGnE,OAAO,EAAE,oBAAoB,EAAsB,MAAM,mCAAmC,CAAA;AAE5F,eAAO,MAAM,SAAS;;;;;;;;;uOAFb,mBAAkB;;;;;;;;;uBAiDyqhB,gBAAiB,KAAK;;;;;;;;;;;;;;;;;;;;;;;;EATxthB,CAAA;AAEF,KAAK,kBAAkB,GAAG,eAAe,CAAC,OAAO,SAAS,CAAC,CAAA;AAE3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,eAAe,CAAC;QACxB,UAAU,aAAc,SAAQ,kBAAkB;SAAG;KACtD;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EAGlB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,KAAoB,MAAM,OAAO,CAAA;AAUxC,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;IACtD,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAC,CAAA;AAEF,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE,uBAAuB,qBA6CpE"}
1
+ {"version":3,"file":"conversation_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAGlB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAoB,MAAM,OAAO,CAAA;AAUxC,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;IACtD,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAC,CAAA;AAEF,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE,uBAAuB,qBA4CpE"}
@@ -1,12 +1,10 @@
1
- import { PlatformPressable } from '@react-navigation/elements';
2
1
  import { useNavigation, useTheme as useNavigationTheme, } from '@react-navigation/native';
3
- import colorFunction from 'color';
4
2
  import React, { useEffect } from 'react';
5
- import { FlatList, StyleSheet, TextInput, View } from 'react-native';
6
- import { SafeAreaView } from 'react-native-safe-area-context';
7
- import { MessageReaction } from '../components/conversation/message_reaction';
8
- import { Avatar, Text } from '../components/display';
9
- import { useTheme } from '../hooks';
3
+ import { FlatList, StyleSheet, View } from 'react-native';
4
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
+ import { Message } from '../components/conversation/message';
6
+ import { MessageForm } from '../components/conversation/message_form';
7
+ import { KeyboardView } from '../components/display/keyboard_view';
10
8
  import { useConversationMessages } from '../hooks/use_conversation_messages';
11
9
  import { useSuspenseGet } from '../hooks/use_suspense_api';
12
10
  export function ConversationScreen({ route }) {
@@ -27,97 +25,36 @@ export function ConversationScreen({ route }) {
27
25
  useEffect(() => {
28
26
  navigation.setOptions({ title: conversation?.title });
29
27
  }, [conversation, conversation_id, navigation]);
30
- return (<SafeAreaView style={styles.container} edges={['top', 'bottom', 'left', 'right']}>
31
- <FlatList inverted contentContainerStyle={styles.listContainer} refreshing={isRefetching} onRefresh={refetch} data={messages} keyExtractor={item => item.id} renderItem={({ item }) => <Message {...item} conversation_id={conversation_id}/>} onEndReached={() => fetchNextPage()}/>
32
- <View style={styles.textInputContainer}>
33
- <TextInput aria-disabled={true} placeholder="Send a message" onChangeText={() => console.log('TODO: Implement sending a message')} value="" style={styles.textInput}/>
34
- </View>
35
- </SafeAreaView>);
28
+ return (<View style={styles.container}>
29
+ <KeyboardView style={styles.keyboardView}>
30
+ <FlatList inverted contentContainerStyle={styles.listContainer} refreshing={isRefetching} onRefresh={refetch} data={messages} keyExtractor={item => item.id} renderItem={({ item }) => <Message {...item} conversation_id={conversation_id}/>} onEndReached={() => fetchNextPage()}/>
31
+ <MessageForm.Root conversation={conversation}>
32
+ {/* <MessageForm.AttachmentPicker /> */}
33
+ {/* <MessageForm.Commands /> */}
34
+ <MessageForm.TextInput />
35
+ <MessageForm.SubmitButton />
36
+ </MessageForm.Root>
37
+ </KeyboardView>
38
+ </View>);
36
39
  }
37
40
  const useStyles = () => {
38
41
  const navigationTheme = useNavigationTheme();
42
+ const { bottom } = useSafeAreaInsets();
39
43
  return StyleSheet.create({
40
44
  container: {
41
45
  flex: 1,
42
46
  justifyContent: 'center',
43
47
  backgroundColor: navigationTheme.colors.card,
48
+ paddingBottom: bottom,
49
+ },
50
+ keyboardView: {
51
+ flex: 1,
44
52
  },
45
53
  listContainer: {
46
54
  gap: 12,
47
55
  paddingHorizontal: 16,
48
56
  paddingVertical: 12,
49
57
  },
50
- textInputContainer: {
51
- borderTopWidth: 1,
52
- padding: 12,
53
- backgroundColor: navigationTheme.colors.card,
54
- },
55
- textInput: { borderRadius: 16, borderWidth: 1, padding: 12 },
56
- });
57
- };
58
- function Message(props) {
59
- const { text, conversation_id, reactionCounts } = props;
60
- const styles = useMessageStyles(props);
61
- const navigation = useNavigation();
62
- const handleMessagePress = () => {
63
- navigation.navigate('MessageActions', {
64
- message_id: props.id,
65
- conversation_id,
66
- });
67
- };
68
- // TODO: open the reaction screen to show who reacted
69
- const handleReactionPress = handleMessagePress;
70
- if (!text)
71
- return null;
72
- return (<View style={styles.message}>
73
- {!props.mine && (<View style={styles.messageAuthor}>
74
- <Avatar size={'md'} sourceUri={props.author.avatar}/>
75
- </View>)}
76
- <View style={styles.messageContent}>
77
- {!props.mine && (<Text variant="tertiary" style={styles.authorName}>
78
- {props.author.name}
79
- </Text>)}
80
- <PlatformPressable style={styles.messageBubble} onLongPress={handleMessagePress}>
81
- <Text style={styles.messageText}>{text}</Text>
82
- </PlatformPressable>
83
- <View style={styles.messageReactions}>
84
- {reactionCounts.map(reaction => (<MessageReaction key={reaction.value} reaction={reaction} onPress={handleReactionPress}/>))}
85
- </View>
86
- </View>
87
- </View>);
88
- }
89
- const useMessageStyles = ({ mine }) => {
90
- const { colors } = useTheme();
91
- const activeColor = colorFunction(colors.interaction).alpha(0.2).string();
92
- return StyleSheet.create({
93
- message: {
94
- gap: 8,
95
- flexDirection: mine ? 'row-reverse' : 'row',
96
- },
97
- messageContent: {
98
- gap: 8,
99
- flexShrink: 1,
100
- },
101
- messageAuthor: {
102
- flexDirection: 'row',
103
- gap: 8,
104
- },
105
- authorName: {},
106
- authorAvatar: {},
107
- messageBubble: {
108
- backgroundColor: mine ? activeColor : colors.fillColorNeutral070,
109
- borderRadius: 12,
110
- paddingVertical: 6,
111
- paddingHorizontal: 8,
112
- },
113
- messageText: {
114
- color: colors.textColorDefaultPrimary,
115
- },
116
- messageReactions: {
117
- flexDirection: 'row',
118
- gap: 4,
119
- justifyContent: mine ? 'flex-end' : 'flex-start',
120
- },
121
58
  });
122
59
  };
123
60
  //# sourceMappingURL=conversation_screen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAEL,aAAa,EACb,QAAQ,IAAI,kBAAkB,GAC/B,MAAM,0BAA0B,CAAA;AACjC,OAAO,aAAa,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAQ1D,MAAM,UA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AE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;SACjD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport {\n StaticScreenProps,\n useNavigation,\n useTheme as useNavigationTheme,\n} from '@react-navigation/native'\nimport colorFunction from 'color'\nimport React, { useEffect } from 'react'\nimport { FlatList, StyleSheet, TextInput, View } from 'react-native'\nimport { SafeAreaView } from 'react-native-safe-area-context'\nimport { MessageReaction } from '../components/conversation/message_reaction'\nimport { Avatar, Text } from '../components/display'\nimport { useTheme } from '../hooks'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useSuspenseGet } from '../hooks/use_suspense_api'\nimport { ConversationResource, MessageResource } from '../types'\n\nexport type ConversationScreenProps = StaticScreenProps<{\n conversation_id: string\n chat_group_graph_id: string\n}>\n\nexport function ConversationScreen({ route }: ConversationScreenProps) {\n const navigation = useNavigation()\n const { conversation_id } = route.params\n const styles = useStyles()\n\n const { data: conversation } = useSuspenseGet<ConversationResource>({\n url: `/me/conversations/${conversation_id}`,\n data: {\n fields: {\n Conversation: ['title'],\n },\n },\n })\n\n const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({\n conversation_id,\n })\n\n useEffect(() => {\n navigation.setOptions({ title: conversation?.title })\n }, [conversation, conversation_id, navigation])\n\n return (\n <SafeAreaView style={styles.container} edges={['top', 'bottom', 'left', 'right']}>\n <FlatList\n inverted\n contentContainerStyle={styles.listContainer}\n refreshing={isRefetching}\n onRefresh={refetch}\n data={messages}\n keyExtractor={item => item.id}\n renderItem={({ item }) => <Message {...item} conversation_id={conversation_id} />}\n onEndReached={() => fetchNextPage()}\n />\n <View style={styles.textInputContainer}>\n <TextInput\n aria-disabled={true}\n placeholder=\"Send a message\"\n onChangeText={() => console.log('TODO: Implement sending a message')}\n value=\"\"\n style={styles.textInput}\n />\n </View>\n </SafeAreaView>\n )\n}\n\nconst useStyles = () => {\n const navigationTheme = useNavigationTheme()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n backgroundColor: navigationTheme.colors.card,\n },\n listContainer: {\n gap: 12,\n paddingHorizontal: 16,\n paddingVertical: 12,\n },\n textInputContainer: {\n borderTopWidth: 1,\n padding: 12,\n backgroundColor: navigationTheme.colors.card,\n },\n textInput: { borderRadius: 16, borderWidth: 1, padding: 12 },\n })\n}\n\nfunction Message(props: MessageResource & { conversation_id: string }) {\n const { text, conversation_id, reactionCounts } = props\n const styles = useMessageStyles(props)\n const navigation = useNavigation()\n const handleMessagePress = () => {\n navigation.navigate('MessageActions', {\n message_id: props.id,\n conversation_id,\n })\n }\n // TODO: open the reaction screen to show who reacted\n const handleReactionPress = handleMessagePress\n\n if (!text) return null\n\n return (\n <View style={styles.message}>\n {!props.mine && (\n <View style={styles.messageAuthor}>\n <Avatar size={'md'} sourceUri={props.author.avatar} />\n </View>\n )}\n <View style={styles.messageContent}>\n {!props.mine && (\n <Text variant=\"tertiary\" style={styles.authorName}>\n {props.author.name}\n </Text>\n )}\n <PlatformPressable style={styles.messageBubble} onLongPress={handleMessagePress}>\n <Text style={styles.messageText}>{text}</Text>\n </PlatformPressable>\n <View style={styles.messageReactions}>\n {reactionCounts.map(reaction => (\n <MessageReaction\n key={reaction.value}\n reaction={reaction}\n onPress={handleReactionPress}\n />\n ))}\n </View>\n </View>\n </View>\n )\n}\n\nconst useMessageStyles = ({ mine }: MessageResource) => {\n const { colors } = useTheme()\n const activeColor = colorFunction(colors.interaction).alpha(0.2).string()\n\n return StyleSheet.create({\n message: {\n gap: 8,\n flexDirection: mine ? 'row-reverse' : 'row',\n },\n messageContent: {\n gap: 8,\n flexShrink: 1,\n },\n messageAuthor: {\n flexDirection: 'row',\n gap: 8,\n },\n authorName: {},\n authorAvatar: {},\n messageBubble: {\n backgroundColor: mine ? activeColor : colors.fillColorNeutral070,\n borderRadius: 12,\n paddingVertical: 6,\n paddingHorizontal: 8,\n },\n messageText: {\n color: colors.textColorDefaultPrimary,\n },\n messageReactions: {\n flexDirection: 'row',\n gap: 4,\n justifyContent: mine ? 'flex-end' : 'flex-start',\n },\n })\n}\n"]}
1
+ {"version":3,"file":"conversation_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,QAAQ,IAAI,kBAAkB,GAC/B,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAQ1D,MAAM,UAAU,kBAAkB,CAAC,EAAE,KAAK,EAA2B;IACnE,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC,MAAM,CAAA;IACxC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,cAAc,CAAuB;QAClE,GAAG,EAAE,qBAAqB,eAAe,EAAE;QAC3C,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,YAAY,EAAE,CAAC,OAAO,CAAC;aACxB;SACF;KACF,CAAC,CAAA;IAEF,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,uBA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ACrB,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAA;IAC5C,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEtC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;YACxB,eAAe,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI;YAC5C,aAAa,EAAE,MAAM;SACtB;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,EAAE;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {\n StaticScreenProps,\n useNavigation,\n useTheme as useNavigationTheme,\n} from '@react-navigation/native'\nimport React, { useEffect } from 'react'\nimport { FlatList, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Message } from '../components/conversation/message'\nimport { MessageForm } from '../components/conversation/message_form'\nimport { KeyboardView } from '../components/display/keyboard_view'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useSuspenseGet } from '../hooks/use_suspense_api'\nimport { ConversationResource } from '../types'\n\nexport type ConversationScreenProps = StaticScreenProps<{\n conversation_id: string\n chat_group_graph_id: string\n}>\n\nexport function ConversationScreen({ route }: ConversationScreenProps) {\n const navigation = useNavigation()\n const { conversation_id } = route.params\n const styles = useStyles()\n\n const { data: conversation } = useSuspenseGet<ConversationResource>({\n url: `/me/conversations/${conversation_id}`,\n data: {\n fields: {\n Conversation: ['title'],\n },\n },\n })\n\n const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({\n conversation_id,\n })\n\n useEffect(() => {\n navigation.setOptions({ title: conversation?.title })\n }, [conversation, conversation_id, navigation])\n\n return (\n <View style={styles.container}>\n <KeyboardView style={styles.keyboardView}>\n <FlatList\n inverted\n contentContainerStyle={styles.listContainer}\n refreshing={isRefetching}\n onRefresh={refetch}\n data={messages}\n keyExtractor={item => item.id}\n renderItem={({ item }) => <Message {...item} conversation_id={conversation_id} />}\n onEndReached={() => fetchNextPage()}\n />\n <MessageForm.Root conversation={conversation}>\n {/* <MessageForm.AttachmentPicker /> */}\n {/* <MessageForm.Commands /> */}\n <MessageForm.TextInput />\n <MessageForm.SubmitButton />\n </MessageForm.Root>\n </KeyboardView>\n </View>\n )\n}\n\nconst useStyles = () => {\n const navigationTheme = useNavigationTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n backgroundColor: navigationTheme.colors.card,\n paddingBottom: bottom,\n },\n keyboardView: {\n flex: 1,\n },\n listContainer: {\n gap: 12,\n paddingHorizontal: 16,\n paddingVertical: 12,\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"message_actions_screen.d.ts","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAG7E,OAAO,KAAqB,MAAM,OAAO,CAAA;AAYzC,eAAO,MAAM,kBAAkB,EAAE,4BAKhC,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;IAClD,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,EAAE,mBAAmB,qBAmGlE"}
1
+ {"version":3,"file":"message_actions_screen.d.ts","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAE7E,OAAO,KAAkC,MAAM,OAAO,CAAA;AAatD,eAAO,MAAM,kBAAkB,EAAE,4BAKhC,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;IAClD,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,EAAE,mBAAmB,qBAiHlE"}