@planningcenter/chat-react-native 3.7.0-rc.7 → 3.7.0-rc.9
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/primitive/form_sheet.d.ts +41 -0
- package/build/components/primitive/form_sheet.d.ts.map +1 -0
- package/build/components/primitive/{actions_form_sheet.js → form_sheet.js} +43 -24
- package/build/components/primitive/form_sheet.js.map +1 -0
- package/build/navigation/index.d.ts +1 -72
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +1 -4
- package/build/navigation/index.js.map +1 -1
- package/build/screens/attachment_actions/attachment_actions_screen.d.ts.map +1 -1
- package/build/screens/attachment_actions/attachment_actions_screen.js +8 -6
- package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
- package/build/screens/conversation/message_read_receipts_screen.d.ts +1 -1
- package/build/screens/conversation/message_read_receipts_screen.d.ts.map +1 -1
- package/build/screens/conversation/message_read_receipts_screen.js +28 -39
- package/build/screens/conversation/message_read_receipts_screen.js.map +1 -1
- package/build/screens/conversation_filters_screen.d.ts.map +1 -1
- package/build/screens/conversation_filters_screen.js +1 -4
- 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 +7 -7
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/utils/index.d.ts +0 -1
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +0 -1
- package/build/utils/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/primitive/{actions_form_sheet.tsx → form_sheet.tsx} +61 -35
- package/src/navigation/index.tsx +1 -4
- package/src/screens/attachment_actions/attachment_actions_screen.tsx +8 -8
- package/src/screens/conversation/message_read_receipts_screen.tsx +37 -51
- package/src/screens/conversation_filters_screen.tsx +1 -4
- package/src/screens/conversation_screen.tsx +11 -7
- package/src/utils/index.ts +0 -1
- package/build/components/primitive/actions_form_sheet.d.ts +0 -34
- package/build/components/primitive/actions_form_sheet.d.ts.map +0 -1
- package/build/components/primitive/actions_form_sheet.js.map +0 -1
- package/build/utils/navigation_constants.d.ts +0 -2
- package/build/utils/navigation_constants.d.ts.map +0 -1
- package/build/utils/navigation_constants.js +0 -11
- package/build/utils/navigation_constants.js.map +0 -1
- package/src/utils/navigation_constants.ts +0 -12
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { useHeaderHeight } from '@react-navigation/elements'
|
|
2
|
+
import { StaticScreenProps } from '@react-navigation/native'
|
|
3
|
+
import { NativeStackNavigationOptions } from '@react-navigation/native-stack'
|
|
4
|
+
import React, { memo } from 'react'
|
|
5
|
+
import { Platform, StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
3
6
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
4
7
|
import { Avatar, Heading, Text } from '../../components'
|
|
5
8
|
import { useTheme } from '../../hooks'
|
|
6
|
-
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
7
|
-
import { NativeStackNavigationOptions } from '@react-navigation/native-stack'
|
|
8
9
|
import { useReadReceipts } from '../../hooks/use_read_receipts'
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
const SCREEN_HEIGHT_RATIO_QUARTER = 0.25 // 25% of the screen height
|
|
13
|
-
const SCREEN_HEIGHT_RATIO_HALF = 0.5 // 50% of the screen height
|
|
14
|
-
const SCREEN_HEIGHT_RATIO_FULL = 1 // 100% of the screen height
|
|
10
|
+
import { FlatList } from 'react-native-gesture-handler'
|
|
11
|
+
import { ReadReceiptResource } from '../../types/resources/read_receipt'
|
|
15
12
|
|
|
16
13
|
export const MessageReadReceiptsScreenOptions: NativeStackNavigationOptions = {
|
|
17
|
-
presentation:
|
|
14
|
+
presentation: 'formSheet',
|
|
18
15
|
sheetAllowedDetents: Platform.select({
|
|
19
|
-
|
|
20
|
-
default:
|
|
16
|
+
android: [0.25, 0.94], // Going straight to full 0.94 preserves height of screen on Android
|
|
17
|
+
default: [0.25, 0.5, 1],
|
|
21
18
|
}),
|
|
22
19
|
sheetGrabberVisible: true,
|
|
23
|
-
headerShown:
|
|
20
|
+
headerShown: false,
|
|
24
21
|
sheetCornerRadius: 16,
|
|
22
|
+
headerTitle: 'Read receipts',
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
export type MessageReadReceiptsScreenProps = StaticScreenProps<{
|
|
@@ -31,7 +29,6 @@ export type MessageReadReceiptsScreenProps = StaticScreenProps<{
|
|
|
31
29
|
|
|
32
30
|
export function MessageReadReceiptsScreen({ route }: MessageReadReceiptsScreenProps) {
|
|
33
31
|
const styles = useStyles()
|
|
34
|
-
const navigation = useNavigation()
|
|
35
32
|
|
|
36
33
|
const { conversation_id, message_id } = route.params
|
|
37
34
|
const {
|
|
@@ -40,49 +37,38 @@ export function MessageReadReceiptsScreen({ route }: MessageReadReceiptsScreenPr
|
|
|
40
37
|
fetchNextPage,
|
|
41
38
|
} = useReadReceipts({ conversation_id, message_id })
|
|
42
39
|
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
navigation.setOptions({
|
|
45
|
-
headerTitle: `Read receipts (${totalCount})`,
|
|
46
|
-
})
|
|
47
|
-
}, [totalCount, navigation])
|
|
48
|
-
|
|
49
40
|
return (
|
|
50
|
-
<View style={styles.container}>
|
|
51
|
-
<
|
|
41
|
+
<View style={styles.container} collapsable={false}>
|
|
42
|
+
<Heading variant="h3" style={styles.header}>
|
|
43
|
+
Read receipts ({totalCount})
|
|
44
|
+
</Heading>
|
|
45
|
+
<FlatList
|
|
52
46
|
data={receipts}
|
|
53
|
-
|
|
47
|
+
style={styles.contentContainer}
|
|
54
48
|
keyExtractor={item => item.id.toString()}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<View style={styles.receiptRow}>
|
|
58
|
-
<Avatar sourceUri={item.avatar} size="sm" />
|
|
59
|
-
<Text variant="tertiary" numberOfLines={2} style={styles.name}>
|
|
60
|
-
{item.name}
|
|
61
|
-
</Text>
|
|
62
|
-
</View>
|
|
63
|
-
)}
|
|
64
|
-
ListHeaderComponent={() => PlatformListHeader({ totalCount })}
|
|
49
|
+
renderItem={({ item }) => <Receipt receipt={item} />}
|
|
50
|
+
nestedScrollEnabled
|
|
65
51
|
ListFooterComponent={<View style={styles.footer} />}
|
|
66
52
|
ListEmptyComponent={<Text style={styles.emptyText}>No one has read this message yet.</Text>}
|
|
67
|
-
onEndReached={fetchNextPage}
|
|
53
|
+
onEndReached={() => fetchNextPage()}
|
|
68
54
|
onEndReachedThreshold={0.2}
|
|
69
55
|
/>
|
|
70
56
|
</View>
|
|
71
57
|
)
|
|
72
58
|
}
|
|
73
59
|
|
|
74
|
-
|
|
60
|
+
const Receipt = memo(({ receipt }: { receipt: ReadReceiptResource }) => {
|
|
75
61
|
const styles = useStyles()
|
|
76
62
|
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
63
|
+
return (
|
|
64
|
+
<View style={styles.receiptRow}>
|
|
65
|
+
<Avatar sourceUri={receipt.avatar} size="sm" />
|
|
66
|
+
<Text variant="tertiary" numberOfLines={2} style={styles.name}>
|
|
67
|
+
{receipt.name}
|
|
68
|
+
</Text>
|
|
69
|
+
</View>
|
|
70
|
+
)
|
|
71
|
+
})
|
|
86
72
|
|
|
87
73
|
const useStyles = () => {
|
|
88
74
|
const theme = useTheme()
|
|
@@ -91,23 +77,23 @@ const useStyles = () => {
|
|
|
91
77
|
const headerHeight = useHeaderHeight()
|
|
92
78
|
|
|
93
79
|
const containerHeight = Platform.select({
|
|
94
|
-
android:
|
|
80
|
+
android: null,
|
|
95
81
|
ios: height - top - headerHeight,
|
|
96
82
|
})
|
|
97
83
|
|
|
98
84
|
return StyleSheet.create({
|
|
99
85
|
container: {
|
|
100
|
-
|
|
86
|
+
paddingTop: 16,
|
|
101
87
|
backgroundColor: theme.colors.fillColorNeutral100Inverted,
|
|
102
88
|
height: containerHeight,
|
|
103
89
|
flex: 1,
|
|
104
90
|
},
|
|
105
91
|
contentContainer: {
|
|
106
|
-
|
|
92
|
+
paddingHorizontal: 16,
|
|
107
93
|
},
|
|
108
94
|
header: {
|
|
109
|
-
|
|
110
|
-
|
|
95
|
+
paddingHorizontal: 16,
|
|
96
|
+
paddingBottom: 8,
|
|
111
97
|
},
|
|
112
98
|
receiptRow: {
|
|
113
99
|
flexDirection: 'row',
|
|
@@ -120,7 +106,7 @@ const useStyles = () => {
|
|
|
120
106
|
flex: 1,
|
|
121
107
|
},
|
|
122
108
|
footer: {
|
|
123
|
-
height: bottom +
|
|
109
|
+
height: bottom + 16,
|
|
124
110
|
},
|
|
125
111
|
emptyText: {
|
|
126
112
|
textAlign: 'center',
|
|
@@ -49,10 +49,7 @@ const HeaderRightWithContext = () => {
|
|
|
49
49
|
|
|
50
50
|
export const ConversationFiltersScreenOptions: NativeStackNavigationOptions = {
|
|
51
51
|
presentation: Platform.select({ android: 'modal', ios: 'formSheet' }),
|
|
52
|
-
sheetAllowedDetents:
|
|
53
|
-
android: [0.75, 0.94],
|
|
54
|
-
default: [0.75, 1],
|
|
55
|
-
}),
|
|
52
|
+
sheetAllowedDetents: [0.75, 1],
|
|
56
53
|
sheetGrabberVisible: true,
|
|
57
54
|
headerBackVisible: false,
|
|
58
55
|
headerRight: HeaderRightWithContext,
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
MemberDisabledRepliesBanner,
|
|
19
19
|
} from '../components/conversation/disabled_replies_banners'
|
|
20
20
|
import { EmptyConversationBlankState } from '../components/conversation/empty_conversation_blank_state'
|
|
21
|
+
import { BlankState } from '../components/display/blank_state'
|
|
21
22
|
import { Message } from '../components/conversation/message'
|
|
22
23
|
import { MessageForm } from '../components/conversation/message_form'
|
|
23
24
|
import { TypingIndicator } from '../components/conversation/typing_indicator'
|
|
@@ -93,9 +94,16 @@ export function ConversationScreen({ route }: ConversationScreenProps) {
|
|
|
93
94
|
if (!conversation || conversation.deleted) {
|
|
94
95
|
return (
|
|
95
96
|
<View style={styles.container}>
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
<BlankState
|
|
98
|
+
iconName="general.outlinedTextMessage"
|
|
99
|
+
title="This conversation has been deleted"
|
|
100
|
+
buttonProps={{
|
|
101
|
+
onPress: navigation.goBack,
|
|
102
|
+
title: 'Back to conversations',
|
|
103
|
+
accessibilityHint: 'Navigates back to the conversations list',
|
|
104
|
+
accessibilityRole: 'link',
|
|
105
|
+
}}
|
|
106
|
+
/>
|
|
99
107
|
</View>
|
|
100
108
|
)
|
|
101
109
|
}
|
|
@@ -310,10 +318,6 @@ const useStyles = () => {
|
|
|
310
318
|
// Just whitespace to provide space where the typing indicator can be
|
|
311
319
|
height: 16,
|
|
312
320
|
},
|
|
313
|
-
deletedAlert: {
|
|
314
|
-
textAlign: 'center',
|
|
315
|
-
padding: 16,
|
|
316
|
-
},
|
|
317
321
|
})
|
|
318
322
|
}
|
|
319
323
|
|
package/src/utils/index.ts
CHANGED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { NativeStackNavigationOptions } from '@react-navigation/native-stack';
|
|
2
|
-
import React, { ReactNode } from 'react';
|
|
3
|
-
import { AccessibilityRole } from 'react-native';
|
|
4
|
-
import { IconString } from '../display';
|
|
5
|
-
export declare const BaseActionsFormSheetOptions: NativeStackNavigationOptions;
|
|
6
|
-
type ActionFormSheetComponents = {
|
|
7
|
-
Root: React.FC<ActionsFormSheetRootProps>;
|
|
8
|
-
Action: React.FC<ActionsFormSheetActionProps>;
|
|
9
|
-
};
|
|
10
|
-
declare const _default: ActionFormSheetComponents;
|
|
11
|
-
export default _default;
|
|
12
|
-
export type { ActionsFormSheetRootProps, ActionsFormSheetActionProps };
|
|
13
|
-
interface ActionsFormSheetRootProps {
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
}
|
|
16
|
-
export declare function ActionsFormSheetRoot({ children }: ActionsFormSheetRootProps): React.JSX.Element;
|
|
17
|
-
export declare namespace ActionsFormSheetRoot {
|
|
18
|
-
var displayName: string;
|
|
19
|
-
}
|
|
20
|
-
declare const ACTION_FORM_SHEET_ACTION_APPEARANCES: {
|
|
21
|
-
readonly neutral: "neutral";
|
|
22
|
-
readonly danger: "danger";
|
|
23
|
-
};
|
|
24
|
-
type ActionsFormSheetActionAppearanceUnion = (typeof ACTION_FORM_SHEET_ACTION_APPEARANCES)[keyof typeof ACTION_FORM_SHEET_ACTION_APPEARANCES];
|
|
25
|
-
interface ActionsFormSheetActionProps {
|
|
26
|
-
title: string;
|
|
27
|
-
iconName: IconString;
|
|
28
|
-
onPress: () => void;
|
|
29
|
-
accessibilityLabel?: string;
|
|
30
|
-
accessibilityHint?: string;
|
|
31
|
-
accessibilityRole?: AccessibilityRole;
|
|
32
|
-
appearance?: ActionsFormSheetActionAppearanceUnion;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=actions_form_sheet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actions_form_sheet.d.ts","sourceRoot":"","sources":["../../../src/components/primitive/actions_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,EAAE,iBAAiB,EAAoB,MAAM,cAAc,CAAA;AAKlE,OAAO,EAAQ,UAAU,EAAQ,MAAM,YAAY,CAAA;AAMnD,eAAO,MAAM,2BAA2B,EAAE,4BAKzC,CAAA;AAOD,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,CAAA;IACzC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAAA;CAC9C,CAAA;wBAEkC,yBAAyB;AAA5D,wBAA4D;AAC5D,YAAY,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,CAAA;AAMtE,UAAU,yBAAyB;IACjC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,yBAAyB,qBAS3E;yBATe,oBAAoB;;;AAiBpC,QAAA,MAAM,oCAAoC;;;CAGhC,CAAA;AAEV,KAAK,qCAAqC,GACxC,CAAC,OAAO,oCAAoC,CAAC,CAAC,MAAM,OAAO,oCAAoC,CAAC,CAAA;AAElG,UAAU,2BAA2B;IACnC,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,qCAAqC,CAAA;CACnD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actions_form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/actions_form_sheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EAAqB,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,8CAA8C,EAAE,MAAM,kCAAkC,CAAA;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,IAAI,EAAc,IAAI,EAAE,MAAM,YAAY,CAAA;AAEnD,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC,MAAM,CAAC,MAAM,2BAA2B,GAAiC;IACvE,YAAY,EAAE,WAAW;IACzB,WAAW,EAAE,KAAK;IAClB,mBA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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 { AccessibilityRole, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport { PLATFORM_SHEET_ALLOWED_DETENTS_FIT_TO_CONTENTS } from '../../utils/navigation_constants'\nimport { PlatformPressable } from '@react-navigation/elements'\nimport { Icon, IconString, Text } from '../display'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\nexport const BaseActionsFormSheetOptions: NativeStackNavigationOptions = {\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents: PLATFORM_SHEET_ALLOWED_DETENTS_FIT_TO_CONTENTS,\n sheetCornerRadius: 16,\n}\n\nconst ActionsFormSheet = {\n Root: ActionsFormSheetRoot,\n Action: ActionsFormSheetAction,\n} as const\n\ntype ActionFormSheetComponents = {\n Root: React.FC<ActionsFormSheetRootProps>\n Action: React.FC<ActionsFormSheetActionProps>\n}\n\nexport default ActionsFormSheet as ActionFormSheetComponents\nexport type { ActionsFormSheetRootProps, ActionsFormSheetActionProps }\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface ActionsFormSheetRootProps {\n children: ReactNode\n}\n\nexport function ActionsFormSheetRoot({ children }: ActionsFormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={styles.container}>\n <View style={styles.gestureBar} />\n <View style={styles.actions}>{children}</View>\n </View>\n )\n}\n\nActionsFormSheetRoot.displayName = 'ActionsFormSheet.Root'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst ACTION_FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype ActionsFormSheetActionAppearanceUnion =\n (typeof ACTION_FORM_SHEET_ACTION_APPEARANCES)[keyof typeof ACTION_FORM_SHEET_ACTION_APPEARANCES]\n\ninterface ActionsFormSheetActionProps {\n title: string\n iconName: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: ActionsFormSheetActionAppearanceUnion\n}\n\nfunction ActionsFormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n}: ActionsFormSheetActionProps) {\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 >\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n <Text style={styles.actionTitle}>{title}</Text>\n </PlatformPressable>\n )\n}\n\nActionsFormSheetAction.displayName = 'ActionsFormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: ActionsFormSheetActionAppearanceUnion\n}\n\nconst useStyles = ({ appearance = 'neutral' }: Styles = {}) => {\n const { colors } = useTheme()\n const { bottom } = useSafeAreaInsets()\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 paddingTop: 12,\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n },\n gestureBar: {\n width: 32,\n height: 4,\n backgroundColor: colors.fillColorNeutral050Base,\n borderRadius: 100,\n alignSelf: 'center',\n },\n actions: {\n paddingTop: 20,\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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"navigation_constants.d.ts","sourceRoot":"","sources":["../../src/utils/navigation_constants.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,8CAA8C,iBAIhD,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Platform } from 'react-native';
|
|
2
|
-
/*
|
|
3
|
-
* Android doesn't support "fitToContents" yet, so we need to manually set the detents.
|
|
4
|
-
* This tries to mimic iOS by setting a small detent of 25%, but allowing the user to "grow" the sheet to a full screen detent of 100% as an escape hatch if there is a lot of content.
|
|
5
|
-
*/
|
|
6
|
-
export const PLATFORM_SHEET_ALLOWED_DETENTS_FIT_TO_CONTENTS = Platform.select({
|
|
7
|
-
ios: 'fitToContents',
|
|
8
|
-
// @ts-expect-error TS was seeing this as "fitToContents", even though it is valid to pass number[] to NativeStackNavigationOptions['sheetAllowedDetents']
|
|
9
|
-
android: [0.25, 1],
|
|
10
|
-
});
|
|
11
|
-
//# sourceMappingURL=navigation_constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"navigation_constants.js","sourceRoot":"","sources":["../../src/utils/navigation_constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC;;;GAGG;AAEH,MAAM,CAAC,MAAM,8CAA8C,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC5E,GAAG,EAAE,eAAe;IACpB,0JAA0J;IAC1J,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;CACV,CAAC,CAAA","sourcesContent":["import { Platform } from 'react-native'\n\n/*\n * Android doesn't support \"fitToContents\" yet, so we need to manually set the detents.\n * This tries to mimic iOS by setting a small detent of 25%, but allowing the user to \"grow\" the sheet to a full screen detent of 100% as an escape hatch if there is a lot of content.\n */\n\nexport const PLATFORM_SHEET_ALLOWED_DETENTS_FIT_TO_CONTENTS = Platform.select({\n ios: 'fitToContents',\n // @ts-expect-error TS was seeing this as \"fitToContents\", even though it is valid to pass number[] to NativeStackNavigationOptions['sheetAllowedDetents']\n android: [0.25, 1],\n} as const)\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Platform } from 'react-native'
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Android doesn't support "fitToContents" yet, so we need to manually set the detents.
|
|
5
|
-
* This tries to mimic iOS by setting a small detent of 25%, but allowing the user to "grow" the sheet to a full screen detent of 100% as an escape hatch if there is a lot of content.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export const PLATFORM_SHEET_ALLOWED_DETENTS_FIT_TO_CONTENTS = Platform.select({
|
|
9
|
-
ios: 'fitToContents',
|
|
10
|
-
// @ts-expect-error TS was seeing this as "fitToContents", even though it is valid to pass number[] to NativeStackNavigationOptions['sheetAllowedDetents']
|
|
11
|
-
android: [0.25, 1],
|
|
12
|
-
} as const)
|