@planningcenter/chat-react-native 3.9.0-rc.2 → 3.9.0-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/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +37 -10
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/display/icon_button.d.ts +2 -1
- package/build/components/display/icon_button.d.ts.map +1 -1
- package/build/components/display/icon_button.js.map +1 -1
- package/build/screens/send_giphy_screen.d.ts +1 -2
- package/build/screens/send_giphy_screen.d.ts.map +1 -1
- package/build/screens/send_giphy_screen.js +67 -39
- package/build/screens/send_giphy_screen.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversation/message_form.tsx +44 -14
- package/src/components/display/icon_button.tsx +2 -2
- package/src/screens/send_giphy_screen.tsx +100 -56
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuD,MAAM,OAAO,CAAA;AAC3E,OAAO,EAAoD,SAAS,EAAE,MAAM,cAAc,CAAA;AAG1F,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAkBnE,eAAO,MAAM,WAAW;;;;;;CAOvB,CAAA;AAED,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,YAAY,EAAE,oBAAoB,CAAA;IAClC,uBAAuB,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;CACjD;
|
|
1
|
+
{"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuD,MAAM,OAAO,CAAA;AAC3E,OAAO,EAAoD,SAAS,EAAE,MAAM,cAAc,CAAA;AAG1F,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAkBnE,eAAO,MAAM,WAAW;;;;;;CAOvB,CAAA;AAED,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,YAAY,EAAE,oBAAoB,CAAA;IAClC,uBAAuB,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;CACjD;AA4BD,iBAAS,eAAe,CAAC,EACvB,YAAY,EACZ,uBAAuB,EACvB,QAAQ,GACT,EAAE,qBAAqB,qBAqHvB;AAiCD,iBAAS,gBAAgB,sBA6CxB;AAcD,iBAAS,oBAAoB,sBAgD5B;AAED,iBAAS,2BAA2B,6BAoFnC;AAED,iBAAS,mBAAmB,6BAgC3B"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useNavigation, useTheme as useNavigationTheme, useRoute, } from '@react-navigation/native';
|
|
2
2
|
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
|
3
3
|
import { Platform, Pressable, StyleSheet, TextInput, View } from 'react-native';
|
|
4
|
-
import { Icon, IconButton, Text } from '../../components';
|
|
4
|
+
import { Icon, IconButton, Text, TextButton } from '../../components';
|
|
5
5
|
import { useCreateAndroidRippleColor, useTheme } from '../../hooks';
|
|
6
6
|
import { ChatContext } from '../../contexts/chat_context';
|
|
7
7
|
import { ImagePicker } from '../../utils/native_adapters';
|
|
8
|
-
import { platformPressedOpacityStyle } from '../../utils';
|
|
8
|
+
import { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils';
|
|
9
9
|
import { useAttachmentUploader } from '../../hooks/use_attachment_uploader';
|
|
10
10
|
import { MessageFormAttachmentImage } from './message_form/message_form_attachment_image';
|
|
11
11
|
import { useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update';
|
|
@@ -28,6 +28,7 @@ const MessageFormContext = React.createContext({
|
|
|
28
28
|
usingGiphy: false,
|
|
29
29
|
setUsingGiphy: (_usingGiphy) => { },
|
|
30
30
|
currentlyEditingMessage: null,
|
|
31
|
+
reset: () => { },
|
|
31
32
|
});
|
|
32
33
|
const GIPHY_MAX_LENGTH = 50;
|
|
33
34
|
const MAX_MESSAGE_LENGTH = 5000;
|
|
@@ -128,6 +129,7 @@ function MessageFormRoot({ conversation, currentlyEditingMessage, children, }) {
|
|
|
128
129
|
setUsingGiphy,
|
|
129
130
|
attachmentUploader,
|
|
130
131
|
currentlyEditingMessage,
|
|
132
|
+
reset,
|
|
131
133
|
}}>
|
|
132
134
|
<View style={styles.container}>
|
|
133
135
|
<EditingIndicator />
|
|
@@ -178,10 +180,21 @@ function MessageFormInput() {
|
|
|
178
180
|
{attachmentError ? <Text style={styles.inputErrorMessage}>{attachmentError}</Text> : null}
|
|
179
181
|
</View>);
|
|
180
182
|
}
|
|
183
|
+
const SUBMIT_ACCESSIBILITY_LABEL_MAP = {
|
|
184
|
+
giphy: 'Search Giphy',
|
|
185
|
+
editing: 'Save changes',
|
|
186
|
+
send: 'Send message',
|
|
187
|
+
};
|
|
188
|
+
const SUBMIT_ICON_NAME_MAP = {
|
|
189
|
+
giphy: 'general.search',
|
|
190
|
+
editing: 'general.check',
|
|
191
|
+
send: 'general.upArrow',
|
|
192
|
+
};
|
|
181
193
|
function MessageFormSubmitBtn() {
|
|
182
|
-
const { onSubmit, disabled, usingGiphy } = React.useContext(MessageFormContext);
|
|
194
|
+
const { onSubmit, disabled, usingGiphy, currentlyEditingMessage } = React.useContext(MessageFormContext);
|
|
183
195
|
const styles = useMessageFormStyles();
|
|
184
196
|
const { colors } = useTheme();
|
|
197
|
+
const formStateKey = usingGiphy ? 'giphy' : currentlyEditingMessage ? 'editing' : 'send';
|
|
185
198
|
const colorKey = disabled ? 'disabled' : 'interaction';
|
|
186
199
|
const interactionStart = colors.buttonStart || colors.interaction;
|
|
187
200
|
const interactionEnd = colors.buttonEnd || colors.interaction;
|
|
@@ -195,12 +208,12 @@ function MessageFormSubmitBtn() {
|
|
|
195
208
|
const androidRippleColor = useCreateAndroidRippleColor({ color: colorMap[colorKey][0] });
|
|
196
209
|
const gradientColors = colorMap[colorKey];
|
|
197
210
|
const iconStyles = [styles.submitIcon, disabled && styles.submitIconDisabled];
|
|
198
|
-
return (<Pressable disabled={disabled} onPress={onSubmit} accessibilityRole="button" accessibilityLabel={
|
|
211
|
+
return (<Pressable disabled={disabled} onPress={onSubmit} accessibilityRole="button" accessibilityLabel={SUBMIT_ACCESSIBILITY_LABEL_MAP[formStateKey]} style={({ pressed }) => [
|
|
199
212
|
styles.submitPressableWrapper,
|
|
200
213
|
pressed && platformPressedOpacityStyle,
|
|
201
214
|
]} android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}>
|
|
202
215
|
<LinearGradient start={{ x: 0.1, y: 0.1 }} end={{ x: 0.9, y: 0.9 }} colors={gradientColors} style={styles.submitGradientWrapper}>
|
|
203
|
-
<Icon name={
|
|
216
|
+
<Icon name={SUBMIT_ICON_NAME_MAP[formStateKey]} style={iconStyles} accessibilityElementsHidden={true}/>
|
|
204
217
|
</LinearGradient>
|
|
205
218
|
</Pressable>);
|
|
206
219
|
}
|
|
@@ -265,15 +278,21 @@ function MessageFormCommands() {
|
|
|
265
278
|
return (<IconButton accessibilityLabel="Search Giphy" size="lg" appearance="neutral" name={'general.bolt'} onPress={() => setUsingGiphy(true)} disabled={text.length > GIPHY_MAX_LENGTH} style={styles.formButton}/>);
|
|
266
279
|
}
|
|
267
280
|
function EditingIndicator() {
|
|
268
|
-
const { currentlyEditingMessage } = React.useContext(MessageFormContext);
|
|
281
|
+
const { currentlyEditingMessage, reset } = React.useContext(MessageFormContext);
|
|
269
282
|
const styles = useMessageFormStyles();
|
|
270
|
-
const navigation = useNavigation();
|
|
271
283
|
if (!currentlyEditingMessage) {
|
|
272
284
|
return null;
|
|
273
285
|
}
|
|
274
286
|
return (<View style={styles.editingIndicator}>
|
|
275
|
-
<
|
|
276
|
-
|
|
287
|
+
<View style={styles.editingIndicatorTitleContainer}>
|
|
288
|
+
<Icon name="accounts.editor" size={16}/>
|
|
289
|
+
<Text variant="tertiary" style={styles.editingIndicatorTitle}>
|
|
290
|
+
Editing message
|
|
291
|
+
</Text>
|
|
292
|
+
</View>
|
|
293
|
+
<TextButton onPress={() => reset()} accessibilityHint="Exit message editing mode without saving">
|
|
294
|
+
Cancel
|
|
295
|
+
</TextButton>
|
|
277
296
|
</View>);
|
|
278
297
|
}
|
|
279
298
|
const useMessageFormStyles = () => {
|
|
@@ -385,10 +404,18 @@ const useMessageFormStyles = () => {
|
|
|
385
404
|
editingIndicator: {
|
|
386
405
|
flexDirection: 'row',
|
|
387
406
|
alignItems: 'center',
|
|
388
|
-
justifyContent: '
|
|
407
|
+
justifyContent: 'space-between',
|
|
389
408
|
gap: 8,
|
|
390
409
|
paddingBottom: 12,
|
|
391
410
|
},
|
|
411
|
+
editingIndicatorTitleContainer: {
|
|
412
|
+
flexDirection: 'row',
|
|
413
|
+
alignItems: 'center',
|
|
414
|
+
gap: 8,
|
|
415
|
+
},
|
|
416
|
+
editingIndicatorTitle: {
|
|
417
|
+
fontWeight: platformFontWeightMedium,
|
|
418
|
+
},
|
|
392
419
|
});
|
|
393
420
|
};
|
|
394
421
|
//# sourceMappingURL=message_form.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_form.js","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,QAAQ,IAAI,kBAAkB,EAC9B,QAAQ,GACT,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3E,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AAC1F,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAKnE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,E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,CAAC;gBACjB,GAAG,EAAE;oBACH,WAAW,EAAE,CAAC;oBACd,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,sBAAsB;iBACjD;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;SACH;QACD,sBAAsB,EAAE;YACtB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;SACP;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;YACnC,QAAQ,EAAE,EAAE;SACb;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,GAAG,EAAE,CAAC;YACN,aAAa,EAAE,EAAE;SAClB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {\n RouteProp,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport React, { useCallback, useContext, useEffect, useState } from 'react'\nimport { Platform, Pressable, StyleSheet, TextInput, View, ViewProps } from 'react-native'\nimport { Icon, IconButton, Text } from '../../components'\nimport { useCreateAndroidRippleColor, useTheme } from '../../hooks'\nimport { ConversationResource, MessageResource } from '../../types'\n\nimport { ConversationScreenProps } from '../../screens/conversation_screen'\n\nimport { ChatContext } from '../../contexts/chat_context'\nimport { ImagePicker, ImagePickerResult } from '../../utils/native_adapters'\nimport { platformPressedOpacityStyle } from '../../utils'\nimport { useAttachmentUploader } from '../../hooks/use_attachment_uploader'\nimport {\n DenormalizedAttachmentResourceForCreate,\n DenormalizedMessageAttachmentResourceForCreate,\n} from '../../types/resources/denormalized_attachment_resource'\nimport { MessageFormAttachmentImage } from './message_form/message_form_attachment_image'\nimport { useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'\nimport { useBroadcastTypingStatus } from '../../hooks/use_broadcast_typing_status'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport LinearGradient from 'react-native-linear-gradient'\n\nexport const MessageForm = {\n Root: MessageFormRoot,\n\n TextInput: MessageFormInput,\n SubmitButton: MessageFormSubmitBtn,\n AttachmentPicker: MessageFormAttachmentPicker,\n Commands: MessageFormCommands,\n}\n\ninterface MessagesFormRootProps extends ViewProps {\n conversation: ConversationResource\n currentlyEditingMessage?: MessageResource | null\n}\n\nconst MessageFormContext = React.createContext<{\n text: string\n setText: (text: string) => void\n onSubmit: () => void\n disabled: boolean\n canGiphy: boolean\n usingGiphy: boolean\n setUsingGiphy: (usingGiphy: boolean) => void\n attachmentUploader?: ReturnType<typeof useAttachmentUploader>\n currentlyEditingMessage?: MessageResource | null\n}>({\n text: '',\n setText: (_text: string) => {},\n onSubmit: () => {},\n disabled: false,\n canGiphy: false,\n usingGiphy: false,\n setUsingGiphy: (_usingGiphy: boolean) => {},\n currentlyEditingMessage: null,\n})\n\nconst GIPHY_MAX_LENGTH = 50\nconst MAX_MESSAGE_LENGTH = 5000\n\nfunction MessageFormRoot({\n conversation,\n currentlyEditingMessage,\n children,\n}: MessagesFormRootProps) {\n const { giphyApiKey } = useContext(ChatContext)\n const canGiphy = !!giphyApiKey && !currentlyEditingMessage\n const styles = useMessageFormStyles()\n const [text, setText] = React.useState('')\n const [usingGiphy, setUsingGiphy] = useState(false)\n const navigation = useNavigation()\n const route = useRoute() as ConversationScreenProps['route']\n const {\n status,\n isPending,\n reset: resetMutation,\n mutateAsync,\n } = useMessageCreateOrUpdate({\n conversationId: conversation.id,\n messageId: currentlyEditingMessage?.id || null,\n })\n const attachmentUploader = useAttachmentUploader({\n conversationId: conversation.id,\n })\n const resetAttachmentUploader = attachmentUploader.reset\n\n const reset = useCallback(() => {\n resetAttachmentUploader()\n resetMutation()\n setText('')\n setUsingGiphy(false)\n navigation.setParams({\n editing_message_id: null,\n })\n }, [resetAttachmentUploader, resetMutation, navigation])\n\n useEffect(() => {\n if (canGiphy && !usingGiphy && text.startsWith('/giphy ')) {\n setUsingGiphy(true)\n setText('')\n }\n }, [canGiphy, text, usingGiphy])\n\n useEffect(() => {\n switch (status) {\n case 'success':\n reset()\n break\n }\n }, [reset, status])\n\n useEffect(() => {\n if (route.params.clear_input) {\n reset()\n navigation.setParams({ ...route.params, clear_input: false })\n }\n }, [reset, navigation, route.params])\n\n const canSubmit = (() => {\n if (isPending) return false\n if (attachmentUploader?.pendingUploads) return false\n if (text.length > 0) return true\n if (attachmentUploader?.attachments?.length) return true\n return false\n })()\n const disabled = !canSubmit\n\n const handleSubmit = () => {\n if (!canSubmit) return\n\n if (canGiphy && usingGiphy) {\n TextInput.State.blurTextInput(TextInput.State.currentlyFocusedInput())\n navigation.navigate('SendGiphy', {\n conversation_id: conversation.id,\n search_term: text,\n })\n } else {\n let attachmentsForSubmit: DenormalizedAttachmentResourceForCreate[] = []\n if (attachmentUploader?.attachmentIds) {\n attachmentsForSubmit = attachmentUploader.attachmentIds.map(\n (id: string): DenormalizedMessageAttachmentResourceForCreate => ({\n type: 'MessageAttachment',\n id,\n })\n )\n }\n if (currentlyEditingMessage) {\n mutateAsync({ text }).then(reset)\n } else {\n mutateAsync({ text, attachments: attachmentsForSubmit }).then(reset)\n }\n }\n }\n\n useEffect(() => {\n if (currentlyEditingMessage) {\n setText(currentlyEditingMessage.text || '')\n }\n }, [currentlyEditingMessage])\n\n return (\n <MessageFormContext.Provider\n value={{\n text,\n setText,\n onSubmit: handleSubmit,\n disabled,\n canGiphy,\n usingGiphy,\n setUsingGiphy,\n attachmentUploader,\n currentlyEditingMessage,\n }}\n >\n <View style={styles.container}>\n <EditingIndicator />\n <View style={styles.textInputContainer}>{children}</View>\n </View>\n </MessageFormContext.Provider>\n )\n}\n\nfunction MessageFormAttachments() {\n const styles = useMessageFormStyles()\n const { attachmentUploader } = React.useContext(MessageFormContext)\n const numberOfAttachments = attachmentUploader?.attachments?.length || 0\n const attachments = attachmentUploader?.attachments || []\n\n if (numberOfAttachments === 0) {\n return null\n }\n\n return (\n <View style={styles.messageFormAttachments}>\n {attachments.map(attachment => {\n return (\n <MessageFormAttachmentImage\n key={attachment.file.uri}\n uri={attachment.file.uri}\n alt={attachment.file.name}\n status={attachment.status}\n width={attachment.file.width}\n height={attachment.file.height}\n removeAttachment={() => {\n attachmentUploader?.removeAttachment(attachment)\n }}\n />\n )\n })}\n </View>\n )\n}\n\nfunction MessageFormInput() {\n const styles = useMessageFormStyles()\n const theme = useTheme()\n const { text, setText, onSubmit, usingGiphy, attachmentUploader } =\n React.useContext(MessageFormContext)\n const attachmentError = attachmentUploader?.errorMessage\n\n const route = useRoute<RouteProp<ConversationScreenProps['route']>>()\n const conversationId = route.params.conversation_id\n const broadcastTypingStatus = useBroadcastTypingStatus(conversationId)\n\n const handleTextChange = (newText: string) => {\n setText(newText)\n\n if (newText.length > 0) {\n broadcastTypingStatus()\n }\n }\n\n return (\n <View style={styles.textInputBoundary}>\n <MessageFormAttachments />\n <View style={styles.textInputRow}>\n {usingGiphy ? (\n <View style={styles.giphyBadge}>\n <Text style={styles.giphyBadgeText}>/giphy</Text>\n </View>\n ) : null}\n\n <TextInput\n style={[styles.textInput, usingGiphy && styles.textInputWithGiphy]}\n multiline={true}\n aria-disabled={true}\n placeholder=\"Send a message\"\n placeholderTextColor={theme.colors.textColorDefaultPlaceholder}\n onChangeText={handleTextChange}\n value={text}\n maxLength={usingGiphy ? GIPHY_MAX_LENGTH : MAX_MESSAGE_LENGTH}\n onSubmitEditing={onSubmit}\n />\n </View>\n\n {attachmentError ? <Text style={styles.inputErrorMessage}>{attachmentError}</Text> : null}\n </View>\n )\n}\n\nfunction MessageFormSubmitBtn() {\n const { onSubmit, disabled, usingGiphy } = React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n const { colors } = useTheme()\n\n const colorKey = disabled ? 'disabled' : 'interaction'\n const interactionStart = colors.buttonStart || colors.interaction\n const interactionEnd = colors.buttonEnd || colors.interaction\n const colorMap = {\n disabled: [\n colors.fillColorButtonNeutralSolidDisabled,\n colors.fillColorButtonNeutralSolidDisabled,\n ],\n interaction: [interactionStart, interactionEnd],\n }\n\n const androidRippleColor = useCreateAndroidRippleColor({ color: colorMap[colorKey][0] })\n const gradientColors = colorMap[colorKey] as [string, string]\n const iconStyles = [styles.submitIcon, disabled && styles.submitIconDisabled]\n\n return (\n <Pressable\n disabled={disabled}\n onPress={onSubmit}\n accessibilityRole=\"button\"\n accessibilityLabel={usingGiphy ? 'Search Giphy' : 'Send message'}\n style={({ pressed }) => [\n styles.submitPressableWrapper,\n pressed && platformPressedOpacityStyle,\n ]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n >\n <LinearGradient\n start={{ x: 0.1, y: 0.1 }}\n end={{ x: 0.9, y: 0.9 }}\n colors={gradientColors}\n style={styles.submitGradientWrapper}\n >\n <Icon\n name={usingGiphy ? 'general.search' : 'general.upArrow'}\n style={iconStyles}\n accessibilityElementsHidden={true}\n />\n </LinearGradient>\n </Pressable>\n )\n}\n\nfunction MessageFormAttachmentPicker() {\n const styles = useMessageFormStyles()\n const { usingGiphy, attachmentUploader, currentlyEditingMessage } =\n React.useContext(MessageFormContext)\n const [isOpen, setIsOpen] = useState(false)\n\n function uploadImagePickerResult(result: ImagePickerResult) {\n if (result.canceled) {\n return\n }\n\n const filteredAssets = result.assets\n .filter(asset => {\n return asset.fileSize && asset.fileName && asset.mimeType\n })\n .map(asset => {\n return {\n uri: asset.uri,\n name: asset.fileName as string,\n type: asset.mimeType as string,\n size: asset.fileSize as number,\n height: asset.height,\n width: asset.width,\n }\n })\n\n attachmentUploader?.handleFilesAttached(filteredAssets)\n }\n\n const openCamera = async () => {\n setIsOpen(false)\n let result = await ImagePicker.openCameraAsync()\n if (!result.canceled) {\n uploadImagePickerResult(result)\n }\n }\n\n const pickImage = async () => {\n setIsOpen(false)\n let result = await ImagePicker.openImageLibraryAsync()\n if (!result.canceled) {\n uploadImagePickerResult(result)\n }\n }\n\n if (usingGiphy || currentlyEditingMessage) {\n return null\n }\n\n return (\n <View style={styles.attachmentPicker}>\n {isOpen && (\n <View style={styles.attachmentPickerButtonsContainer}>\n <IconButton\n accessibilityLabel=\"Take a photo\"\n accessibilityHint=\"Opens your camera\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"chat.camera\"\n onPress={openCamera}\n style={styles.attachmentPickerButton}\n />\n <IconButton\n accessibilityLabel=\"Choose a photo\"\n accessibilityHint=\"Opens your photo gallery\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"churchCenter.photosIos\"\n onPress={pickImage}\n style={styles.attachmentPickerButton}\n />\n </View>\n )}\n <IconButton\n accessibilityLabel=\"File Menu\"\n accessibilityHint=\"Opens options to attach or take a photo\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"general.paperclip\"\n onPress={() => setIsOpen(!isOpen)}\n style={styles.formButton}\n />\n </View>\n )\n}\n\nfunction MessageFormCommands() {\n const { text, canGiphy, usingGiphy, setUsingGiphy } = React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n\n if (!canGiphy) {\n return null\n }\n\n if (usingGiphy) {\n return (\n <IconButton\n accessibilityLabel=\"Exit Giphy Search\"\n size=\"md\"\n appearance=\"neutral\"\n name={'general.x'}\n onPress={() => setUsingGiphy(false)}\n style={styles.formButton}\n />\n )\n }\n\n return (\n <IconButton\n accessibilityLabel=\"Search Giphy\"\n size=\"lg\"\n appearance=\"neutral\"\n name={'general.bolt'}\n onPress={() => setUsingGiphy(true)}\n disabled={text.length > GIPHY_MAX_LENGTH}\n style={styles.formButton}\n />\n )\n}\n\nfunction EditingIndicator() {\n const { currentlyEditingMessage } = React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n const navigation = useNavigation()\n\n if (!currentlyEditingMessage) {\n return null\n }\n\n return (\n <View style={styles.editingIndicator}>\n <Text>Editing message</Text>\n <IconButton\n accessibilityLabel=\"Exit message editing\"\n name={'general.x'}\n onPress={() => navigation.setParams({ editing_message_id: null })}\n />\n </View>\n )\n}\n\nconst useMessageFormStyles = () => {\n const theme = useTheme()\n const navigationTheme = useNavigationTheme()\n const buttonSize = 38\n\n return StyleSheet.create({\n container: {\n borderColor: theme.colors.borderColorDefaultDim,\n borderTopWidth: 1,\n padding: 12,\n },\n textInputContainer: {\n backgroundColor: navigationTheme.colors.card,\n flexDirection: 'row',\n alignItems: 'flex-end',\n gap: 16,\n },\n textInputBoundary: {\n borderRadius: 24,\n borderWidth: 1,\n borderColor: theme.colors.fillColorNeutral050Base,\n flex: 1,\n gap: 12,\n },\n textInputRow: {\n flexDirection: 'row',\n gap: 12,\n alignItems: 'center',\n },\n textInput: {\n paddingVertical: 8,\n paddingHorizontal: 16,\n color: theme.colors.textColorDefaultPrimary,\n textAlignVertical: 'center',\n justifyContent: 'center',\n flex: 1,\n fontSize: 16,\n maxHeight: 200,\n },\n textInputWithGiphy: {\n paddingLeft: 0,\n },\n giphyBadge: {\n backgroundColor: theme.colors.fillColorNeutral050Base,\n borderRadius: 24,\n paddingHorizontal: 12,\n marginLeft: 12,\n padding: 4,\n },\n giphyBadgeText: {\n fontSize: 14,\n color: theme.colors.interaction,\n },\n formButton: {\n height: buttonSize,\n },\n submitPressableWrapper: {\n borderRadius: buttonSize,\n overflow: 'hidden',\n },\n submitGradientWrapper: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: buttonSize,\n height: buttonSize,\n width: buttonSize,\n },\n submitIcon: {\n fontSize: 16,\n color: tokens.colorNeutral100White,\n },\n submitIconDisabled: {\n color: theme.colors.iconColorDefaultDisabled,\n },\n attachmentPicker: {\n position: 'relative',\n },\n attachmentPickerButtonsContainer: {\n position: 'absolute',\n left: 0,\n bottom: 40,\n zIndex: 10,\n gap: 12,\n },\n attachmentPickerButton: {\n backgroundColor: theme.colors.fillColorNeutral070,\n borderRadius: 20,\n height: buttonSize,\n width: buttonSize,\n elevation: 3,\n ...Platform.select({\n ios: {\n borderWidth: 1,\n borderColor: theme.colors.borderColorDefaultBase,\n },\n default: null,\n }),\n },\n messageFormAttachments: {\n flexDirection: 'row',\n gap: 8,\n },\n inputErrorMessage: {\n color: theme.colors.statusErrorText,\n fontSize: 14,\n },\n editingIndicator: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 8,\n paddingBottom: 12,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"message_form.js","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,QAAQ,IAAI,kBAAkB,EAC9B,QAAQ,GACT,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3E,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AAC1F,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAKnE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,WAAW,EAAqB,MAAM,6BAA6B,CAAA;AAC5E,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAK3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAA;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,cAAc,MAAM,8BAA8B,CAAA;AAEzD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,eAAe;IAErB,SAAS,EAAE,gBAAgB;IAC3B,YAAY,EAAE,oBAAoB;IAClC,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,QAAQ,CAAC,MAAM,CAAC;gBACjB,GAAG,EAAE;oBACH,WAAW,EAAE,CAAC;oBACd,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,sBAAsB;iBACjD;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;SACH;QACD,sBAAsB,EAAE;YACtB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;SACP;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;YACnC,QAAQ,EAAE,EAAE;SACb;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;YAC/B,GAAG,EAAE,CAAC;YACN,aAAa,EAAE,EAAE;SAClB;QACD,8BAA8B,EAAE;YAC9B,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,qBAAqB,EAAE;YACrB,UAAU,EAAE,wBAAwB;SACrC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {\n RouteProp,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport React, { useCallback, useContext, useEffect, useState } from 'react'\nimport { Platform, Pressable, StyleSheet, TextInput, View, ViewProps } from 'react-native'\nimport { Icon, IconButton, Text, TextButton } from '../../components'\nimport { useCreateAndroidRippleColor, useTheme } from '../../hooks'\nimport { ConversationResource, MessageResource } from '../../types'\n\nimport { ConversationScreenProps } from '../../screens/conversation_screen'\n\nimport { ChatContext } from '../../contexts/chat_context'\nimport { ImagePicker, ImagePickerResult } from '../../utils/native_adapters'\nimport { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils'\nimport { useAttachmentUploader } from '../../hooks/use_attachment_uploader'\nimport {\n DenormalizedAttachmentResourceForCreate,\n DenormalizedMessageAttachmentResourceForCreate,\n} from '../../types/resources/denormalized_attachment_resource'\nimport { MessageFormAttachmentImage } from './message_form/message_form_attachment_image'\nimport { useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'\nimport { useBroadcastTypingStatus } from '../../hooks/use_broadcast_typing_status'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport LinearGradient from 'react-native-linear-gradient'\n\nexport const MessageForm = {\n Root: MessageFormRoot,\n\n TextInput: MessageFormInput,\n SubmitButton: MessageFormSubmitBtn,\n AttachmentPicker: MessageFormAttachmentPicker,\n Commands: MessageFormCommands,\n}\n\ninterface MessagesFormRootProps extends ViewProps {\n conversation: ConversationResource\n currentlyEditingMessage?: MessageResource | null\n}\n\nconst MessageFormContext = React.createContext<{\n text: string\n setText: (text: string) => void\n onSubmit: () => void\n disabled: boolean\n canGiphy: boolean\n usingGiphy: boolean\n setUsingGiphy: (usingGiphy: boolean) => void\n attachmentUploader?: ReturnType<typeof useAttachmentUploader>\n currentlyEditingMessage?: MessageResource | null\n reset: () => void\n}>({\n text: '',\n setText: (_text: string) => {},\n onSubmit: () => {},\n disabled: false,\n canGiphy: false,\n usingGiphy: false,\n setUsingGiphy: (_usingGiphy: boolean) => {},\n currentlyEditingMessage: null,\n reset: () => {},\n})\n\nconst GIPHY_MAX_LENGTH = 50\nconst MAX_MESSAGE_LENGTH = 5000\n\nfunction MessageFormRoot({\n conversation,\n currentlyEditingMessage,\n children,\n}: MessagesFormRootProps) {\n const { giphyApiKey } = useContext(ChatContext)\n const canGiphy = !!giphyApiKey && !currentlyEditingMessage\n const styles = useMessageFormStyles()\n const [text, setText] = React.useState('')\n const [usingGiphy, setUsingGiphy] = useState(false)\n const navigation = useNavigation()\n const route = useRoute() as ConversationScreenProps['route']\n const {\n status,\n isPending,\n reset: resetMutation,\n mutateAsync,\n } = useMessageCreateOrUpdate({\n conversationId: conversation.id,\n messageId: currentlyEditingMessage?.id || null,\n })\n const attachmentUploader = useAttachmentUploader({\n conversationId: conversation.id,\n })\n const resetAttachmentUploader = attachmentUploader.reset\n\n const reset = useCallback(() => {\n resetAttachmentUploader()\n resetMutation()\n setText('')\n setUsingGiphy(false)\n navigation.setParams({\n editing_message_id: null,\n })\n }, [resetAttachmentUploader, resetMutation, navigation])\n\n useEffect(() => {\n if (canGiphy && !usingGiphy && text.startsWith('/giphy ')) {\n setUsingGiphy(true)\n setText('')\n }\n }, [canGiphy, text, usingGiphy])\n\n useEffect(() => {\n switch (status) {\n case 'success':\n reset()\n break\n }\n }, [reset, status])\n\n useEffect(() => {\n if (route.params.clear_input) {\n reset()\n navigation.setParams({ ...route.params, clear_input: false })\n }\n }, [reset, navigation, route.params])\n\n const canSubmit = (() => {\n if (isPending) return false\n if (attachmentUploader?.pendingUploads) return false\n if (text.length > 0) return true\n if (attachmentUploader?.attachments?.length) return true\n return false\n })()\n const disabled = !canSubmit\n\n const handleSubmit = () => {\n if (!canSubmit) return\n\n if (canGiphy && usingGiphy) {\n TextInput.State.blurTextInput(TextInput.State.currentlyFocusedInput())\n navigation.navigate('SendGiphy', {\n conversation_id: conversation.id,\n search_term: text,\n })\n } else {\n let attachmentsForSubmit: DenormalizedAttachmentResourceForCreate[] = []\n if (attachmentUploader?.attachmentIds) {\n attachmentsForSubmit = attachmentUploader.attachmentIds.map(\n (id: string): DenormalizedMessageAttachmentResourceForCreate => ({\n type: 'MessageAttachment',\n id,\n })\n )\n }\n if (currentlyEditingMessage) {\n mutateAsync({ text }).then(reset)\n } else {\n mutateAsync({ text, attachments: attachmentsForSubmit }).then(reset)\n }\n }\n }\n\n useEffect(() => {\n if (currentlyEditingMessage) {\n setText(currentlyEditingMessage.text || '')\n }\n }, [currentlyEditingMessage])\n\n return (\n <MessageFormContext.Provider\n value={{\n text,\n setText,\n onSubmit: handleSubmit,\n disabled,\n canGiphy,\n usingGiphy,\n setUsingGiphy,\n attachmentUploader,\n currentlyEditingMessage,\n reset,\n }}\n >\n <View style={styles.container}>\n <EditingIndicator />\n <View style={styles.textInputContainer}>{children}</View>\n </View>\n </MessageFormContext.Provider>\n )\n}\n\nfunction MessageFormAttachments() {\n const styles = useMessageFormStyles()\n const { attachmentUploader } = React.useContext(MessageFormContext)\n const numberOfAttachments = attachmentUploader?.attachments?.length || 0\n const attachments = attachmentUploader?.attachments || []\n\n if (numberOfAttachments === 0) {\n return null\n }\n\n return (\n <View style={styles.messageFormAttachments}>\n {attachments.map(attachment => {\n return (\n <MessageFormAttachmentImage\n key={attachment.file.uri}\n uri={attachment.file.uri}\n alt={attachment.file.name}\n status={attachment.status}\n width={attachment.file.width}\n height={attachment.file.height}\n removeAttachment={() => {\n attachmentUploader?.removeAttachment(attachment)\n }}\n />\n )\n })}\n </View>\n )\n}\n\nfunction MessageFormInput() {\n const styles = useMessageFormStyles()\n const theme = useTheme()\n const { text, setText, onSubmit, usingGiphy, attachmentUploader } =\n React.useContext(MessageFormContext)\n const attachmentError = attachmentUploader?.errorMessage\n\n const route = useRoute<RouteProp<ConversationScreenProps['route']>>()\n const conversationId = route.params.conversation_id\n const broadcastTypingStatus = useBroadcastTypingStatus(conversationId)\n\n const handleTextChange = (newText: string) => {\n setText(newText)\n\n if (newText.length > 0) {\n broadcastTypingStatus()\n }\n }\n\n return (\n <View style={styles.textInputBoundary}>\n <MessageFormAttachments />\n <View style={styles.textInputRow}>\n {usingGiphy ? (\n <View style={styles.giphyBadge}>\n <Text style={styles.giphyBadgeText}>/giphy</Text>\n </View>\n ) : null}\n\n <TextInput\n style={[styles.textInput, usingGiphy && styles.textInputWithGiphy]}\n multiline={true}\n aria-disabled={true}\n placeholder=\"Send a message\"\n placeholderTextColor={theme.colors.textColorDefaultPlaceholder}\n onChangeText={handleTextChange}\n value={text}\n maxLength={usingGiphy ? GIPHY_MAX_LENGTH : MAX_MESSAGE_LENGTH}\n onSubmitEditing={onSubmit}\n />\n </View>\n\n {attachmentError ? <Text style={styles.inputErrorMessage}>{attachmentError}</Text> : null}\n </View>\n )\n}\n\nconst SUBMIT_ACCESSIBILITY_LABEL_MAP = {\n giphy: 'Search Giphy',\n editing: 'Save changes',\n send: 'Send message',\n} as const\n\nconst SUBMIT_ICON_NAME_MAP = {\n giphy: 'general.search',\n editing: 'general.check',\n send: 'general.upArrow',\n} as const\n\nfunction MessageFormSubmitBtn() {\n const { onSubmit, disabled, usingGiphy, currentlyEditingMessage } =\n React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n const { colors } = useTheme()\n\n const formStateKey = usingGiphy ? 'giphy' : currentlyEditingMessage ? 'editing' : 'send'\n const colorKey = disabled ? 'disabled' : 'interaction'\n const interactionStart = colors.buttonStart || colors.interaction\n const interactionEnd = colors.buttonEnd || colors.interaction\n const colorMap = {\n disabled: [\n colors.fillColorButtonNeutralSolidDisabled,\n colors.fillColorButtonNeutralSolidDisabled,\n ],\n interaction: [interactionStart, interactionEnd],\n }\n\n const androidRippleColor = useCreateAndroidRippleColor({ color: colorMap[colorKey][0] })\n const gradientColors = colorMap[colorKey] as [string, string]\n const iconStyles = [styles.submitIcon, disabled && styles.submitIconDisabled]\n\n return (\n <Pressable\n disabled={disabled}\n onPress={onSubmit}\n accessibilityRole=\"button\"\n accessibilityLabel={SUBMIT_ACCESSIBILITY_LABEL_MAP[formStateKey]}\n style={({ pressed }) => [\n styles.submitPressableWrapper,\n pressed && platformPressedOpacityStyle,\n ]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n >\n <LinearGradient\n start={{ x: 0.1, y: 0.1 }}\n end={{ x: 0.9, y: 0.9 }}\n colors={gradientColors}\n style={styles.submitGradientWrapper}\n >\n <Icon\n name={SUBMIT_ICON_NAME_MAP[formStateKey]}\n style={iconStyles}\n accessibilityElementsHidden={true}\n />\n </LinearGradient>\n </Pressable>\n )\n}\n\nfunction MessageFormAttachmentPicker() {\n const styles = useMessageFormStyles()\n const { usingGiphy, attachmentUploader, currentlyEditingMessage } =\n React.useContext(MessageFormContext)\n const [isOpen, setIsOpen] = useState(false)\n\n function uploadImagePickerResult(result: ImagePickerResult) {\n if (result.canceled) {\n return\n }\n\n const filteredAssets = result.assets\n .filter(asset => {\n return asset.fileSize && asset.fileName && asset.mimeType\n })\n .map(asset => {\n return {\n uri: asset.uri,\n name: asset.fileName as string,\n type: asset.mimeType as string,\n size: asset.fileSize as number,\n height: asset.height,\n width: asset.width,\n }\n })\n\n attachmentUploader?.handleFilesAttached(filteredAssets)\n }\n\n const openCamera = async () => {\n setIsOpen(false)\n let result = await ImagePicker.openCameraAsync()\n if (!result.canceled) {\n uploadImagePickerResult(result)\n }\n }\n\n const pickImage = async () => {\n setIsOpen(false)\n let result = await ImagePicker.openImageLibraryAsync()\n if (!result.canceled) {\n uploadImagePickerResult(result)\n }\n }\n\n if (usingGiphy || currentlyEditingMessage) {\n return null\n }\n\n return (\n <View style={styles.attachmentPicker}>\n {isOpen && (\n <View style={styles.attachmentPickerButtonsContainer}>\n <IconButton\n accessibilityLabel=\"Take a photo\"\n accessibilityHint=\"Opens your camera\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"chat.camera\"\n onPress={openCamera}\n style={styles.attachmentPickerButton}\n />\n <IconButton\n accessibilityLabel=\"Choose a photo\"\n accessibilityHint=\"Opens your photo gallery\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"churchCenter.photosIos\"\n onPress={pickImage}\n style={styles.attachmentPickerButton}\n />\n </View>\n )}\n <IconButton\n accessibilityLabel=\"File Menu\"\n accessibilityHint=\"Opens options to attach or take a photo\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"general.paperclip\"\n onPress={() => setIsOpen(!isOpen)}\n style={styles.formButton}\n />\n </View>\n )\n}\n\nfunction MessageFormCommands() {\n const { text, canGiphy, usingGiphy, setUsingGiphy } = React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n\n if (!canGiphy) {\n return null\n }\n\n if (usingGiphy) {\n return (\n <IconButton\n accessibilityLabel=\"Exit Giphy Search\"\n size=\"md\"\n appearance=\"neutral\"\n name={'general.x'}\n onPress={() => setUsingGiphy(false)}\n style={styles.formButton}\n />\n )\n }\n\n return (\n <IconButton\n accessibilityLabel=\"Search Giphy\"\n size=\"lg\"\n appearance=\"neutral\"\n name={'general.bolt'}\n onPress={() => setUsingGiphy(true)}\n disabled={text.length > GIPHY_MAX_LENGTH}\n style={styles.formButton}\n />\n )\n}\n\nfunction EditingIndicator() {\n const { currentlyEditingMessage, reset } = React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n\n if (!currentlyEditingMessage) {\n return null\n }\n\n return (\n <View style={styles.editingIndicator}>\n <View style={styles.editingIndicatorTitleContainer}>\n <Icon name=\"accounts.editor\" size={16} />\n <Text variant=\"tertiary\" style={styles.editingIndicatorTitle}>\n Editing message\n </Text>\n </View>\n <TextButton\n onPress={() => reset()}\n accessibilityHint=\"Exit message editing mode without saving\"\n >\n Cancel\n </TextButton>\n </View>\n )\n}\n\nconst useMessageFormStyles = () => {\n const theme = useTheme()\n const navigationTheme = useNavigationTheme()\n const buttonSize = 38\n\n return StyleSheet.create({\n container: {\n borderColor: theme.colors.borderColorDefaultDim,\n borderTopWidth: 1,\n padding: 12,\n },\n textInputContainer: {\n backgroundColor: navigationTheme.colors.card,\n flexDirection: 'row',\n alignItems: 'flex-end',\n gap: 16,\n },\n textInputBoundary: {\n borderRadius: 24,\n borderWidth: 1,\n borderColor: theme.colors.fillColorNeutral050Base,\n flex: 1,\n gap: 12,\n },\n textInputRow: {\n flexDirection: 'row',\n gap: 12,\n alignItems: 'center',\n },\n textInput: {\n paddingVertical: 8,\n paddingHorizontal: 16,\n color: theme.colors.textColorDefaultPrimary,\n textAlignVertical: 'center',\n justifyContent: 'center',\n flex: 1,\n fontSize: 16,\n maxHeight: 200,\n },\n textInputWithGiphy: {\n paddingLeft: 0,\n },\n giphyBadge: {\n backgroundColor: theme.colors.fillColorNeutral050Base,\n borderRadius: 24,\n paddingHorizontal: 12,\n marginLeft: 12,\n padding: 4,\n },\n giphyBadgeText: {\n fontSize: 14,\n color: theme.colors.interaction,\n },\n formButton: {\n height: buttonSize,\n },\n submitPressableWrapper: {\n borderRadius: buttonSize,\n overflow: 'hidden',\n },\n submitGradientWrapper: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: buttonSize,\n height: buttonSize,\n width: buttonSize,\n },\n submitIcon: {\n fontSize: 16,\n color: tokens.colorNeutral100White,\n },\n submitIconDisabled: {\n color: theme.colors.iconColorDefaultDisabled,\n },\n attachmentPicker: {\n position: 'relative',\n },\n attachmentPickerButtonsContainer: {\n position: 'absolute',\n left: 0,\n bottom: 40,\n zIndex: 10,\n gap: 12,\n },\n attachmentPickerButton: {\n backgroundColor: theme.colors.fillColorNeutral070,\n borderRadius: 20,\n height: buttonSize,\n width: buttonSize,\n elevation: 3,\n ...Platform.select({\n ios: {\n borderWidth: 1,\n borderColor: theme.colors.borderColorDefaultBase,\n },\n default: null,\n }),\n },\n messageFormAttachments: {\n flexDirection: 'row',\n gap: 8,\n },\n inputErrorMessage: {\n color: theme.colors.statusErrorText,\n fontSize: 14,\n },\n editingIndicator: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 8,\n paddingBottom: 12,\n },\n editingIndicatorTitleContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n editingIndicatorTitle: {\n fontWeight: platformFontWeightMedium,\n },\n })\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type StyleProp } from 'react-native';
|
|
2
3
|
import type { PressableProps, ViewStyle } from 'react-native';
|
|
3
4
|
import type { IconProps, IconString } from './icon';
|
|
4
5
|
import type { IconButtonAppearanceUnion } from './utils/button_colors';
|
|
@@ -49,7 +50,7 @@ interface IconButtonProps extends PressableProps {
|
|
|
49
50
|
/**
|
|
50
51
|
* Styles the `Pressable` wrapper
|
|
51
52
|
*/
|
|
52
|
-
style?: ViewStyle
|
|
53
|
+
style?: StyleProp<ViewStyle>;
|
|
53
54
|
}
|
|
54
55
|
export declare function IconButton({ accessibilityLabel, appearance, disabled, iconStyle, loading, maxFontSizeMultiplier, name, size, style, ...props }: IconButtonProps): React.JSX.Element;
|
|
55
56
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon_button.d.ts","sourceRoot":"","sources":["../../../src/components/display/icon_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"icon_button.d.ts","sourceRoot":"","sources":["../../../src/components/display/icon_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAKnD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAMtE,QAAA,MAAM,KAAK;;;;;;;;;;CAUD,CAAA;AAEV,KAAK,SAAS,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,KAAK,CAAC,CAAA;AAmBnD,UAAU,eAAgB,SAAQ,cAAc;IAC9C;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAA;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,yBAAyB,CAAA;IACtC;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,IAAI,EAAE,UAAU,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC7B;AAED,wBAAgB,UAAU,CAAC,EACzB,kBAAkB,EAClB,UAAsB,EACtB,QAAgB,EAChB,SAAS,EACT,OAAO,EACP,qBAAqB,EACrB,IAAI,EACJ,IAAW,EACX,KAAK,EACL,GAAG,KAAK,EACT,EAAE,eAAe,qBAmEjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon_button.js","sourceRoot":"","sources":["../../../src/components/display/icon_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAGhF,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACJ,CAAA;AA2DV,MAAM,UAAU,UAAU,CAAC,EACzB,kBAAkB,EAClB,UAAU,GAAG,SAAS,EACtB,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,OAAO,EACP,qBAAqB,EACrB,IAAI,EACJ,IAAI,GAAG,IAAI,EACX,KAAK,EACL,GAAG,KAAK,EACQ;IAChB,MAAM,MAAM,GAAG,SAAS,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,CAAA;IACxF,MAAM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AQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ;YACrC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC;SAChC;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;QACD,OAAO,EAAE;YACP,OAAO,EAAE,CAAC;SACX;QACD,OAAO,EAAE;YACP,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ;SACtC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\nimport type { PressableProps, ViewStyle } from 'react-native'\nimport { Icon } from './icon'\nimport type { IconProps, IconString } from './icon'\nimport { useTheme, useFontScale, useCreateAndroidRippleColor } from '../../hooks'\nimport { platformPressedOpacityStyle } from '../../utils'\nimport { Spinner } from './spinner'\nimport { getColorKey, useIconButtonColorOptionMap } from './utils/button_colors'\nimport type { IconButtonAppearanceUnion } from './utils/button_colors'\n\n// =================================\n// ====== Constants ================\n// =================================\n\nconst SIZES = {\n xxxs: 'xxxs',\n xxs: 'xxs',\n xs: 'xs',\n sm: 'sm',\n md: 'md',\n lg: 'lg',\n xl: 'xl',\n xxl: 'xxl',\n xxxl: 'xxxl',\n} as const\n\ntype SizeUnion = (typeof SIZES)[keyof typeof SIZES]\ntype SizeStyle = Record<\n SizeUnion,\n {\n fontSize: number\n height: number\n }\n>\ntype AndroidRadiusSize = Record<\n SizeUnion,\n {\n radius: number\n }\n>\n\n// =================================\n// ====== Component ================\n// =================================\n\ninterface IconButtonProps extends PressableProps {\n /**\n * Provides context to screen readers about what the button does.\n * This is required as Icons don't inherently provide non-visual context like text does.\n */\n accessibilityLabel: string\n /**\n * Updates the icon's colors. Defaults to 'neutral'.\n */\n appearance?: IconButtonAppearanceUnion\n /**\n * Styles the icon itself.\n * `fontSize` allows for a custom size that also responds to the device's text scale.\n * `color` changes the color of the icon.\n */\n iconStyle?: IconProps['style']\n /**\n * Disables the button and replaces its content with a spinner\n */\n loading?: boolean\n /**\n * Specifies the maximum size a font can reach when allowFontScaling is enabled.\n */\n maxFontSizeMultiplier?: number\n /**\n * Generates an icon from `@planningcenter/icons`\n */\n name: IconString\n /**\n * Changes the overall size of the button and its contents\n */\n size?: SizeUnion\n /**\n * Styles the `Pressable` wrapper\n */\n style?: ViewStyle\n}\n\nexport function IconButton({\n accessibilityLabel,\n appearance = 'neutral',\n disabled = false,\n iconStyle,\n loading,\n maxFontSizeMultiplier,\n name,\n size = 'md',\n style,\n ...props\n}: IconButtonProps) {\n const styles = useStyles({ appearance, disabled, loading, maxFontSizeMultiplier, size })\n const colorOptionMap = useIconButtonColorOptionMap()\n const colorKey = getColorKey({ disabled, loading, appearance })\n\n const { color = colorOptionMap[colorKey] } = StyleSheet.flatten(iconStyle || {})\n const androidRippleColor = useCreateAndroidRippleColor({ color: color })\n\n const androidRadiusSizeMap: AndroidRadiusSize = {\n [SIZES.xxxs]: {\n radius: 8,\n },\n [SIZES.xxs]: {\n radius: 10,\n },\n [SIZES.xs]: {\n radius: 12,\n },\n [SIZES.sm]: {\n radius: 14,\n },\n [SIZES.md]: {\n radius: 16,\n },\n [SIZES.lg]: {\n radius: 18,\n },\n [SIZES.xl]: {\n radius: 20,\n },\n [SIZES.xxl]: {\n radius: 26,\n },\n [SIZES.xxxl]: {\n radius: 32,\n },\n }\n\n return (\n <Pressable\n style={({ pressed }) => [styles.pressable, style, pressed && platformPressedOpacityStyle]}\n accessibilityRole=\"button\"\n disabled={disabled || loading}\n accessibilityState={{ busy: loading }}\n accessibilityLabel={accessibilityLabel}\n hitSlop={10}\n android_ripple={{\n color: androidRippleColor,\n borderless: true,\n foreground: true,\n radius: androidRadiusSizeMap[size].radius,\n }}\n {...props}\n >\n {loading && (\n <Spinner\n size={styles.spinner.fontSize}\n maxFontSizeMultiplier={maxFontSizeMultiplier || 0}\n />\n )}\n <Icon\n name={name}\n style={[styles.icon, iconStyle, disabled && styles.disabled, loading && styles.loading]}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n />\n </Pressable>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({\n appearance = 'neutral',\n disabled = false,\n loading = false,\n maxFontSizeMultiplier,\n size = 'md',\n}: Partial<IconButtonProps>) => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier })\n const colorOptionMap = useIconButtonColorOptionMap()\n const colorKey = getColorKey({ disabled, loading, appearance })\n\n const sizeStyleMap: SizeStyle = {\n [SIZES.xxxs]: {\n fontSize: 8,\n height: 8 * fontScale,\n },\n [SIZES.xxs]: {\n fontSize: 10,\n height: 10 * fontScale,\n },\n [SIZES.xs]: {\n fontSize: 12,\n height: 12 * fontScale,\n },\n [SIZES.sm]: {\n fontSize: 14,\n height: 14 * fontScale,\n },\n [SIZES.md]: {\n fontSize: 16,\n height: 16 * fontScale,\n },\n [SIZES.lg]: {\n fontSize: 20,\n height: 20 * fontScale,\n },\n [SIZES.xl]: {\n fontSize: 24,\n height: 24 * fontScale,\n },\n [SIZES.xxl]: {\n fontSize: 32,\n height: 32 * fontScale,\n },\n [SIZES.xxxl]: {\n fontSize: 40,\n height: 40 * fontScale,\n },\n }\n\n return StyleSheet.create({\n pressable: {\n alignItems: 'center',\n justifyContent: 'center',\n height: sizeStyleMap[size].height,\n },\n icon: {\n fontSize: sizeStyleMap[size].fontSize,\n color: colorOptionMap[colorKey],\n },\n disabled: {\n color: colors.iconColorDefaultDisabled,\n },\n loading: {\n opacity: 0,\n },\n spinner: {\n fontSize: sizeStyleMap[size].fontSize,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"icon_button.js","sourceRoot":"","sources":["../../../src/components/display/icon_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAA;AAEpE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7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type { PressableProps, ViewStyle } from 'react-native'\nimport { Icon } from './icon'\nimport type { IconProps, IconString } from './icon'\nimport { useTheme, useFontScale, useCreateAndroidRippleColor } from '../../hooks'\nimport { platformPressedOpacityStyle } from '../../utils'\nimport { Spinner } from './spinner'\nimport { getColorKey, useIconButtonColorOptionMap } from './utils/button_colors'\nimport type { IconButtonAppearanceUnion } from './utils/button_colors'\n\n// =================================\n// ====== Constants ================\n// =================================\n\nconst SIZES = {\n xxxs: 'xxxs',\n xxs: 'xxs',\n xs: 'xs',\n sm: 'sm',\n md: 'md',\n lg: 'lg',\n xl: 'xl',\n xxl: 'xxl',\n xxxl: 'xxxl',\n} as const\n\ntype SizeUnion = (typeof SIZES)[keyof typeof SIZES]\ntype SizeStyle = Record<\n SizeUnion,\n {\n fontSize: number\n height: number\n }\n>\ntype AndroidRadiusSize = Record<\n SizeUnion,\n {\n radius: number\n }\n>\n\n// =================================\n// ====== Component ================\n// =================================\n\ninterface IconButtonProps extends PressableProps {\n /**\n * Provides context to screen readers about what the button does.\n * This is required as Icons don't inherently provide non-visual context like text does.\n */\n accessibilityLabel: string\n /**\n * Updates the icon's colors. Defaults to 'neutral'.\n */\n appearance?: IconButtonAppearanceUnion\n /**\n * Styles the icon itself.\n * `fontSize` allows for a custom size that also responds to the device's text scale.\n * `color` changes the color of the icon.\n */\n iconStyle?: IconProps['style']\n /**\n * Disables the button and replaces its content with a spinner\n */\n loading?: boolean\n /**\n * Specifies the maximum size a font can reach when allowFontScaling is enabled.\n */\n maxFontSizeMultiplier?: number\n /**\n * Generates an icon from `@planningcenter/icons`\n */\n name: IconString\n /**\n * Changes the overall size of the button and its contents\n */\n size?: SizeUnion\n /**\n * Styles the `Pressable` wrapper\n */\n style?: StyleProp<ViewStyle>\n}\n\nexport function IconButton({\n accessibilityLabel,\n appearance = 'neutral',\n disabled = false,\n iconStyle,\n loading,\n maxFontSizeMultiplier,\n name,\n size = 'md',\n style,\n ...props\n}: IconButtonProps) {\n const styles = useStyles({ appearance, disabled, loading, maxFontSizeMultiplier, size })\n const colorOptionMap = useIconButtonColorOptionMap()\n const colorKey = getColorKey({ disabled, loading, appearance })\n\n const { color = colorOptionMap[colorKey] } = StyleSheet.flatten(iconStyle || {})\n const androidRippleColor = useCreateAndroidRippleColor({ color: color })\n\n const androidRadiusSizeMap: AndroidRadiusSize = {\n [SIZES.xxxs]: {\n radius: 8,\n },\n [SIZES.xxs]: {\n radius: 10,\n },\n [SIZES.xs]: {\n radius: 12,\n },\n [SIZES.sm]: {\n radius: 14,\n },\n [SIZES.md]: {\n radius: 16,\n },\n [SIZES.lg]: {\n radius: 18,\n },\n [SIZES.xl]: {\n radius: 20,\n },\n [SIZES.xxl]: {\n radius: 26,\n },\n [SIZES.xxxl]: {\n radius: 32,\n },\n }\n\n return (\n <Pressable\n style={({ pressed }) => [styles.pressable, style, pressed && platformPressedOpacityStyle]}\n accessibilityRole=\"button\"\n disabled={disabled || loading}\n accessibilityState={{ busy: loading }}\n accessibilityLabel={accessibilityLabel}\n hitSlop={10}\n android_ripple={{\n color: androidRippleColor,\n borderless: true,\n foreground: true,\n radius: androidRadiusSizeMap[size].radius,\n }}\n {...props}\n >\n {loading && (\n <Spinner\n size={styles.spinner.fontSize}\n maxFontSizeMultiplier={maxFontSizeMultiplier || 0}\n />\n )}\n <Icon\n name={name}\n style={[styles.icon, iconStyle, disabled && styles.disabled, loading && styles.loading]}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n />\n </Pressable>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({\n appearance = 'neutral',\n disabled = false,\n loading = false,\n maxFontSizeMultiplier,\n size = 'md',\n}: Partial<IconButtonProps>) => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier })\n const colorOptionMap = useIconButtonColorOptionMap()\n const colorKey = getColorKey({ disabled, loading, appearance })\n\n const sizeStyleMap: SizeStyle = {\n [SIZES.xxxs]: {\n fontSize: 8,\n height: 8 * fontScale,\n },\n [SIZES.xxs]: {\n fontSize: 10,\n height: 10 * fontScale,\n },\n [SIZES.xs]: {\n fontSize: 12,\n height: 12 * fontScale,\n },\n [SIZES.sm]: {\n fontSize: 14,\n height: 14 * fontScale,\n },\n [SIZES.md]: {\n fontSize: 16,\n height: 16 * fontScale,\n },\n [SIZES.lg]: {\n fontSize: 20,\n height: 20 * fontScale,\n },\n [SIZES.xl]: {\n fontSize: 24,\n height: 24 * fontScale,\n },\n [SIZES.xxl]: {\n fontSize: 32,\n height: 32 * fontScale,\n },\n [SIZES.xxxl]: {\n fontSize: 40,\n height: 40 * fontScale,\n },\n }\n\n return StyleSheet.create({\n pressable: {\n alignItems: 'center',\n justifyContent: 'center',\n height: sizeStyleMap[size].height,\n },\n icon: {\n fontSize: sizeStyleMap[size].fontSize,\n color: colorOptionMap[colorKey],\n },\n disabled: {\n color: colors.iconColorDefaultDisabled,\n },\n loading: {\n opacity: 0,\n },\n spinner: {\n fontSize: sizeStyleMap[size].fontSize,\n },\n })\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { StaticScreenProps } from '@react-navigation/native';
|
|
2
|
-
import { NativeStackNavigationOptions } from '@react-navigation/native-stack';
|
|
3
2
|
import React from 'react';
|
|
4
|
-
export declare const SendGiphyScreenOptions: NativeStackNavigationOptions;
|
|
3
|
+
export declare const SendGiphyScreenOptions: import("@react-navigation/native-stack").NativeStackNavigationOptions;
|
|
5
4
|
export type SendGiphyScreenProps = StaticScreenProps<{
|
|
6
5
|
conversation_id: number;
|
|
7
6
|
search_term: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send_giphy_screen.d.ts","sourceRoot":"","sources":["../../src/screens/send_giphy_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AACzF,OAAO,
|
|
1
|
+
{"version":3,"file":"send_giphy_screen.d.ts","sourceRoot":"","sources":["../../src/screens/send_giphy_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AACzF,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,eAAO,MAAM,sBAAsB,uEAGjC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;IACnD,eAAe,EAAE,MAAM,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAC,CAAA;AAEF,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,oBAAoB,4BAiG9D"}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { StackActions, useNavigation } from '@react-navigation/native';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Image as NativeImage, StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
4
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
-
import { useTheme } from '../hooks';
|
|
3
|
+
import { Image as NativeImage, Platform, StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
6
4
|
import { useGiphy } from '../hooks/use_giphy';
|
|
7
|
-
import { Button, IconButton } from '../components';
|
|
8
|
-
import { MAX_FONT_SIZE_MULTIPLIER } from '../utils';
|
|
5
|
+
import { Button, IconButton, TextButton } from '../components';
|
|
9
6
|
import { DefaultLoading } from '../components/page/loading';
|
|
10
7
|
import { useMessageCreateOrUpdate } from '../hooks/use_message_create_or_update';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
8
|
+
import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet';
|
|
9
|
+
import { useCreateAndroidRippleColor, useTheme } from '../hooks';
|
|
10
|
+
import { tokens } from '../vendor/tapestry/tokens';
|
|
11
|
+
export const SendGiphyScreenOptions = getFormSheetScreenOptions({
|
|
12
|
+
headerTitle: 'Send Giphy',
|
|
13
|
+
sheetAllowedDetents: Platform.select({ android: [0.7, 0.94], default: [0.7, 1] }),
|
|
14
|
+
});
|
|
18
15
|
export function SendGiphyScreen({ route }) {
|
|
19
16
|
const { conversation_id, search_term } = route.params;
|
|
20
17
|
const styles = useStyles();
|
|
@@ -50,51 +47,82 @@ export function SendGiphyScreen({ route }) {
|
|
|
50
47
|
mutate({ text: '', attachments: [result] });
|
|
51
48
|
goBack({ clearInput: true });
|
|
52
49
|
}
|
|
53
|
-
return (<
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
return (<FormSheet.Root contentStyle={styles.container}>
|
|
51
|
+
<View style={styles.poweredByGiphyContainer}>
|
|
52
|
+
<NativeImage alt="Powered by Giphy" style={styles.poweredByGiphyImage} source={{ uri: poweredByGiphyImage }}/>
|
|
53
|
+
</View>
|
|
54
|
+
<View style={styles.controlToolbar} accessibilityRole="toolbar">
|
|
55
|
+
<View style={styles.paginateButtonGroup}>
|
|
56
|
+
<PaginateButton name="general.leftArrow" accessibilityLabel="Previous Giphy" onPress={prevResult} disabled={disabled}/>
|
|
57
|
+
<PaginateButton name="general.rightArrow" accessibilityLabel="Next GIF" onPress={nextResult} disabled={disabled}/>
|
|
59
58
|
</View>
|
|
60
|
-
<View style={styles.
|
|
61
|
-
<
|
|
62
|
-
|
|
59
|
+
<View style={styles.formButtonGroup}>
|
|
60
|
+
<TextButton onPress={() => goBack({ clearInput: false })} maxFontSizeMultiplier={1} accessibilityHint="Cancels the Giphy selection and closes this modal.">
|
|
61
|
+
Cancel
|
|
62
|
+
</TextButton>
|
|
63
|
+
<Button onPress={sendGiphy} title="Send" size="lg" disabled={disabled} maxFontSizeMultiplier={1} accessibilityLabel="Send Giphy" accessibilityHint="Sends the selected Giphy as a message to the conversation."/>
|
|
63
64
|
</View>
|
|
64
65
|
</View>
|
|
65
66
|
{isSearching ? (<DefaultLoading />) : (<NativeImage source={{ uri: url }} alt={result.title} style={[styles.image, { width: size, height: size }]}/>)}
|
|
66
|
-
</
|
|
67
|
+
</FormSheet.Root>);
|
|
68
|
+
}
|
|
69
|
+
function PaginateButton({ name, accessibilityLabel, onPress, disabled }) {
|
|
70
|
+
const styles = useStyles();
|
|
71
|
+
const { colors } = useTheme();
|
|
72
|
+
const androidRippleColor = useCreateAndroidRippleColor({ color: colors.interaction });
|
|
73
|
+
return (<IconButton name={name} accessibilityLabel={accessibilityLabel} size="md" appearance="interaction" onPress={onPress} disabled={disabled} style={[styles.paginateButton, disabled && styles.paginateButtonDisabled]} android_ripple={{
|
|
74
|
+
color: androidRippleColor,
|
|
75
|
+
borderless: true,
|
|
76
|
+
foreground: true,
|
|
77
|
+
}} maxFontSizeMultiplier={1}/>);
|
|
67
78
|
}
|
|
68
79
|
const useStyles = () => {
|
|
69
|
-
const
|
|
70
|
-
const { height } = useWindowDimensions();
|
|
71
|
-
const { bottom } = useSafeAreaInsets();
|
|
80
|
+
const { colors } = useTheme();
|
|
72
81
|
return StyleSheet.create({
|
|
73
82
|
container: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
paddingTop: Platform.select({ android: 24, default: 32 }),
|
|
84
|
+
paddingHorizontal: 16,
|
|
85
|
+
gap: 8,
|
|
86
|
+
},
|
|
87
|
+
poweredByGiphyContainer: {
|
|
88
|
+
alignSelf: 'flex-start',
|
|
89
|
+
padding: 4,
|
|
90
|
+
borderRadius: 4,
|
|
91
|
+
backgroundColor: colors.name === 'dark' ? tokens.colorNeutral68 : 'transparent',
|
|
82
92
|
},
|
|
83
|
-
|
|
84
|
-
width:
|
|
85
|
-
height:
|
|
93
|
+
poweredByGiphyImage: {
|
|
94
|
+
width: 170,
|
|
95
|
+
height: 20,
|
|
86
96
|
},
|
|
87
|
-
|
|
97
|
+
controlToolbar: {
|
|
88
98
|
flexDirection: 'row',
|
|
89
99
|
justifyContent: 'space-between',
|
|
90
100
|
alignItems: 'center',
|
|
91
101
|
},
|
|
92
|
-
|
|
102
|
+
formButtonGroup: {
|
|
93
103
|
flexDirection: 'row',
|
|
94
|
-
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
gap: 16,
|
|
106
|
+
},
|
|
107
|
+
paginateButtonGroup: {
|
|
108
|
+
flexDirection: 'row',
|
|
109
|
+
gap: 8,
|
|
110
|
+
},
|
|
111
|
+
paginateButton: {
|
|
112
|
+
borderColor: colors.interaction,
|
|
113
|
+
borderWidth: 1,
|
|
114
|
+
height: 28,
|
|
115
|
+
paddingHorizontal: 12,
|
|
116
|
+
borderRadius: 16,
|
|
117
|
+
overflow: 'hidden',
|
|
118
|
+
},
|
|
119
|
+
paginateButtonDisabled: {
|
|
120
|
+
backgroundColor: colors.fillColorButtonNeutralSolidDisabled,
|
|
121
|
+
borderColor: colors.fillColorButtonNeutralSolidDisabled,
|
|
95
122
|
},
|
|
96
123
|
image: {
|
|
97
124
|
borderRadius: 8,
|
|
125
|
+
maxWidth: '100%',
|
|
98
126
|
},
|
|
99
127
|
});
|
|
100
128
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send_giphy_screen.js","sourceRoot":"","sources":["../../src/screens/send_giphy_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAEzF,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA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ACxC,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEtC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,cAAc,EAAE,YAAY;YAC5B,UAAU,EAAE,EAAE;YACd,iBAAiB,EAAE,EAAE;YACrB,aAAa,EAAE,MAAM;YACrB,KAAK,EAAE,MAAM;YACb,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,2BAA2B;YACzD,MAAM;YACN,GAAG,EAAE,EAAE;SACR;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,EAAE;SACX;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;YAC/B,UAAU,EAAE,QAAQ;SACrB;QACD,YAAY,EAAE;YACZ,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,EAAE;SACR;QACD,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;SAChB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;6CA2BiB,CAAA","sourcesContent":["import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React from 'react'\nimport { Image as NativeImage, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../hooks'\nimport { useGiphy } from '../hooks/use_giphy'\nimport { Button, IconButton } from '../components'\nimport { MAX_FONT_SIZE_MULTIPLIER } from '../utils'\nimport { DefaultLoading } from '../components/page/loading'\nimport { useMessageCreateOrUpdate } from '../hooks/use_message_create_or_update'\n\nexport const SendGiphyScreenOptions: NativeStackNavigationOptions = {\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents: [0.75],\n sheetGrabberVisible: true,\n sheetCornerRadius: 16,\n}\n\nexport type SendGiphyScreenProps = StaticScreenProps<{\n conversation_id: number\n search_term: string\n}>\n\nexport function SendGiphyScreen({ route }: SendGiphyScreenProps) {\n const { conversation_id, search_term } = route.params\n const styles = useStyles()\n const navigation = useNavigation()\n\n const { isPending, mutate } = useMessageCreateOrUpdate({\n conversationId: conversation_id,\n })\n const { isSearching, result, nextResult, prevResult } = useGiphy(search_term)\n const disabled = isPending || isSearching\n\n const { width } = useWindowDimensions()\n const size = width - 24\n\n if (!result) return null\n\n const gif = result.giphy.fixed_width\n const { url } = gif\n\n function goBack({ clearInput = false }) {\n if (clearInput) {\n const routes = navigation.getState()?.routes || []\n const conversationParams = routes.find(r => r.name === 'Conversation')?.params || {}\n\n navigation.dispatch(\n StackActions.popTo('Conversation', {\n ...conversationParams,\n conversation_id,\n clear_input: true,\n })\n )\n } else {\n navigation.goBack()\n }\n }\n\n function sendGiphy() {\n if (disabled) return\n\n mutate({ text: '', attachments: [result] })\n goBack({ clearInput: true })\n }\n\n return (\n <View style={styles.container}>\n <NativeImage\n alt=\"Powered by Giphy\"\n style={styles.powered_by_giphy}\n source={{ uri: poweredByGiphyImage }}\n />\n <View style={styles.control_stack}>\n <View style={styles.button_group}>\n <IconButton\n name=\"general.leftArrow\"\n accessibilityLabel={'Previous GIF'}\n size=\"md\"\n appearance=\"neutral\"\n onPress={prevResult}\n disabled={disabled}\n />\n <IconButton\n name=\"general.rightArrow\"\n accessibilityLabel={'Next GIF'}\n size=\"md\"\n appearance=\"neutral\"\n onPress={nextResult}\n disabled={disabled}\n />\n </View>\n <View style={styles.button_group}>\n <Button\n onPress={() => goBack({ clearInput: false })}\n title=\"Cancel\"\n variant=\"outline\"\n size=\"sm\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER}\n />\n <Button\n onPress={sendGiphy}\n title=\"Send\"\n size=\"sm\"\n disabled={disabled}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER}\n />\n </View>\n </View>\n {isSearching ? (\n <DefaultLoading />\n ) : (\n <NativeImage\n source={{ uri: url }}\n alt={result.title}\n style={[styles.image, { width: size, height: size }]}\n />\n )}\n </View>\n )\n}\n\nconst useStyles = () => {\n const theme = useTheme()\n const { height } = useWindowDimensions()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingTop: 24,\n paddingHorizontal: 12,\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: theme.colors.fillColorNeutral100Inverted,\n height,\n gap: 12,\n },\n powered_by_giphy: {\n width: 200,\n height: 22,\n },\n control_stack: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n },\n button_group: {\n flexDirection: 'row',\n gap: 12,\n },\n image: {\n borderRadius: 8,\n },\n })\n}\n\nconst poweredByGiphyImage = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAAWCAYAAACFbNPBAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA\nGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABa9JREFUeNrsWy1z40gQla8EDAwE\nDAQCDAIMAgwCDA0XBgYGBu5PyM84aLgw8KDBAoMDBgsEAgQEBAQEBARclZ2uepPrne2WRrbls7Pq\nKpWc0UxPz0y//pIyen9/Dwa6LhqNRjNzmwmPcnOl5kzrYZdOQ+GwBVcDirG5LXGNG7rWpu/O3Dcu\nUEz7ytxW7gDT76WtjzYXAdJcW8MjFWR+EoBMAF4ra3wRmmkdG/Psq/kdac8Vfg/mtpAMiRnzt88C\n/xpU7yrAEZvbMxR33NLdAukZ4/okmmturicz1yNA3Be9Ku0rM2+keNlFR14DQK4UHE+K9Wwi6v94\nRlHnfc4HD5Uojx8826zHyQeAfJ6w6tHDa2jhz7czizwzMi969iK1Mu/cCRMjJbTa9JKDSG7M0N5M\nWDn9iOeUHWpl+hTs2UQZF6HvnrVNIGMFfpq8ltdEUhQeiyvr+FgLm1Pl0WVvWtb8sT6+bkZL5aBJ\nli1ZVLKGmN+GFDM8X3exl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c,EAAE;YACd,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;YAC/B,UAAU,EAAE,QAAQ;SACrB;QACD,eAAe,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,mBAAmB,EAAE;YACnB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;SACP;QACD,cAAc,EAAE;YACd,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,WAAW,EAAE,CAAC;YACd,MAAM,EAAE,EAAE;YACV,iBAAiB,EAAE,EAAE;YACrB,YAAY,EAAE,EAAE;YAChB,QAAQ,EAAE,QAAQ;SACnB;QACD,sBAAsB,EAAE;YACtB,eAAe,EAAE,MAAM,CAAC,mCAAmC;YAC3D,WAAW,EAAE,MAAM,CAAC,mCAAmC;SACxD;QACD,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,MAAM;SACjB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;6CA2BiB,CAAA","sourcesContent":["import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport { Image as NativeImage, Platform, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { useGiphy } from '../hooks/use_giphy'\nimport { Button, IconButton, IconString, TextButton } from '../components'\nimport { DefaultLoading } from '../components/page/loading'\nimport { useMessageCreateOrUpdate } from '../hooks/use_message_create_or_update'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCreateAndroidRippleColor, useTheme } from '../hooks'\nimport { tokens } from '../vendor/tapestry/tokens'\n\nexport const SendGiphyScreenOptions = getFormSheetScreenOptions({\n headerTitle: 'Send Giphy',\n sheetAllowedDetents: Platform.select({ android: [0.7, 0.94], default: [0.7, 1] }),\n})\n\nexport type SendGiphyScreenProps = StaticScreenProps<{\n conversation_id: number\n search_term: string\n}>\n\nexport function SendGiphyScreen({ route }: SendGiphyScreenProps) {\n const { conversation_id, search_term } = route.params\n const styles = useStyles()\n const navigation = useNavigation()\n\n const { isPending, mutate } = useMessageCreateOrUpdate({\n conversationId: conversation_id,\n })\n const { isSearching, result, nextResult, prevResult } = useGiphy(search_term)\n const disabled = isPending || isSearching\n\n const { width } = useWindowDimensions()\n const size = width - 24\n\n if (!result) return null\n\n const gif = result.giphy.fixed_width\n const { url } = gif\n\n function goBack({ clearInput = false }) {\n if (clearInput) {\n const routes = navigation.getState()?.routes || []\n const conversationParams = routes.find(r => r.name === 'Conversation')?.params || {}\n\n navigation.dispatch(\n StackActions.popTo('Conversation', {\n ...conversationParams,\n conversation_id,\n clear_input: true,\n })\n )\n } else {\n navigation.goBack()\n }\n }\n\n function sendGiphy() {\n if (disabled) return\n\n mutate({ text: '', attachments: [result] })\n goBack({ clearInput: true })\n }\n\n return (\n <FormSheet.Root contentStyle={styles.container}>\n <View style={styles.poweredByGiphyContainer}>\n <NativeImage\n alt=\"Powered by Giphy\"\n style={styles.poweredByGiphyImage}\n source={{ uri: poweredByGiphyImage }}\n />\n </View>\n <View style={styles.controlToolbar} accessibilityRole=\"toolbar\">\n <View style={styles.paginateButtonGroup}>\n <PaginateButton\n name=\"general.leftArrow\"\n accessibilityLabel=\"Previous Giphy\"\n onPress={prevResult}\n disabled={disabled}\n />\n <PaginateButton\n name=\"general.rightArrow\"\n accessibilityLabel=\"Next GIF\"\n onPress={nextResult}\n disabled={disabled}\n />\n </View>\n <View style={styles.formButtonGroup}>\n <TextButton\n onPress={() => goBack({ clearInput: false })}\n maxFontSizeMultiplier={1}\n accessibilityHint=\"Cancels the Giphy selection and closes this modal.\"\n >\n Cancel\n </TextButton>\n <Button\n onPress={sendGiphy}\n title=\"Send\"\n size=\"lg\"\n disabled={disabled}\n maxFontSizeMultiplier={1}\n accessibilityLabel=\"Send Giphy\"\n accessibilityHint=\"Sends the selected Giphy as a message to the conversation.\"\n />\n </View>\n </View>\n {isSearching ? (\n <DefaultLoading />\n ) : (\n <NativeImage\n source={{ uri: url }}\n alt={result.title}\n style={[styles.image, { width: size, height: size }]}\n />\n )}\n </FormSheet.Root>\n )\n}\n\ninterface PaginateButtonProps {\n name: IconString\n accessibilityLabel: string\n onPress: () => void\n disabled: boolean\n}\n\nfunction PaginateButton({ name, accessibilityLabel, onPress, disabled }: PaginateButtonProps) {\n const styles = useStyles()\n const { colors } = useTheme()\n const androidRippleColor = useCreateAndroidRippleColor({ color: colors.interaction })\n\n return (\n <IconButton\n name={name}\n accessibilityLabel={accessibilityLabel}\n size=\"md\"\n appearance=\"interaction\"\n onPress={onPress}\n disabled={disabled}\n style={[styles.paginateButton, disabled && styles.paginateButtonDisabled]}\n android_ripple={{\n color: androidRippleColor,\n borderless: true,\n foreground: true,\n }}\n maxFontSizeMultiplier={1}\n />\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n paddingTop: Platform.select({ android: 24, default: 32 }),\n paddingHorizontal: 16,\n gap: 8,\n },\n poweredByGiphyContainer: {\n alignSelf: 'flex-start',\n padding: 4,\n borderRadius: 4,\n backgroundColor: colors.name === 'dark' ? tokens.colorNeutral68 : 'transparent',\n },\n poweredByGiphyImage: {\n width: 170,\n height: 20,\n },\n controlToolbar: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n },\n formButtonGroup: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n paginateButtonGroup: {\n flexDirection: 'row',\n gap: 8,\n },\n paginateButton: {\n borderColor: colors.interaction,\n borderWidth: 1,\n height: 28,\n paddingHorizontal: 12,\n borderRadius: 16,\n overflow: 'hidden',\n },\n paginateButtonDisabled: {\n backgroundColor: colors.fillColorButtonNeutralSolidDisabled,\n borderColor: colors.fillColorButtonNeutralSolidDisabled,\n },\n image: {\n borderRadius: 8,\n maxWidth: '100%',\n },\n })\n}\n\nconst poweredByGiphyImage = `data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AAAAABJRU5ErkJggg==`\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.9.0-rc.
|
|
3
|
+
"version": "3.9.0-rc.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"prettier": "^3.4.2",
|
|
56
56
|
"typescript": "<5.6.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "f2307cc15b815e5c9c3e0586e4246eff25a12d23"
|
|
59
59
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from '@react-navigation/native'
|
|
7
7
|
import React, { useCallback, useContext, useEffect, useState } from 'react'
|
|
8
8
|
import { Platform, Pressable, StyleSheet, TextInput, View, ViewProps } from 'react-native'
|
|
9
|
-
import { Icon, IconButton, Text } from '../../components'
|
|
9
|
+
import { Icon, IconButton, Text, TextButton } from '../../components'
|
|
10
10
|
import { useCreateAndroidRippleColor, useTheme } from '../../hooks'
|
|
11
11
|
import { ConversationResource, MessageResource } from '../../types'
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ import { ConversationScreenProps } from '../../screens/conversation_screen'
|
|
|
14
14
|
|
|
15
15
|
import { ChatContext } from '../../contexts/chat_context'
|
|
16
16
|
import { ImagePicker, ImagePickerResult } from '../../utils/native_adapters'
|
|
17
|
-
import { platformPressedOpacityStyle } from '../../utils'
|
|
17
|
+
import { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils'
|
|
18
18
|
import { useAttachmentUploader } from '../../hooks/use_attachment_uploader'
|
|
19
19
|
import {
|
|
20
20
|
DenormalizedAttachmentResourceForCreate,
|
|
@@ -50,6 +50,7 @@ const MessageFormContext = React.createContext<{
|
|
|
50
50
|
setUsingGiphy: (usingGiphy: boolean) => void
|
|
51
51
|
attachmentUploader?: ReturnType<typeof useAttachmentUploader>
|
|
52
52
|
currentlyEditingMessage?: MessageResource | null
|
|
53
|
+
reset: () => void
|
|
53
54
|
}>({
|
|
54
55
|
text: '',
|
|
55
56
|
setText: (_text: string) => {},
|
|
@@ -59,6 +60,7 @@ const MessageFormContext = React.createContext<{
|
|
|
59
60
|
usingGiphy: false,
|
|
60
61
|
setUsingGiphy: (_usingGiphy: boolean) => {},
|
|
61
62
|
currentlyEditingMessage: null,
|
|
63
|
+
reset: () => {},
|
|
62
64
|
})
|
|
63
65
|
|
|
64
66
|
const GIPHY_MAX_LENGTH = 50
|
|
@@ -176,6 +178,7 @@ function MessageFormRoot({
|
|
|
176
178
|
setUsingGiphy,
|
|
177
179
|
attachmentUploader,
|
|
178
180
|
currentlyEditingMessage,
|
|
181
|
+
reset,
|
|
179
182
|
}}
|
|
180
183
|
>
|
|
181
184
|
<View style={styles.container}>
|
|
@@ -264,11 +267,25 @@ function MessageFormInput() {
|
|
|
264
267
|
)
|
|
265
268
|
}
|
|
266
269
|
|
|
270
|
+
const SUBMIT_ACCESSIBILITY_LABEL_MAP = {
|
|
271
|
+
giphy: 'Search Giphy',
|
|
272
|
+
editing: 'Save changes',
|
|
273
|
+
send: 'Send message',
|
|
274
|
+
} as const
|
|
275
|
+
|
|
276
|
+
const SUBMIT_ICON_NAME_MAP = {
|
|
277
|
+
giphy: 'general.search',
|
|
278
|
+
editing: 'general.check',
|
|
279
|
+
send: 'general.upArrow',
|
|
280
|
+
} as const
|
|
281
|
+
|
|
267
282
|
function MessageFormSubmitBtn() {
|
|
268
|
-
const { onSubmit, disabled, usingGiphy } =
|
|
283
|
+
const { onSubmit, disabled, usingGiphy, currentlyEditingMessage } =
|
|
284
|
+
React.useContext(MessageFormContext)
|
|
269
285
|
const styles = useMessageFormStyles()
|
|
270
286
|
const { colors } = useTheme()
|
|
271
287
|
|
|
288
|
+
const formStateKey = usingGiphy ? 'giphy' : currentlyEditingMessage ? 'editing' : 'send'
|
|
272
289
|
const colorKey = disabled ? 'disabled' : 'interaction'
|
|
273
290
|
const interactionStart = colors.buttonStart || colors.interaction
|
|
274
291
|
const interactionEnd = colors.buttonEnd || colors.interaction
|
|
@@ -289,7 +306,7 @@ function MessageFormSubmitBtn() {
|
|
|
289
306
|
disabled={disabled}
|
|
290
307
|
onPress={onSubmit}
|
|
291
308
|
accessibilityRole="button"
|
|
292
|
-
accessibilityLabel={
|
|
309
|
+
accessibilityLabel={SUBMIT_ACCESSIBILITY_LABEL_MAP[formStateKey]}
|
|
293
310
|
style={({ pressed }) => [
|
|
294
311
|
styles.submitPressableWrapper,
|
|
295
312
|
pressed && platformPressedOpacityStyle,
|
|
@@ -303,7 +320,7 @@ function MessageFormSubmitBtn() {
|
|
|
303
320
|
style={styles.submitGradientWrapper}
|
|
304
321
|
>
|
|
305
322
|
<Icon
|
|
306
|
-
name={
|
|
323
|
+
name={SUBMIT_ICON_NAME_MAP[formStateKey]}
|
|
307
324
|
style={iconStyles}
|
|
308
325
|
accessibilityElementsHidden={true}
|
|
309
326
|
/>
|
|
@@ -433,9 +450,8 @@ function MessageFormCommands() {
|
|
|
433
450
|
}
|
|
434
451
|
|
|
435
452
|
function EditingIndicator() {
|
|
436
|
-
const { currentlyEditingMessage } = React.useContext(MessageFormContext)
|
|
453
|
+
const { currentlyEditingMessage, reset } = React.useContext(MessageFormContext)
|
|
437
454
|
const styles = useMessageFormStyles()
|
|
438
|
-
const navigation = useNavigation()
|
|
439
455
|
|
|
440
456
|
if (!currentlyEditingMessage) {
|
|
441
457
|
return null
|
|
@@ -443,12 +459,18 @@ function EditingIndicator() {
|
|
|
443
459
|
|
|
444
460
|
return (
|
|
445
461
|
<View style={styles.editingIndicator}>
|
|
446
|
-
<
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
462
|
+
<View style={styles.editingIndicatorTitleContainer}>
|
|
463
|
+
<Icon name="accounts.editor" size={16} />
|
|
464
|
+
<Text variant="tertiary" style={styles.editingIndicatorTitle}>
|
|
465
|
+
Editing message
|
|
466
|
+
</Text>
|
|
467
|
+
</View>
|
|
468
|
+
<TextButton
|
|
469
|
+
onPress={() => reset()}
|
|
470
|
+
accessibilityHint="Exit message editing mode without saving"
|
|
471
|
+
>
|
|
472
|
+
Cancel
|
|
473
|
+
</TextButton>
|
|
452
474
|
</View>
|
|
453
475
|
)
|
|
454
476
|
}
|
|
@@ -563,9 +585,17 @@ const useMessageFormStyles = () => {
|
|
|
563
585
|
editingIndicator: {
|
|
564
586
|
flexDirection: 'row',
|
|
565
587
|
alignItems: 'center',
|
|
566
|
-
justifyContent: '
|
|
588
|
+
justifyContent: 'space-between',
|
|
567
589
|
gap: 8,
|
|
568
590
|
paddingBottom: 12,
|
|
569
591
|
},
|
|
592
|
+
editingIndicatorTitleContainer: {
|
|
593
|
+
flexDirection: 'row',
|
|
594
|
+
alignItems: 'center',
|
|
595
|
+
gap: 8,
|
|
596
|
+
},
|
|
597
|
+
editingIndicatorTitle: {
|
|
598
|
+
fontWeight: platformFontWeightMedium,
|
|
599
|
+
},
|
|
570
600
|
})
|
|
571
601
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Pressable, StyleSheet } from 'react-native'
|
|
2
|
+
import { Pressable, StyleSheet, type StyleProp } from 'react-native'
|
|
3
3
|
import type { PressableProps, ViewStyle } from 'react-native'
|
|
4
4
|
import { Icon } from './icon'
|
|
5
5
|
import type { IconProps, IconString } from './icon'
|
|
@@ -79,7 +79,7 @@ interface IconButtonProps extends PressableProps {
|
|
|
79
79
|
/**
|
|
80
80
|
* Styles the `Pressable` wrapper
|
|
81
81
|
*/
|
|
82
|
-
style?: ViewStyle
|
|
82
|
+
style?: StyleProp<ViewStyle>
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
export function IconButton({
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
2
|
-
import { NativeStackNavigationOptions } from '@react-navigation/native-stack'
|
|
3
2
|
import React from 'react'
|
|
4
|
-
import { Image as NativeImage, StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
5
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
6
|
-
import { useTheme } from '../hooks'
|
|
3
|
+
import { Image as NativeImage, Platform, StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
7
4
|
import { useGiphy } from '../hooks/use_giphy'
|
|
8
|
-
import { Button, IconButton } from '../components'
|
|
9
|
-
import { MAX_FONT_SIZE_MULTIPLIER } from '../utils'
|
|
5
|
+
import { Button, IconButton, IconString, TextButton } from '../components'
|
|
10
6
|
import { DefaultLoading } from '../components/page/loading'
|
|
11
7
|
import { useMessageCreateOrUpdate } from '../hooks/use_message_create_or_update'
|
|
8
|
+
import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'
|
|
9
|
+
import { useCreateAndroidRippleColor, useTheme } from '../hooks'
|
|
10
|
+
import { tokens } from '../vendor/tapestry/tokens'
|
|
12
11
|
|
|
13
|
-
export const SendGiphyScreenOptions
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
sheetGrabberVisible: true,
|
|
18
|
-
sheetCornerRadius: 16,
|
|
19
|
-
}
|
|
12
|
+
export const SendGiphyScreenOptions = getFormSheetScreenOptions({
|
|
13
|
+
headerTitle: 'Send Giphy',
|
|
14
|
+
sheetAllowedDetents: Platform.select({ android: [0.7, 0.94], default: [0.7, 1] }),
|
|
15
|
+
})
|
|
20
16
|
|
|
21
17
|
export type SendGiphyScreenProps = StaticScreenProps<{
|
|
22
18
|
conversation_id: number
|
|
@@ -67,45 +63,45 @@ export function SendGiphyScreen({ route }: SendGiphyScreenProps) {
|
|
|
67
63
|
}
|
|
68
64
|
|
|
69
65
|
return (
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
<FormSheet.Root contentStyle={styles.container}>
|
|
67
|
+
<View style={styles.poweredByGiphyContainer}>
|
|
68
|
+
<NativeImage
|
|
69
|
+
alt="Powered by Giphy"
|
|
70
|
+
style={styles.poweredByGiphyImage}
|
|
71
|
+
source={{ uri: poweredByGiphyImage }}
|
|
72
|
+
/>
|
|
73
|
+
</View>
|
|
74
|
+
<View style={styles.controlToolbar} accessibilityRole="toolbar">
|
|
75
|
+
<View style={styles.paginateButtonGroup}>
|
|
76
|
+
<PaginateButton
|
|
79
77
|
name="general.leftArrow"
|
|
80
|
-
accessibilityLabel=
|
|
81
|
-
size="md"
|
|
82
|
-
appearance="neutral"
|
|
78
|
+
accessibilityLabel="Previous Giphy"
|
|
83
79
|
onPress={prevResult}
|
|
84
80
|
disabled={disabled}
|
|
85
81
|
/>
|
|
86
|
-
<
|
|
82
|
+
<PaginateButton
|
|
87
83
|
name="general.rightArrow"
|
|
88
|
-
accessibilityLabel=
|
|
89
|
-
size="md"
|
|
90
|
-
appearance="neutral"
|
|
84
|
+
accessibilityLabel="Next GIF"
|
|
91
85
|
onPress={nextResult}
|
|
92
86
|
disabled={disabled}
|
|
93
87
|
/>
|
|
94
88
|
</View>
|
|
95
|
-
<View style={styles.
|
|
96
|
-
<
|
|
89
|
+
<View style={styles.formButtonGroup}>
|
|
90
|
+
<TextButton
|
|
97
91
|
onPress={() => goBack({ clearInput: false })}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
maxFontSizeMultiplier={1}
|
|
93
|
+
accessibilityHint="Cancels the Giphy selection and closes this modal."
|
|
94
|
+
>
|
|
95
|
+
Cancel
|
|
96
|
+
</TextButton>
|
|
103
97
|
<Button
|
|
104
98
|
onPress={sendGiphy}
|
|
105
99
|
title="Send"
|
|
106
|
-
size="
|
|
100
|
+
size="lg"
|
|
107
101
|
disabled={disabled}
|
|
108
|
-
maxFontSizeMultiplier={
|
|
102
|
+
maxFontSizeMultiplier={1}
|
|
103
|
+
accessibilityLabel="Send Giphy"
|
|
104
|
+
accessibilityHint="Sends the selected Giphy as a message to the conversation."
|
|
109
105
|
/>
|
|
110
106
|
</View>
|
|
111
107
|
</View>
|
|
@@ -118,41 +114,89 @@ export function SendGiphyScreen({ route }: SendGiphyScreenProps) {
|
|
|
118
114
|
style={[styles.image, { width: size, height: size }]}
|
|
119
115
|
/>
|
|
120
116
|
)}
|
|
121
|
-
</
|
|
117
|
+
</FormSheet.Root>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
interface PaginateButtonProps {
|
|
122
|
+
name: IconString
|
|
123
|
+
accessibilityLabel: string
|
|
124
|
+
onPress: () => void
|
|
125
|
+
disabled: boolean
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function PaginateButton({ name, accessibilityLabel, onPress, disabled }: PaginateButtonProps) {
|
|
129
|
+
const styles = useStyles()
|
|
130
|
+
const { colors } = useTheme()
|
|
131
|
+
const androidRippleColor = useCreateAndroidRippleColor({ color: colors.interaction })
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<IconButton
|
|
135
|
+
name={name}
|
|
136
|
+
accessibilityLabel={accessibilityLabel}
|
|
137
|
+
size="md"
|
|
138
|
+
appearance="interaction"
|
|
139
|
+
onPress={onPress}
|
|
140
|
+
disabled={disabled}
|
|
141
|
+
style={[styles.paginateButton, disabled && styles.paginateButtonDisabled]}
|
|
142
|
+
android_ripple={{
|
|
143
|
+
color: androidRippleColor,
|
|
144
|
+
borderless: true,
|
|
145
|
+
foreground: true,
|
|
146
|
+
}}
|
|
147
|
+
maxFontSizeMultiplier={1}
|
|
148
|
+
/>
|
|
122
149
|
)
|
|
123
150
|
}
|
|
124
151
|
|
|
125
152
|
const useStyles = () => {
|
|
126
|
-
const
|
|
127
|
-
const { height } = useWindowDimensions()
|
|
128
|
-
const { bottom } = useSafeAreaInsets()
|
|
153
|
+
const { colors } = useTheme()
|
|
129
154
|
|
|
130
155
|
return StyleSheet.create({
|
|
131
156
|
container: {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
157
|
+
paddingTop: Platform.select({ android: 24, default: 32 }),
|
|
158
|
+
paddingHorizontal: 16,
|
|
159
|
+
gap: 8,
|
|
160
|
+
},
|
|
161
|
+
poweredByGiphyContainer: {
|
|
162
|
+
alignSelf: 'flex-start',
|
|
163
|
+
padding: 4,
|
|
164
|
+
borderRadius: 4,
|
|
165
|
+
backgroundColor: colors.name === 'dark' ? tokens.colorNeutral68 : 'transparent',
|
|
140
166
|
},
|
|
141
|
-
|
|
142
|
-
width:
|
|
143
|
-
height:
|
|
167
|
+
poweredByGiphyImage: {
|
|
168
|
+
width: 170,
|
|
169
|
+
height: 20,
|
|
144
170
|
},
|
|
145
|
-
|
|
171
|
+
controlToolbar: {
|
|
146
172
|
flexDirection: 'row',
|
|
147
173
|
justifyContent: 'space-between',
|
|
148
174
|
alignItems: 'center',
|
|
149
175
|
},
|
|
150
|
-
|
|
176
|
+
formButtonGroup: {
|
|
151
177
|
flexDirection: 'row',
|
|
152
|
-
|
|
178
|
+
alignItems: 'center',
|
|
179
|
+
gap: 16,
|
|
180
|
+
},
|
|
181
|
+
paginateButtonGroup: {
|
|
182
|
+
flexDirection: 'row',
|
|
183
|
+
gap: 8,
|
|
184
|
+
},
|
|
185
|
+
paginateButton: {
|
|
186
|
+
borderColor: colors.interaction,
|
|
187
|
+
borderWidth: 1,
|
|
188
|
+
height: 28,
|
|
189
|
+
paddingHorizontal: 12,
|
|
190
|
+
borderRadius: 16,
|
|
191
|
+
overflow: 'hidden',
|
|
192
|
+
},
|
|
193
|
+
paginateButtonDisabled: {
|
|
194
|
+
backgroundColor: colors.fillColorButtonNeutralSolidDisabled,
|
|
195
|
+
borderColor: colors.fillColorButtonNeutralSolidDisabled,
|
|
153
196
|
},
|
|
154
197
|
image: {
|
|
155
198
|
borderRadius: 8,
|
|
199
|
+
maxWidth: '100%',
|
|
156
200
|
},
|
|
157
201
|
})
|
|
158
202
|
}
|