@planningcenter/chat-react-native 3.9.0-rc.0 → 3.9.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +11 -1
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/display/platform_modal_header_buttons.d.ts.map +1 -1
- package/build/components/display/platform_modal_header_buttons.js +2 -2
- package/build/components/display/platform_modal_header_buttons.js.map +1 -1
- package/build/components/display/text_button.d.ts +1 -2
- package/build/components/display/text_button.d.ts.map +1 -1
- package/build/components/display/text_button.js.map +1 -1
- package/build/components/primitive/form_sheet.d.ts +17 -4
- package/build/components/primitive/form_sheet.d.ts.map +1 -1
- package/build/components/primitive/form_sheet.js +27 -12
- package/build/components/primitive/form_sheet.js.map +1 -1
- package/build/screens/conversation/message_read_receipts_screen.d.ts.map +1 -1
- package/build/screens/conversation/message_read_receipts_screen.js +9 -2
- package/build/screens/conversation/message_read_receipts_screen.js.map +1 -1
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +2 -2
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +10 -3
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -1
- package/build/screens/conversation_filters_screen.d.ts.map +1 -1
- package/build/screens/conversation_filters_screen.js +7 -3
- package/build/screens/conversation_filters_screen.js.map +1 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +4 -2
- package/build/screens/conversation_screen.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversation/message.tsx +16 -1
- package/src/components/display/platform_modal_header_buttons.tsx +2 -0
- package/src/components/display/text_button.tsx +1 -1
- package/src/components/primitive/form_sheet.tsx +83 -19
- package/src/screens/conversation/message_read_receipts_screen.tsx +9 -5
- package/src/screens/conversation_details_screen.tsx +2 -1
- package/src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx +10 -11
- package/src/screens/conversation_filters_screen.tsx +9 -3
- package/src/screens/conversation_screen.tsx +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAoB7C;;GAEG;AACH,UAAU,YAAa,SAAQ,eAAe;IAC5C,4BAA4B,EAAE,OAAO,CAAA;IACrC,eAAe,EAAE,MAAM,CAAA;IACvB,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,qBA6I1C"}
|
|
@@ -8,7 +8,7 @@ import { useTheme } from '../../hooks';
|
|
|
8
8
|
import { MessageAttachments } from './message_attachments';
|
|
9
9
|
import ErrorBoundary from '../page/error_boundary';
|
|
10
10
|
import { MessageMarkdown } from './message_markdown';
|
|
11
|
-
import { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL } from '../../utils/styles';
|
|
11
|
+
import { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL, platformFontWeightMedium, } from '../../utils/styles';
|
|
12
12
|
import Animated, { useSharedValue, useAnimatedStyle, withTiming, interpolateColor, Easing, } from 'react-native-reanimated';
|
|
13
13
|
import { useLiveRelativeTime } from '../../hooks/use_live_relative_time';
|
|
14
14
|
import { MessageReadReceipts } from './message_read_receipts';
|
|
@@ -21,6 +21,7 @@ export function Message(props) {
|
|
|
21
21
|
const [showMessageMetaToggle, setShowMessageMetaToggle] = React.useState(false);
|
|
22
22
|
const showMessageMeta = showMessageMetaToggle || props.myLatestInConversation || false;
|
|
23
23
|
const timestamp = useLiveRelativeTime(props.createdAt);
|
|
24
|
+
const wasEdited = Boolean(props.textEditedAt);
|
|
24
25
|
const bgFadeProgress = useSharedValue(0);
|
|
25
26
|
const pressedColor = Platform.select({
|
|
26
27
|
ios: colors.fillColorNeutral050Base,
|
|
@@ -89,6 +90,12 @@ export function Message(props) {
|
|
|
89
90
|
{showMessageMeta && (<View style={styles.messageMeta}>
|
|
90
91
|
{props.mine && (<MessageReadReceipts message={props} latestReadMessageSortKey={props.latestReadMessageSortKey}/>)}
|
|
91
92
|
<Text variant="footnote">{timestamp}</Text>
|
|
93
|
+
{wasEdited && (<Text variant="footnote">
|
|
94
|
+
|{' '}
|
|
95
|
+
<Text variant="footnote" style={styles.editedText}>
|
|
96
|
+
Edited
|
|
97
|
+
</Text>
|
|
98
|
+
</Text>)}
|
|
92
99
|
</View>)}
|
|
93
100
|
</View>
|
|
94
101
|
</Animated.View>
|
|
@@ -139,6 +146,9 @@ const useMessageStyles = (props) => {
|
|
|
139
146
|
justifyContent: mine ? 'flex-end' : 'flex-start',
|
|
140
147
|
gap: 4,
|
|
141
148
|
},
|
|
149
|
+
editedText: {
|
|
150
|
+
fontWeight: platformFontWeightMedium,
|
|
151
|
+
},
|
|
142
152
|
});
|
|
143
153
|
};
|
|
144
154
|
//# sourceMappingURL=message.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,aAAa,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAA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AC;QACvB,OAAO,EAAE;YACP,GAAG,EAAE,CAAC;YACN,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK;YAC3C,iBAAiB,EAAE,4CAA4C;SAChE;QACD,cAAc,EAAE;YACd,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;SACP;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;SACP;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,EAAE,EAAE,uBAAuB;YAClC,MAAM,EAAE,EAAE,EAAE,wBAAwB;SACrC;QACD,aAAa,EAAE;YACb,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB;YAChE,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK;YACnC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;SAC5C;QACD,WAAW,EAAE;YACX,eAAe,EAAE,CAAC;YAClB,iBAAiB,EAAE,CAAC;SACrB;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;SACjD;QACD,WAAW,EAAE;YACX,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;YAChD,GAAG,EAAE,CAAC;SACP;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport colorFunction from 'color'\nimport React from 'react'\nimport { Platform, Pressable, StyleSheet, useWindowDimensions, 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'\nimport { ReactionCountResource } from '../../types/resources/reaction'\nimport { MessageAttachments } from './message_attachments'\nimport ErrorBoundary from '../page/error_boundary'\nimport { MessageMarkdown } from './message_markdown'\nimport { DenormalizedMessageAttachmentResource } from '../../types/resources/denormalized_attachment_resource'\nimport { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL } from '../../utils/styles'\nimport Animated, {\n useSharedValue,\n useAnimatedStyle,\n withTiming,\n interpolateColor,\n Easing,\n} from 'react-native-reanimated'\nimport { useLiveRelativeTime } from '../../hooks/use_live_relative_time'\nimport { MessageReadReceipts } from './message_read_receipts'\n\n/** Message\n * Component for display of a message within a conversation list\n */\ninterface MessageProps extends MessageResource {\n canDeleteNonAuthoredMessages: boolean\n conversation_id: number\n latestReadMessageSortKey?: string\n}\n\nexport function Message(props: MessageProps) {\n const { conversation_id, canDeleteNonAuthoredMessages, text, reactionCounts } = props\n const styles = useMessageStyles(props)\n const navigation = useNavigation()\n const { colors } = useTheme()\n const hasReactions = reactionCounts.length > 0\n const [showMessageMetaToggle, setShowMessageMetaToggle] = React.useState(false)\n const showMessageMeta = showMessageMetaToggle || props.myLatestInConversation || false\n const timestamp = useLiveRelativeTime(props.createdAt)\n\n const bgFadeProgress = useSharedValue(0)\n const pressedColor = Platform.select({\n ios: colors.fillColorNeutral050Base,\n default: 'transparent',\n })\n const animatedBackgroundColor = useAnimatedStyle(() => {\n const backgroundColor = interpolateColor(\n bgFadeProgress.value,\n [0, 1],\n ['transparent', pressedColor]\n )\n return {\n backgroundColor,\n }\n })\n\n const handlePressIn = () => {\n bgFadeProgress.value = withTiming(1, { duration: 300, easing: Easing.inOut(Easing.ease) })\n }\n\n const handlePressOut = () => {\n bgFadeProgress.value = withTiming(0, { duration: 300, easing: Easing.inOut(Easing.ease) })\n }\n\n const handleMessageLongPress = () => {\n navigation.navigate('MessageActions', {\n message_id: props.id,\n conversation_id,\n canDeleteNonAuthoredMessages,\n })\n }\n const handleReactionLongPress = (reaction: ReactionCountResource) => {\n navigation.navigate('Reactions', {\n message_id: props.id,\n conversation_id,\n reaction_value: reaction.value,\n })\n }\n\n const handleMessageAttachmentLongPress = (attachment: DenormalizedMessageAttachmentResource) => {\n navigation.navigate('AttachmentActions', {\n attachmentId: attachment?.id,\n attachmentContentType: attachment?.attributes.contentType,\n attachmentUrl: attachment?.attributes.url,\n conversation_id,\n canDeleteNonAuthoredMessages,\n myMessage: props.mine,\n })\n }\n\n const metaProps = {\n authorName: props.author.name,\n createdAt: props.createdAt,\n }\n\n const renderAuthor = (!props.mine && props.renderAuthor) || false\n const messageBottomMargin = props.lastInGroup ? 12 : hasReactions || showMessageMeta ? 8 : 4\n\n return (\n <Pressable\n onLongPress={handleMessageLongPress}\n onPress={() => setShowMessageMetaToggle(!showMessageMetaToggle)}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n android_ripple={{ color: colors.androidRippleNeutral }}\n accessibilityHint=\"Long press to view message actions like reacting and copying.\"\n >\n <Animated.View style={[styles.message, animatedBackgroundColor]}>\n {!props.mine && (\n <View style={styles.messageAuthor}>\n {renderAuthor ? (\n <Avatar size={'md'} sourceUri={props.author.avatar} />\n ) : (\n <View style={styles.avatarPlaceholder} />\n )}\n </View>\n )}\n <View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>\n {renderAuthor && <Text variant=\"tertiary\">{props.author.name}</Text>}\n <View style={styles.messageBubble}>\n <ErrorBoundary>\n <MessageAttachments\n attachments={props.attachments}\n metaProps={metaProps}\n onMessageAttachmentLongPress={handleMessageAttachmentLongPress}\n onMessageLongPress={handleMessageLongPress}\n />\n </ErrorBoundary>\n {text && (\n <View style={styles.messageText}>\n <MessageMarkdown text={text} />\n </View>\n )}\n </View>\n {hasReactions && (\n <View style={styles.messageReactions}>\n {reactionCounts.map(reaction => (\n <MessageReaction\n key={reaction.value}\n reaction={reaction}\n onLongPress={handleReactionLongPress}\n message={props}\n conversationId={conversation_id}\n />\n ))}\n </View>\n )}\n {showMessageMeta && (\n <View style={styles.messageMeta}>\n {props.mine && (\n <MessageReadReceipts\n message={props}\n latestReadMessageSortKey={props.latestReadMessageSortKey}\n />\n )}\n <Text variant=\"footnote\">{timestamp}</Text>\n </View>\n )}\n </View>\n </Animated.View>\n </Pressable>\n )\n}\n\nconst useMessageStyles = (props: MessageResource) => {\n const { mine } = props\n const { colors } = useTheme()\n const activeColor = colorFunction(colors.interaction).alpha(0.2).string()\n const { width } = useWindowDimensions()\n const tabletWidth = width >= 744 // Smallest iPad Mini's width\n\n return StyleSheet.create({\n message: {\n gap: 8,\n flexDirection: mine ? 'row-reverse' : 'row',\n paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n },\n messageContent: {\n flex: 1,\n gap: 4,\n },\n messageAuthor: {\n flexDirection: 'row',\n gap: 8,\n },\n avatarPlaceholder: {\n width: 32, // Same width as avatar\n height: 32, // Same height as avatar\n },\n messageBubble: {\n backgroundColor: mine ? activeColor : colors.fillColorNeutral070,\n borderRadius: 8,\n maxWidth: tabletWidth ? 360 : '80%',\n alignSelf: mine ? 'flex-end' : 'flex-start',\n },\n messageText: {\n paddingVertical: 6,\n paddingHorizontal: 8,\n },\n messageReactions: {\n flexDirection: 'row',\n gap: 4,\n justifyContent: mine ? 'flex-end' : 'flex-start',\n },\n messageMeta: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: mine ? 'flex-end' : 'flex-start',\n gap: 4,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,aAAa,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAA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a,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;YAChD,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,UAAU,EAAE,wBAAwB;SACrC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport colorFunction from 'color'\nimport React from 'react'\nimport { Platform, Pressable, StyleSheet, useWindowDimensions, 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'\nimport { ReactionCountResource } from '../../types/resources/reaction'\nimport { MessageAttachments } from './message_attachments'\nimport ErrorBoundary from '../page/error_boundary'\nimport { MessageMarkdown } from './message_markdown'\nimport { DenormalizedMessageAttachmentResource } from '../../types/resources/denormalized_attachment_resource'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n platformFontWeightMedium,\n} from '../../utils/styles'\nimport Animated, {\n useSharedValue,\n useAnimatedStyle,\n withTiming,\n interpolateColor,\n Easing,\n} from 'react-native-reanimated'\nimport { useLiveRelativeTime } from '../../hooks/use_live_relative_time'\nimport { MessageReadReceipts } from './message_read_receipts'\n\n/** Message\n * Component for display of a message within a conversation list\n */\ninterface MessageProps extends MessageResource {\n canDeleteNonAuthoredMessages: boolean\n conversation_id: number\n latestReadMessageSortKey?: string\n}\n\nexport function Message(props: MessageProps) {\n const { conversation_id, canDeleteNonAuthoredMessages, text, reactionCounts } = props\n const styles = useMessageStyles(props)\n const navigation = useNavigation()\n const { colors } = useTheme()\n const hasReactions = reactionCounts.length > 0\n const [showMessageMetaToggle, setShowMessageMetaToggle] = React.useState(false)\n const showMessageMeta = showMessageMetaToggle || props.myLatestInConversation || false\n const timestamp = useLiveRelativeTime(props.createdAt)\n const wasEdited = Boolean(props.textEditedAt)\n\n const bgFadeProgress = useSharedValue(0)\n const pressedColor = Platform.select({\n ios: colors.fillColorNeutral050Base,\n default: 'transparent',\n })\n const animatedBackgroundColor = useAnimatedStyle(() => {\n const backgroundColor = interpolateColor(\n bgFadeProgress.value,\n [0, 1],\n ['transparent', pressedColor]\n )\n return {\n backgroundColor,\n }\n })\n\n const handlePressIn = () => {\n bgFadeProgress.value = withTiming(1, { duration: 300, easing: Easing.inOut(Easing.ease) })\n }\n\n const handlePressOut = () => {\n bgFadeProgress.value = withTiming(0, { duration: 300, easing: Easing.inOut(Easing.ease) })\n }\n\n const handleMessageLongPress = () => {\n navigation.navigate('MessageActions', {\n message_id: props.id,\n conversation_id,\n canDeleteNonAuthoredMessages,\n })\n }\n const handleReactionLongPress = (reaction: ReactionCountResource) => {\n navigation.navigate('Reactions', {\n message_id: props.id,\n conversation_id,\n reaction_value: reaction.value,\n })\n }\n\n const handleMessageAttachmentLongPress = (attachment: DenormalizedMessageAttachmentResource) => {\n navigation.navigate('AttachmentActions', {\n attachmentId: attachment?.id,\n attachmentContentType: attachment?.attributes.contentType,\n attachmentUrl: attachment?.attributes.url,\n conversation_id,\n canDeleteNonAuthoredMessages,\n myMessage: props.mine,\n })\n }\n\n const metaProps = {\n authorName: props.author.name,\n createdAt: props.createdAt,\n }\n\n const renderAuthor = (!props.mine && props.renderAuthor) || false\n const messageBottomMargin = props.lastInGroup ? 12 : hasReactions || showMessageMeta ? 8 : 4\n\n return (\n <Pressable\n onLongPress={handleMessageLongPress}\n onPress={() => setShowMessageMetaToggle(!showMessageMetaToggle)}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n android_ripple={{ color: colors.androidRippleNeutral }}\n accessibilityHint=\"Long press to view message actions like reacting and copying.\"\n >\n <Animated.View style={[styles.message, animatedBackgroundColor]}>\n {!props.mine && (\n <View style={styles.messageAuthor}>\n {renderAuthor ? (\n <Avatar size={'md'} sourceUri={props.author.avatar} />\n ) : (\n <View style={styles.avatarPlaceholder} />\n )}\n </View>\n )}\n <View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>\n {renderAuthor && <Text variant=\"tertiary\">{props.author.name}</Text>}\n <View style={styles.messageBubble}>\n <ErrorBoundary>\n <MessageAttachments\n attachments={props.attachments}\n metaProps={metaProps}\n onMessageAttachmentLongPress={handleMessageAttachmentLongPress}\n onMessageLongPress={handleMessageLongPress}\n />\n </ErrorBoundary>\n {text && (\n <View style={styles.messageText}>\n <MessageMarkdown text={text} />\n </View>\n )}\n </View>\n {hasReactions && (\n <View style={styles.messageReactions}>\n {reactionCounts.map(reaction => (\n <MessageReaction\n key={reaction.value}\n reaction={reaction}\n onLongPress={handleReactionLongPress}\n message={props}\n conversationId={conversation_id}\n />\n ))}\n </View>\n )}\n {showMessageMeta && (\n <View style={styles.messageMeta}>\n {props.mine && (\n <MessageReadReceipts\n message={props}\n latestReadMessageSortKey={props.latestReadMessageSortKey}\n />\n )}\n <Text variant=\"footnote\">{timestamp}</Text>\n {wasEdited && (\n <Text variant=\"footnote\">\n |{' '}\n <Text variant=\"footnote\" style={styles.editedText}>\n Edited\n </Text>\n </Text>\n )}\n </View>\n )}\n </View>\n </Animated.View>\n </Pressable>\n )\n}\n\nconst useMessageStyles = (props: MessageResource) => {\n const { mine } = props\n const { colors } = useTheme()\n const activeColor = colorFunction(colors.interaction).alpha(0.2).string()\n const { width } = useWindowDimensions()\n const tabletWidth = width >= 744 // Smallest iPad Mini's width\n\n return StyleSheet.create({\n message: {\n gap: 8,\n flexDirection: mine ? 'row-reverse' : 'row',\n paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n },\n messageContent: {\n flex: 1,\n gap: 4,\n },\n messageAuthor: {\n flexDirection: 'row',\n gap: 8,\n },\n avatarPlaceholder: {\n width: 32, // Same width as avatar\n height: 32, // Same height as avatar\n },\n messageBubble: {\n backgroundColor: mine ? activeColor : colors.fillColorNeutral070,\n borderRadius: 8,\n maxWidth: tabletWidth ? 360 : '80%',\n alignSelf: mine ? 'flex-end' : 'flex-start',\n },\n messageText: {\n paddingVertical: 6,\n paddingHorizontal: 8,\n },\n messageReactions: {\n flexDirection: 'row',\n gap: 4,\n justifyContent: mine ? 'flex-end' : 'flex-start',\n },\n messageMeta: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: mine ? 'flex-end' : 'flex-start',\n gap: 4,\n },\n editedText: {\n fontWeight: platformFontWeightMedium,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform_modal_header_buttons.d.ts","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuC,MAAM,cAAc,CAAA;AAM9E,UAAU,uBAAuB;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,kBAAkB,iCAI5B,uBAAuB,
|
|
1
|
+
{"version":3,"file":"platform_modal_header_buttons.d.ts","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuC,MAAM,cAAc,CAAA;AAM9E,UAAU,uBAAuB;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,kBAAkB,iCAI5B,uBAAuB,gCAazB,CAAA;AAED,UAAU,uBAAuB;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB;AAED,eAAO,MAAM,kBAAkB,4CAK5B,uBAAuB,gCAoBzB,CAAA"}
|
|
@@ -5,14 +5,14 @@ import { Icon } from './icon';
|
|
|
5
5
|
import { useTheme } from '../../hooks';
|
|
6
6
|
export const HeaderSubmitButton = ({ onPress, title = 'Submit', ...props }) => {
|
|
7
7
|
const styles = useStyles();
|
|
8
|
-
return (<TextButton onPress={onPress} textStyle={[styles.interactionColor, props.disabled && styles.disabledColor]} {...props}>
|
|
8
|
+
return (<TextButton maxFontSizeMultiplier={1} onPress={onPress} textStyle={[styles.interactionColor, props.disabled && styles.disabledColor]} {...props}>
|
|
9
9
|
{title}
|
|
10
10
|
</TextButton>);
|
|
11
11
|
};
|
|
12
12
|
export const HeaderCancelButton = ({ onPress, title = 'Cancel', tintColor, ...props }) => {
|
|
13
13
|
const styles = useStyles();
|
|
14
14
|
return Platform.select({
|
|
15
|
-
ios: (<TextButton onPress={onPress} textStyle={[styles.interactionColor, styles.iosCancelButton]} {...props}>
|
|
15
|
+
ios: (<TextButton maxFontSizeMultiplier={1} onPress={onPress} textStyle={[styles.interactionColor, styles.iosCancelButton]} {...props}>
|
|
16
16
|
{title}
|
|
17
17
|
</TextButton>),
|
|
18
18
|
default: (<HeaderButton onPress={onPress} style={[styles.androidCancelButton]} {...props}>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform_modal_header_buttons.js","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAQtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,OAAO,EACP,KAAK,GAAG,QAAQ,EAChB,GAAG,KAAK,EACgB,EAAE,EAAE;IAC5B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE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AAK,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACrB,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC;gBAC1B,OAAO,EAAE,MAAM,CAAC,2BAAyC;aAC1D,CAAC;SACH;QACD,mBAAmB,EAAE;YACnB,WAAW,EAAE,EAAE;SAChB;QACD,eAAe,EAAE;YACf,UAAU,EAAE,QAAQ;SACrB;QACD,aAAa,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { ColorValue, Platform, StyleSheet, PlatformColor } from 'react-native'\nimport { TextButton } from './text_button'\nimport { HeaderButton } from '@react-navigation/elements'\nimport { Icon } from './icon'\nimport { useTheme } from '../../hooks'\n\ninterface HeaderSubmitButtonProps {\n onPress: () => void\n title?: string\n disabled?: boolean\n}\n\nexport const HeaderSubmitButton = ({\n onPress,\n title = 'Submit',\n ...props\n}: HeaderSubmitButtonProps) => {\n const styles = useStyles()\n\n return (\n <TextButton\n onPress={onPress}\n textStyle={[styles.interactionColor, props.disabled && styles.disabledColor]}\n {...props}\n >\n {title}\n </TextButton>\n )\n}\n\ninterface HeaderCancelButtonProps {\n onPress: () => void\n title?: string\n tintColor?: ColorValue\n}\n\nexport const HeaderCancelButton = ({\n onPress,\n title = 'Cancel',\n tintColor,\n ...props\n}: HeaderCancelButtonProps) => {\n const styles = useStyles()\n\n return Platform.select({\n ios: (\n <TextButton\n onPress={onPress}\n textStyle={[styles.interactionColor, styles.iosCancelButton]}\n {...props}\n >\n {title}\n </TextButton>\n ),\n default: (\n <HeaderButton onPress={onPress} style={[styles.androidCancelButton]} {...props}>\n <Icon name=\"general.x\" size={16} color={tintColor} />\n </HeaderButton>\n ),\n })\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n interactionColor: {\n color: Platform.select({\n ios: PlatformColor('link'),\n android: colors.fillColorInteractionDefault as ColorValue,\n }),\n },\n androidCancelButton: {\n marginRight: 16,\n },\n iosCancelButton: {\n fontWeight: 'normal',\n },\n disabledColor: {\n color: colors.textColorDefaultDisabled,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"platform_modal_header_buttons.js","sourceRoot":"","sources":["../../../src/components/display/platform_modal_header_buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAQtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,OAAO,EACP,KAAK,GAAG,QAAQ,EAChB,GAAG,KAAK,EACgB,EAAE,EAAE;IAC5B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,CAAC,UAAU,CACT,qBAAqB,CAAC,CAAC,CAAC,CAAC,CACzB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC,CAC7E,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,KAAK,CACR;IAAA,EAAE,UAAU,CAAC,CACd,CAAA;AACH,CAAC,CAAA;AAQD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,OAAO,EACP,KAAK,GAAG,QAAQ,EAChB,SAAS,EACT,GAAG,KAAK,EACgB,EAAE,EAAE;IAC5B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,QAAQ,CAAC,MAAM,CAAC;QACrB,GAAG,EAAE,CACH,CAAC,UAAU,CACT,qBAAqB,CAAC,CAAC,CAAC,CAAC,CACzB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC,CAC7D,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,KAAK,CACR;MAAA,EAAE,UAAU,CAAC,CACd;QACD,OAAO,EAAE,CACP,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAC7E;QAAA,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,EACpD;MAAA,EAAE,YAAY,CAAC,CAChB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACrB,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC;gBAC1B,OAAO,EAAE,MAAM,CAAC,2BAAyC;aAC1D,CAAC;SACH;QACD,mBAAmB,EAAE;YACnB,WAAW,EAAE,EAAE;SAChB;QACD,eAAe,EAAE;YACf,UAAU,EAAE,QAAQ;SACrB;QACD,aAAa,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { ColorValue, Platform, StyleSheet, PlatformColor } from 'react-native'\nimport { TextButton } from './text_button'\nimport { HeaderButton } from '@react-navigation/elements'\nimport { Icon } from './icon'\nimport { useTheme } from '../../hooks'\n\ninterface HeaderSubmitButtonProps {\n onPress: () => void\n title?: string\n disabled?: boolean\n}\n\nexport const HeaderSubmitButton = ({\n onPress,\n title = 'Submit',\n ...props\n}: HeaderSubmitButtonProps) => {\n const styles = useStyles()\n\n return (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, props.disabled && styles.disabledColor]}\n {...props}\n >\n {title}\n </TextButton>\n )\n}\n\ninterface HeaderCancelButtonProps {\n onPress: () => void\n title?: string\n tintColor?: ColorValue\n}\n\nexport const HeaderCancelButton = ({\n onPress,\n title = 'Cancel',\n tintColor,\n ...props\n}: HeaderCancelButtonProps) => {\n const styles = useStyles()\n\n return Platform.select({\n ios: (\n <TextButton\n maxFontSizeMultiplier={1}\n onPress={onPress}\n textStyle={[styles.interactionColor, styles.iosCancelButton]}\n {...props}\n >\n {title}\n </TextButton>\n ),\n default: (\n <HeaderButton onPress={onPress} style={[styles.androidCancelButton]} {...props}>\n <Icon name=\"general.x\" size={16} color={tintColor} />\n </HeaderButton>\n ),\n })\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n interactionColor: {\n color: Platform.select({\n ios: PlatformColor('link'),\n android: colors.fillColorInteractionDefault as ColorValue,\n }),\n },\n androidCancelButton: {\n marginRight: 16,\n },\n iosCancelButton: {\n fontWeight: 'normal',\n },\n disabledColor: {\n color: colors.textColorDefaultDisabled,\n },\n })\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { PressableProps } from 'react-native';
|
|
3
3
|
import type { TextProps } from './text';
|
|
4
4
|
import type { ButtonAppearanceUnion } from './utils/button_colors';
|
|
5
|
-
interface TextButtonProps extends PressableProps {
|
|
5
|
+
export interface TextButtonProps extends PressableProps {
|
|
6
6
|
/**
|
|
7
7
|
* Specifies whether fonts should be scaled down automatically to fit given style constraints.
|
|
8
8
|
*/
|
|
@@ -37,5 +37,4 @@ interface TextButtonProps extends PressableProps {
|
|
|
37
37
|
textStyle?: TextProps['style'];
|
|
38
38
|
}
|
|
39
39
|
export declare function TextButton({ adjustsFontSizeToFit, allowFontScaling, appearance, disabled, children, maxFontSizeMultiplier, minimumFontScale, variant, style, textStyle, ...props }: TextButtonProps): React.JSX.Element;
|
|
40
|
-
export {};
|
|
41
40
|
//# sourceMappingURL=text_button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text_button.d.ts","sourceRoot":"","sources":["../../../src/components/display/text_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAIlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAMlE,
|
|
1
|
+
{"version":3,"file":"text_button.d.ts","sourceRoot":"","sources":["../../../src/components/display/text_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAIlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAMlE,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAA;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAA;IAChC;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC9B;;OAEG;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AE;YACP,OAAO,EAAE,GAAG;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\nimport type { PressableProps } from 'react-native'\nimport { useTheme } from '../../hooks'\nimport { platformFontWeightMedium } from '../../utils'\nimport { Text } from './text'\nimport type { TextProps } from './text'\nimport { getColorKey, useButtonColorOptionMap } from './utils/button_colors'\nimport type { ButtonAppearanceUnion } from './utils/button_colors'\n\n// =================================\n// ====== Component ================\n// =================================\n\
|
|
1
|
+
{"version":3,"file":"text_button.js","sourceRoot":"","sources":["../../../src/components/display/text_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AA0C5E,MAAM,UAAU,UAAU,CAAC,EACzB,oBAAoB,GAAG,KAAK,EAC5B,gBAAgB,GAAG,IAAI,EACvB,UAAU,GAAG,aAAa,EAC1B,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,EAChB,OAAO,GAAG,OAAO,EACjB,KAAK,EACL,SAAS,EACT,GAAG,KAAK,EACQ;IAChB,MAAM,MAAM,GAAG,SAAS,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAA;IAClD,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA,CAAC,+CAA+C;IAEhG,OAAO,CACL,CAAC,SAAS,CACR,iBAAiB,CAAC,QAAQ,CAC1B,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,K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AAM,CAAC,wBAAwB;SACvC;QACD,OAAO,EAAE;YACP,OAAO,EAAE,GAAG;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\nimport type { PressableProps } from 'react-native'\nimport { useTheme } from '../../hooks'\nimport { platformFontWeightMedium } from '../../utils'\nimport { Text } from './text'\nimport type { TextProps } from './text'\nimport { getColorKey, useButtonColorOptionMap } from './utils/button_colors'\nimport type { ButtonAppearanceUnion } from './utils/button_colors'\n\n// =================================\n// ====== Component ================\n// =================================\n\nexport interface TextButtonProps extends PressableProps {\n /**\n * Specifies whether fonts should be scaled down automatically to fit given style constraints.\n */\n adjustsFontSizeToFit?: boolean\n /**\n * Specifies whether fonts should scale to respect the device's text size accessibility settings. The default is true.\n */\n allowFontScaling?: boolean\n /**\n * Updates the button's colors\n */\n appearance?: ButtonAppearanceUnion\n /**\n * Renders text within a `Text`\n */\n children?: TextProps['children']\n /**\n * Specifies the maximum size a font can reach when allowFontScaling is enabled.\n */\n maxFontSizeMultiplier?: number\n /**\n * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).\n */\n minimumFontScale?: number\n /**\n * Changes the styles and size of the text.\n */\n variant?: TextProps['variant']\n /**\n * Changes the styles and size of the text.\n */\n textStyle?: TextProps['style']\n}\n\nexport function TextButton({\n adjustsFontSizeToFit = false,\n allowFontScaling = true,\n appearance = 'interaction',\n disabled = false,\n children,\n maxFontSizeMultiplier,\n minimumFontScale,\n variant = 'plain',\n style,\n textStyle,\n ...props\n}: TextButtonProps) {\n const styles = useStyles({ appearance, disabled })\n const overrideStyles = StyleSheet.flatten(style) // Ensures the pressed styles still get applied\n\n return (\n <Pressable\n accessibilityRole=\"button\"\n disabled={disabled}\n style={({ pressed }) => ({\n ...(pressed ? styles.pressed : null),\n ...overrideStyles,\n })} // Android & iOS intentionally get the same pressed style\n hitSlop={10}\n {...props}\n >\n <Text\n adjustsFontSizeToFit={adjustsFontSizeToFit}\n allowFontScaling={allowFontScaling}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n minimumFontScale={minimumFontScale}\n numberOfLines={1}\n style={[styles.text, disabled && styles.disabled, textStyle]}\n variant={variant}\n >\n {children}\n </Text>\n </Pressable>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({ appearance = 'interaction', disabled = false }: Partial<TextButtonProps>) => {\n const { colors } = useTheme()\n const colorKey = getColorKey({ disabled, appearance })\n const colorOptionMap = useButtonColorOptionMap()\n\n return StyleSheet.create({\n text: {\n fontWeight: platformFontWeightMedium,\n color: colorOptionMap[colorKey],\n },\n disabled: {\n color: colors.textColorDefaultDisabled,\n },\n pressed: {\n opacity: 0.5,\n },\n })\n}\n"]}
|
|
@@ -2,6 +2,7 @@ import { NativeStackNavigationOptions } from '@react-navigation/native-stack';
|
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
3
|
import { type AccessibilityRole, type StyleProp, type ViewStyle } from 'react-native';
|
|
4
4
|
import { IconString } from '../display';
|
|
5
|
+
import type { ButtonProps, TextButtonProps } from '../display';
|
|
5
6
|
/**
|
|
6
7
|
* Screen options for the formsheet's NativeStackNavigation route
|
|
7
8
|
* @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.
|
|
@@ -14,10 +15,14 @@ type FormSheetComponents = {
|
|
|
14
15
|
Root: React.FC<FormSheetRootProps>;
|
|
15
16
|
Action: React.FC<FormSheetActionProps>;
|
|
16
17
|
Header: React.FC<FormSheetHeaderProps>;
|
|
18
|
+
HeaderTitle: React.FC<FormSheetHeaderTitleProps>;
|
|
19
|
+
HeaderActions: React.FC<FormSheetHeaderActionsProps>;
|
|
20
|
+
HeaderSecondaryButton: React.FC<FormSheetHeaderSecondaryButtonProps>;
|
|
21
|
+
HeaderPrimaryButton: React.FC<FormSheetHeaderPrimaryButtonProps>;
|
|
17
22
|
};
|
|
18
23
|
declare const _default: FormSheetComponents;
|
|
19
24
|
export default _default;
|
|
20
|
-
export type { FormSheetRootProps, FormSheetActionProps, FormSheetHeaderProps };
|
|
25
|
+
export type { FormSheetRootProps, FormSheetActionProps, FormSheetHeaderProps, FormSheetHeaderTitleProps, FormSheetHeaderActionsProps, FormSheetHeaderSecondaryButtonProps, FormSheetHeaderPrimaryButtonProps, };
|
|
21
26
|
interface FormSheetRootProps {
|
|
22
27
|
children: ReactNode;
|
|
23
28
|
style?: StyleProp<ViewStyle>;
|
|
@@ -28,9 +33,17 @@ export declare namespace FormSheetRoot {
|
|
|
28
33
|
var displayName: string;
|
|
29
34
|
}
|
|
30
35
|
interface FormSheetHeaderProps {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
interface FormSheetHeaderTitleProps {
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
interface FormSheetHeaderActionsProps {
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
}
|
|
44
|
+
interface FormSheetHeaderSecondaryButtonProps extends Omit<TextButtonProps, 'maxFontSizeMultiplier'> {
|
|
45
|
+
}
|
|
46
|
+
interface FormSheetHeaderPrimaryButtonProps extends Omit<ButtonProps, 'maxFontSizeMultiplier'> {
|
|
34
47
|
}
|
|
35
48
|
declare const FORM_SHEET_ACTION_APPEARANCES: {
|
|
36
49
|
readonly neutral: "neutral";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form_sheet.d.ts","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAA;AAIrB,OAAO,EAAiB,UAAU,
|
|
1
|
+
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IAC5B,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CACpC;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,kBAAkB,qBASlF;yBATe,aAAa;;;AA8B7B,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,SAAS,CAAA;CACpB;AAcD,UAAU,yBAAyB;IACjC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAkBD,UAAU,2BAA2B;IACnC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAcD,UAAU,mCACR,SAAQ,IAAI,CAAC,eAAe,EAAE,uBAAuB,CAAC;CAAG;AAY3D,UAAU,iCAAkC,SAAQ,IAAI,CAAC,WAAW,EAAE,uBAAuB,CAAC;CAAG;AAYjG,QAAA,MAAM,6BAA6B;;;CAGzB,CAAA;AAEV,KAAK,8BAA8B,GACjC,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,OAAO,6BAA6B,CAAC,CAAA;AAEpF,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,UAAU,CAAA;IACpB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,UAAU,CAAC,EAAE,8BAA8B,CAAA;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB"}
|
|
@@ -3,7 +3,7 @@ import { Platform, StyleSheet, View, useWindowDimensions, } from 'react-native';
|
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
import { useTheme } from '../../hooks';
|
|
5
5
|
import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements';
|
|
6
|
-
import { Heading, Icon, Text } from '../display';
|
|
6
|
+
import { Heading, Icon, Text, Button, TextButton } from '../display';
|
|
7
7
|
// =================================
|
|
8
8
|
// ====== Exports ==================
|
|
9
9
|
// =================================
|
|
@@ -27,6 +27,10 @@ const FormSheet = {
|
|
|
27
27
|
Root: FormSheetRoot,
|
|
28
28
|
Action: FormSheetAction,
|
|
29
29
|
Header: FormSheetHeader,
|
|
30
|
+
HeaderTitle: FormSheetHeaderTitle,
|
|
31
|
+
HeaderActions: FormSheetHeaderActions,
|
|
32
|
+
HeaderSecondaryButton: FormSheetHeaderSecondaryButton,
|
|
33
|
+
HeaderPrimaryButton: FormSheetHeaderPrimaryButton,
|
|
30
34
|
};
|
|
31
35
|
export default FormSheet;
|
|
32
36
|
export function FormSheetRoot({ children, style, contentStyle }) {
|
|
@@ -47,20 +51,31 @@ function AndroidSheetGrabber() {
|
|
|
47
51
|
ios: null,
|
|
48
52
|
});
|
|
49
53
|
}
|
|
50
|
-
function FormSheetHeader({
|
|
54
|
+
function FormSheetHeader({ children }) {
|
|
51
55
|
const styles = useStyles();
|
|
52
|
-
|
|
53
|
-
return (<View style={styles.header}>
|
|
54
|
-
<Heading variant="h3" style={styles.headerTitle}>
|
|
55
|
-
{title}
|
|
56
|
-
</Heading>
|
|
57
|
-
{hasActions && (<View style={styles.headerActions}>
|
|
58
|
-
{secondaryButton}
|
|
59
|
-
{primaryButton}
|
|
60
|
-
</View>)}
|
|
61
|
-
</View>);
|
|
56
|
+
return <View style={styles.header}>{children}</View>;
|
|
62
57
|
}
|
|
63
58
|
FormSheetHeader.displayName = 'FormSheet.Header';
|
|
59
|
+
function FormSheetHeaderTitle({ children }) {
|
|
60
|
+
const styles = useStyles();
|
|
61
|
+
return (<Heading variant="h3" style={styles.headerTitle} maxFontSizeMultiplier={1}>
|
|
62
|
+
{children}
|
|
63
|
+
</Heading>);
|
|
64
|
+
}
|
|
65
|
+
FormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle';
|
|
66
|
+
function FormSheetHeaderActions({ children }) {
|
|
67
|
+
const styles = useStyles();
|
|
68
|
+
return <View style={styles.headerActions}>{children}</View>;
|
|
69
|
+
}
|
|
70
|
+
FormSheetHeaderActions.displayName = 'FormSheet.HeaderActions';
|
|
71
|
+
function FormSheetHeaderSecondaryButton(props) {
|
|
72
|
+
return <TextButton {...props} maxFontSizeMultiplier={1}/>;
|
|
73
|
+
}
|
|
74
|
+
FormSheetHeaderSecondaryButton.displayName = 'FormSheet.HeaderSecondaryButton';
|
|
75
|
+
function FormSheetHeaderPrimaryButton(props) {
|
|
76
|
+
return <Button {...props} maxFontSizeMultiplier={1}/>;
|
|
77
|
+
}
|
|
78
|
+
FormSheetHeaderPrimaryButton.displayName = 'FormSheet.HeaderPrimaryButton';
|
|
64
79
|
// ====================================
|
|
65
80
|
// ====== ActionsFormSheetAction ======
|
|
66
81
|
// ====================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,mBAAmB,GAIpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAc,IAAI,EAAE,MAAM,YAAY,CAAA;AAE5D,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,WAAW,EACX,mBAAmB,GAAG,CAAC,IAAI,CAAC,EAC5B,GAAG,IAAI,KACyB,EAAE,EAAgC,EAAE,CAAC,CAAC;IACtE,YAAY,EAAE,WAAW;IACzB,WAAW,EAAE,KAAK;IAClB,mBAAmB;IACnB,iBAAiB,E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E;YACT,MAAM,EAAE,CAAC;YACT,eAAe,EAAE,MAAM,CAAC,mBAAmB;YAC3C,YAAY,EAAE,GAAG;YACjB,SAAS,EAAE,QAAQ;SACpB;QACD,OAAO,EAAE;YACP,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;SACtD;QACD,MAAM,EAAE;YACN,eAAe,EAAE,MAAM,CAAC,2BAA2B;YACnD,iBAAiB,EAAE,EAAE;YACrB,aAAa,EAAE,EAAE;YACjB,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;YAChD,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;SAChC;QACD,WAAW,EAAE;YACX,SAAS,EAAE,MAAM;SAClB;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,eAAe,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;QACD,WAAW,EAAE;YACX,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { ReactNode } from 'react'\nimport {\n Platform,\n StyleSheet,\n View,\n useWindowDimensions,\n type AccessibilityRole,\n type StyleProp,\n type ViewStyle,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'\nimport { Heading, Icon, IconString, Text } from '../display'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\n/**\n * Screen options for the formsheet's NativeStackNavigation route\n * @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.\n * @param {number[]} [options.sheetAllowedDetents] - Controls the height increments the sheet grows to. To prevent bugs in Android, do not specify more then two values and use [0.94] instead of [1] to go full screen.\n * @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions\n * @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions\n */\nexport const getFormSheetScreenOptions = ({\n headerTitle,\n sheetAllowedDetents = [0.25],\n ...rest\n}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents,\n sheetCornerRadius: 16,\n sheetGrabberVisible: true,\n headerTitle,\n ...rest,\n})\n\nconst FormSheet = {\n Root: FormSheetRoot,\n Action: FormSheetAction,\n Header: FormSheetHeader,\n} as const\n\ntype FormSheetComponents = {\n Root: React.FC<FormSheetRootProps>\n Action: React.FC<FormSheetActionProps>\n Header: React.FC<FormSheetHeaderProps>\n}\n\nexport default FormSheet as FormSheetComponents\nexport type { FormSheetRootProps, FormSheetActionProps, FormSheetHeaderProps }\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface FormSheetRootProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n contentStyle?: StyleProp<ViewStyle>\n}\n\nexport function FormSheetRoot({ children, style, contentStyle }: FormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]} collapsable={false}>\n <AndroidSheetGrabber />\n <View style={[styles.content, contentStyle]}>{children}</View>\n </View>\n )\n}\n\nFormSheetRoot.displayName = 'FormSheet.Root'\n\n// ====================================\n// ====== AndroidSheetGrabber =========\n// ====================================\n\nfunction AndroidSheetGrabber() {\n const styles = useStyles()\n\n return Platform.select({\n android: <View style={styles.androidSheetGrabber} />,\n ios: null,\n })\n}\n\n// ====================================\n// ====== FormSheetHeader =============\n// ====================================\n\ninterface FormSheetHeaderProps {\n title: string\n secondaryButton?: ReactNode\n primaryButton?: ReactNode\n}\nfunction FormSheetHeader({ title, secondaryButton, primaryButton }: FormSheetHeaderProps) {\n const styles = useStyles()\n const hasActions = Boolean(secondaryButton) || Boolean(primaryButton)\n\n return (\n <View style={styles.header}>\n <Heading variant=\"h3\" style={styles.headerTitle}>\n {title}\n </Heading>\n {hasActions && (\n <View style={styles.headerActions}>\n {secondaryButton}\n {primaryButton}\n </View>\n )}\n </View>\n )\n}\n\nFormSheetHeader.displayName = 'FormSheet.Header'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype FormSheetActionAppearanceUnion =\n (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]\n\ninterface FormSheetActionProps {\n title: string\n iconName: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n}\n\nfunction FormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n disabled = false,\n}: FormSheetActionProps) {\n const styles = useStyles({ appearance })\n\n return (\n <PlatformPressable\n onPress={onPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole={accessibilityRole}\n style={styles.actionPressable}\n disabled={disabled}\n >\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n <Text style={styles.actionTitle}>{title}</Text>\n </PlatformPressable>\n )\n}\n\nFormSheetAction.displayName = 'FormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: FormSheetActionAppearanceUnion\n}\n\nconst useStyles = ({ appearance = 'neutral' }: Styles = {}) => {\n const { colors } = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n ios: height - top - headerHeight,\n default: null,\n })\n\n const appearanceColorsMap = {\n neutral: {\n iconColor: colors.iconColorDefaultPrimary,\n textColor: colors.textColorDefaultPrimary,\n },\n danger: {\n iconColor: colors.fillColorStatusErrorMedium,\n textColor: colors.fillColorStatusErrorMedium,\n },\n }\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'flex-start',\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n height: containerHeight,\n },\n androidSheetGrabber: {\n marginTop: 5,\n width: 34,\n height: 5,\n backgroundColor: colors.fillColorNeutral040,\n borderRadius: 100,\n alignSelf: 'center',\n },\n content: {\n paddingTop: Platform.select({ android: 16, ios: 20 }),\n },\n header: {\n backgroundColor: colors.fillColorNeutral100Inverted,\n paddingHorizontal: 16,\n paddingBottom: 16,\n gap: 16,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n headerTitle: {\n textAlign: 'left',\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n actionPressable: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n actionIcon: {\n color: appearanceColorsMap[appearance].iconColor,\n },\n actionTitle: {\n color: appearanceColorsMap[appearance].textColor,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,mBAAmB,GAIpB,MAAM,c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S,EAAE,CAAC;YACZ,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,CAAC;YACT,eAAe,EAAE,MAAM,CAAC,mBAAmB;YAC3C,YAAY,EAAE,GAAG;YACjB,SAAS,EAAE,QAAQ;SACpB;QACD,OAAO,EAAE;YACP,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;SACtD;QACD,MAAM,EAAE;YACN,eAAe,EAAE,MAAM,CAAC,2BAA2B;YACnD,iBAAiB,EAAE,EAAE;YACrB,aAAa,EAAE,EAAE;YACjB,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;YAChD,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;SAChC;QACD,WAAW,EAAE;YACX,SAAS,EAAE,MAAM;SAClB;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,eAAe,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;QACD,WAAW,EAAE;YACX,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { ReactNode } from 'react'\nimport {\n Platform,\n StyleSheet,\n View,\n useWindowDimensions,\n type AccessibilityRole,\n type StyleProp,\n type ViewStyle,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'\nimport { Heading, Icon, IconString, Text, Button, TextButton } from '../display'\nimport type { ButtonProps, TextButtonProps } from '../display'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\n/**\n * Screen options for the formsheet's NativeStackNavigation route\n * @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.\n * @param {number[]} [options.sheetAllowedDetents] - Controls the height increments the sheet grows to. To prevent bugs in Android, do not specify more then two values and use [0.94] instead of [1] to go full screen.\n * @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions\n * @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions\n */\nexport const getFormSheetScreenOptions = ({\n headerTitle,\n sheetAllowedDetents = [0.25],\n ...rest\n}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents,\n sheetCornerRadius: 16,\n sheetGrabberVisible: true,\n headerTitle,\n ...rest,\n})\n\nconst FormSheet = {\n Root: FormSheetRoot,\n Action: FormSheetAction,\n Header: FormSheetHeader,\n HeaderTitle: FormSheetHeaderTitle,\n HeaderActions: FormSheetHeaderActions,\n HeaderSecondaryButton: FormSheetHeaderSecondaryButton,\n HeaderPrimaryButton: FormSheetHeaderPrimaryButton,\n} as const\n\ntype FormSheetComponents = {\n Root: React.FC<FormSheetRootProps>\n Action: React.FC<FormSheetActionProps>\n Header: React.FC<FormSheetHeaderProps>\n HeaderTitle: React.FC<FormSheetHeaderTitleProps>\n HeaderActions: React.FC<FormSheetHeaderActionsProps>\n HeaderSecondaryButton: React.FC<FormSheetHeaderSecondaryButtonProps>\n HeaderPrimaryButton: React.FC<FormSheetHeaderPrimaryButtonProps>\n}\n\nexport default FormSheet as FormSheetComponents\nexport type {\n FormSheetRootProps,\n FormSheetActionProps,\n FormSheetHeaderProps,\n FormSheetHeaderTitleProps,\n FormSheetHeaderActionsProps,\n FormSheetHeaderSecondaryButtonProps,\n FormSheetHeaderPrimaryButtonProps,\n}\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface FormSheetRootProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n contentStyle?: StyleProp<ViewStyle>\n}\n\nexport function FormSheetRoot({ children, style, contentStyle }: FormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]} collapsable={false}>\n <AndroidSheetGrabber />\n <View style={[styles.content, contentStyle]}>{children}</View>\n </View>\n )\n}\n\nFormSheetRoot.displayName = 'FormSheet.Root'\n\n// ====================================\n// ====== AndroidSheetGrabber =========\n// ====================================\n\nfunction AndroidSheetGrabber() {\n const styles = useStyles()\n\n return Platform.select({\n android: <View style={styles.androidSheetGrabber} />,\n ios: null,\n })\n}\n\n// ====================================\n// ====== FormSheetHeader =============\n// ====================================\n\ninterface FormSheetHeaderProps {\n children: ReactNode\n}\n\nfunction FormSheetHeader({ children }: FormSheetHeaderProps) {\n const styles = useStyles()\n\n return <View style={styles.header}>{children}</View>\n}\n\nFormSheetHeader.displayName = 'FormSheet.Header'\n\n// ====================================\n// ====== FormSheetHeaderTitle ========\n// ====================================\n\ninterface FormSheetHeaderTitleProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {\n const styles = useStyles()\n\n return (\n <Heading variant=\"h3\" style={styles.headerTitle} maxFontSizeMultiplier={1}>\n {children}\n </Heading>\n )\n}\n\nFormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle'\n\n// ====================================\n// ====== FormSheetHeaderActions ======\n// ====================================\n\ninterface FormSheetHeaderActionsProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderActions({ children }: FormSheetHeaderActionsProps) {\n const styles = useStyles()\n\n return <View style={styles.headerActions}>{children}</View>\n}\n\nFormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'\n\n// ===========================================\n// ====== FormSheetHeaderSecondaryButton ====\n// ===========================================\n\ninterface FormSheetHeaderSecondaryButtonProps\n extends Omit<TextButtonProps, 'maxFontSizeMultiplier'> {}\n\nfunction FormSheetHeaderSecondaryButton(props: FormSheetHeaderSecondaryButtonProps) {\n return <TextButton {...props} maxFontSizeMultiplier={1} />\n}\n\nFormSheetHeaderSecondaryButton.displayName = 'FormSheet.HeaderSecondaryButton'\n\n// =========================================\n// ====== FormSheetHeaderPrimaryButton ====\n// =========================================\n\ninterface FormSheetHeaderPrimaryButtonProps extends Omit<ButtonProps, 'maxFontSizeMultiplier'> {}\n\nfunction FormSheetHeaderPrimaryButton(props: FormSheetHeaderPrimaryButtonProps) {\n return <Button {...props} maxFontSizeMultiplier={1} />\n}\n\nFormSheetHeaderPrimaryButton.displayName = 'FormSheet.HeaderPrimaryButton'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype FormSheetActionAppearanceUnion =\n (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]\n\ninterface FormSheetActionProps {\n title: string\n iconName: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n}\n\nfunction FormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n disabled = false,\n}: FormSheetActionProps) {\n const styles = useStyles({ appearance })\n\n return (\n <PlatformPressable\n onPress={onPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole={accessibilityRole}\n style={styles.actionPressable}\n disabled={disabled}\n >\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n <Text style={styles.actionTitle}>{title}</Text>\n </PlatformPressable>\n )\n}\n\nFormSheetAction.displayName = 'FormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: FormSheetActionAppearanceUnion\n}\n\nconst useStyles = ({ appearance = 'neutral' }: Styles = {}) => {\n const { colors } = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n ios: height - top - headerHeight,\n default: null,\n })\n\n const appearanceColorsMap = {\n neutral: {\n iconColor: colors.iconColorDefaultPrimary,\n textColor: colors.textColorDefaultPrimary,\n },\n danger: {\n iconColor: colors.fillColorStatusErrorMedium,\n textColor: colors.fillColorStatusErrorMedium,\n },\n }\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'flex-start',\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n height: containerHeight,\n },\n androidSheetGrabber: {\n marginTop: 5,\n width: 34,\n height: 5,\n backgroundColor: colors.fillColorNeutral040,\n borderRadius: 100,\n alignSelf: 'center',\n },\n content: {\n paddingTop: Platform.select({ android: 16, ios: 20 }),\n },\n header: {\n backgroundColor: colors.fillColorNeutral100Inverted,\n paddingHorizontal: 16,\n paddingBottom: 16,\n gap: 16,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n headerTitle: {\n textAlign: 'left',\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n actionPressable: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n actionIcon: {\n color: appearanceColorsMap[appearance].iconColor,\n },\n actionTitle: {\n color: appearanceColorsMap[appearance].textColor,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_read_receipts_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation/message_read_receipts_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAe,MAAM,OAAO,CAAA;AAUnC,eAAO,MAAM,gCAAgC,uEAM3C,CAAA;AAEF,MAAM,MAAM,8BAA8B,GAAG,iBAAiB,CAAC;IAC7D,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAEF,wBAAgB,yBAAyB,CAAC,EAAE,KAAK,EAAE,EAAE,8BAA8B,
|
|
1
|
+
{"version":3,"file":"message_read_receipts_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation/message_read_receipts_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAe,MAAM,OAAO,CAAA;AAUnC,eAAO,MAAM,gCAAgC,uEAM3C,CAAA;AAEF,MAAM,MAAM,8BAA8B,GAAG,iBAAiB,CAAC;IAC7D,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAEF,wBAAgB,yBAAyB,CAAC,EAAE,KAAK,EAAE,EAAE,8BAA8B,qBAiClF"}
|
|
@@ -2,7 +2,7 @@ import { useNavigation } from '@react-navigation/native';
|
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
import { Platform, StyleSheet, View } from 'react-native';
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
-
import { Avatar, Text
|
|
5
|
+
import { Avatar, Text } from '../../components';
|
|
6
6
|
import { useReadReceipts } from '../../hooks/use_read_receipts';
|
|
7
7
|
import { FlatList } from 'react-native-gesture-handler';
|
|
8
8
|
import FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet';
|
|
@@ -20,7 +20,14 @@ export function MessageReadReceiptsScreen({ route }) {
|
|
|
20
20
|
const { conversation_id, message_id } = route.params;
|
|
21
21
|
const { data: receipts, totalCount, fetchNextPage, } = useReadReceipts({ conversation_id, message_id });
|
|
22
22
|
return (<FormSheet.Root>
|
|
23
|
-
<FormSheet.Header
|
|
23
|
+
<FormSheet.Header>
|
|
24
|
+
<FormSheet.HeaderTitle>Read receipts ({totalCount})</FormSheet.HeaderTitle>
|
|
25
|
+
<FormSheet.HeaderActions>
|
|
26
|
+
<FormSheet.HeaderSecondaryButton onPress={() => navigation.goBack()}>
|
|
27
|
+
Close
|
|
28
|
+
</FormSheet.HeaderSecondaryButton>
|
|
29
|
+
</FormSheet.HeaderActions>
|
|
30
|
+
</FormSheet.Header>
|
|
24
31
|
<FlatList data={receipts} contentContainerStyle={styles.contentContainer} keyExtractor={item => item.id.toString()} renderItem={({ item }) => <Receipt receipt={item}/>} nestedScrollEnabled ListEmptyComponent={<Text style={styles.emptyText}>No one has read this message yet.</Text>} onEndReached={() => fetchNextPage()} onEndReachedThreshold={0.2}/>
|
|
25
32
|
</FormSheet.Root>);
|
|
26
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_read_receipts_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation/message_read_receipts_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"message_read_receipts_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation/message_read_receipts_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACnC,O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,CAAC,MAAM,CAAC,IAAI,CAAC,CAC5D;QAAA,CAAC,OAAO,CAAC,IAAI,CACf;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IACtC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;SACtE;QACD,UAAU,EAAE;YACV,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;YACN,eAAe,EAAE,CAAC;YAClB,IAAI,EAAE,CAAC;SACR;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,CAAC;SACR;QACD,SAAS,EAAE;YACT,SAAS,EAAE,QAAQ;YACnB,KAAK,EAAE,MAAM,CAAC,yBAAyB;YACvC,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;SACb;QACD,cAAc,EAAE;YACd,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;SACzB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, { memo } from 'react'\nimport { Platform, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Avatar, Text } from '../../components'\nimport { useReadReceipts } from '../../hooks/use_read_receipts'\nimport { FlatList } from 'react-native-gesture-handler'\nimport { ReadReceiptResource } from '../../types/resources/read_receipt'\nimport FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet'\nimport { useTheme } from '../../hooks'\n\nexport const MessageReadReceiptsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: Platform.select({\n android: [0.5, 0.94], // Going straight to full 0.94 preserves height of screen on Android\n default: [0.5, 1],\n }),\n headerTitle: 'Read receipts',\n})\n\nexport type MessageReadReceiptsScreenProps = StaticScreenProps<{\n conversation_id: number\n message_id: string\n}>\n\nexport function MessageReadReceiptsScreen({ route }: MessageReadReceiptsScreenProps) {\n const styles = useStyles()\n const navigation = useNavigation()\n\n const { conversation_id, message_id } = route.params\n const {\n data: receipts,\n totalCount,\n fetchNextPage,\n } = useReadReceipts({ conversation_id, message_id })\n\n return (\n <FormSheet.Root>\n <FormSheet.Header>\n <FormSheet.HeaderTitle>Read receipts ({totalCount})</FormSheet.HeaderTitle>\n <FormSheet.HeaderActions>\n <FormSheet.HeaderSecondaryButton onPress={() => navigation.goBack()}>\n Close\n </FormSheet.HeaderSecondaryButton>\n </FormSheet.HeaderActions>\n </FormSheet.Header>\n <FlatList\n data={receipts}\n contentContainerStyle={styles.contentContainer}\n keyExtractor={item => item.id.toString()}\n renderItem={({ item }) => <Receipt receipt={item} />}\n nestedScrollEnabled\n ListEmptyComponent={<Text style={styles.emptyText}>No one has read this message yet.</Text>}\n onEndReached={() => fetchNextPage()}\n onEndReachedThreshold={0.2}\n />\n </FormSheet.Root>\n )\n}\n\nconst Receipt = memo(({ receipt }: { receipt: ReadReceiptResource }) => {\n const styles = useStyles()\n\n return (\n <View style={styles.receiptRow}>\n <Avatar sourceUri={receipt.avatar} size=\"sm\" />\n <Text variant=\"tertiary\" numberOfLines={2} style={styles.name}>\n {receipt.name}\n </Text>\n </View>\n )\n})\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n const { colors } = useTheme()\n\n return StyleSheet.create({\n contentContainer: {\n paddingHorizontal: 16,\n paddingTop: 8,\n paddingBottom: bottom + Platform.select({ android: 24, default: 16 }),\n },\n receiptRow: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n paddingVertical: 8,\n flex: 1,\n },\n name: {\n flex: 1,\n },\n emptyText: {\n textAlign: 'center',\n color: colors.textColorDefaultSecondary,\n marginTop: 32,\n fontSize: 16,\n },\n emptyContainer: {\n flex: 1,\n justifyContent: 'center',\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_details_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_details_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AACzF,OAAO,KAQN,MAAM,OAAO,CAAA;AAgEd,MAAM,MAAM,8BAA8B,GAAG,iBAAiB,CAAC;IAC7D,eAAe,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF,wBAAgB,yBAAyB,CAAC,EAAE,KAAK,EAAE,EAAE,8BAA8B,
|
|
1
|
+
{"version":3,"file":"conversation_details_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_details_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AACzF,OAAO,KAQN,MAAM,OAAO,CAAA;AAgEd,MAAM,MAAM,8BAA8B,GAAG,iBAAiB,CAAC;IAC7D,eAAe,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF,wBAAgB,yBAAyB,CAAC,EAAE,KAAK,EAAE,EAAE,8BAA8B,qBAwSlF"}
|
|
@@ -99,8 +99,8 @@ export function ConversationDetailsScreen({ route }) {
|
|
|
99
99
|
}, [deleteConversation, navigation, title]);
|
|
100
100
|
const HeaderTitle = useCallback((props) => {
|
|
101
101
|
return (<View style={styles.headerTitleContainer}>
|
|
102
|
-
<ElementsHeaderTitle {...props}/>
|
|
103
|
-
<Badge variant="metaSubtle" label={resourceType} metaLabel={name} style={styles.headerTitleBadge} productLogoName={productName}/>
|
|
102
|
+
<ElementsHeaderTitle maxFontSizeMultiplier={1} {...props}/>
|
|
103
|
+
<Badge variant="metaSubtle" label={resourceType} metaLabel={name} style={styles.headerTitleBadge} productLogoName={productName} maxFontSizeMultiplier={1}/>
|
|
104
104
|
</View>);
|
|
105
105
|
}, [name, productName, resourceType, styles.headerTitleBadge, styles.headerTitleContainer]);
|
|
106
106
|
const HeaderRight = useCallback(() => {
|