@planningcenter/chat-react-native 3.7.0-rc.6 → 3.7.0-rc.8
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/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js +6 -2
- package/build/components/conversations/conversation_actions.js.map +1 -1
- 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/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/conversations/conversation_actions.tsx +10 -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/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,75 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { useHeaderHeight } from '@react-navigation/elements';
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
|
+
import { Platform, StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
3
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
5
|
import { Avatar, Heading, Text } from '../../components';
|
|
5
6
|
import { useTheme } from '../../hooks';
|
|
6
|
-
import { useNavigation } from '@react-navigation/native';
|
|
7
7
|
import { useReadReceipts } from '../../hooks/use_read_receipts';
|
|
8
|
-
import {
|
|
9
|
-
import { useHeaderHeight } from '@react-navigation/elements';
|
|
10
|
-
const SCREEN_HEIGHT_RATIO_QUARTER = 0.25; // 25% of the screen height
|
|
11
|
-
const SCREEN_HEIGHT_RATIO_HALF = 0.5; // 50% of the screen height
|
|
12
|
-
const SCREEN_HEIGHT_RATIO_FULL = 1; // 100% of the screen height
|
|
8
|
+
import { FlatList } from 'react-native-gesture-handler';
|
|
13
9
|
export const MessageReadReceiptsScreenOptions = {
|
|
14
|
-
presentation:
|
|
10
|
+
presentation: 'formSheet',
|
|
15
11
|
sheetAllowedDetents: Platform.select({
|
|
16
|
-
|
|
17
|
-
default:
|
|
12
|
+
android: [0.25, 0.94], // Going straight to full 0.94 preserves height of screen on Android
|
|
13
|
+
default: [0.25, 0.5, 1],
|
|
18
14
|
}),
|
|
19
15
|
sheetGrabberVisible: true,
|
|
20
|
-
headerShown:
|
|
16
|
+
headerShown: false,
|
|
21
17
|
sheetCornerRadius: 16,
|
|
18
|
+
headerTitle: 'Read receipts',
|
|
22
19
|
};
|
|
23
20
|
export function MessageReadReceiptsScreen({ route }) {
|
|
24
21
|
const styles = useStyles();
|
|
25
|
-
const navigation = useNavigation();
|
|
26
22
|
const { conversation_id, message_id } = route.params;
|
|
27
23
|
const { data: receipts, totalCount, fetchNextPage, } = useReadReceipts({ conversation_id, message_id });
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return (<View style={styles.container}>
|
|
34
|
-
<FlashList data={receipts} contentContainerStyle={styles.contentContainer} keyExtractor={item => item.id.toString()} estimatedItemSize={24} renderItem={({ item }) => (<View style={styles.receiptRow}>
|
|
35
|
-
<Avatar sourceUri={item.avatar} size="sm"/>
|
|
36
|
-
<Text variant="tertiary" numberOfLines={2} style={styles.name}>
|
|
37
|
-
{item.name}
|
|
38
|
-
</Text>
|
|
39
|
-
</View>)} ListHeaderComponent={() => PlatformListHeader({ totalCount })} ListFooterComponent={<View style={styles.footer}/>} ListEmptyComponent={<Text style={styles.emptyText}>No one has read this message yet.</Text>} onEndReached={fetchNextPage} onEndReachedThreshold={0.2}/>
|
|
24
|
+
return (<View style={styles.container} collapsable={false}>
|
|
25
|
+
<Heading variant="h3" style={styles.header}>
|
|
26
|
+
Read receipts ({totalCount})
|
|
27
|
+
</Heading>
|
|
28
|
+
<FlatList data={receipts} style={styles.contentContainer} keyExtractor={item => item.id.toString()} renderItem={({ item }) => <Receipt receipt={item}/>} nestedScrollEnabled ListFooterComponent={<View style={styles.footer}/>} ListEmptyComponent={<Text style={styles.emptyText}>No one has read this message yet.</Text>} onEndReached={() => fetchNextPage()} onEndReachedThreshold={0.2}/>
|
|
40
29
|
</View>);
|
|
41
30
|
}
|
|
42
|
-
|
|
31
|
+
const Receipt = memo(({ receipt }) => {
|
|
43
32
|
const styles = useStyles();
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
33
|
+
return (<View style={styles.receiptRow}>
|
|
34
|
+
<Avatar sourceUri={receipt.avatar} size="sm"/>
|
|
35
|
+
<Text variant="tertiary" numberOfLines={2} style={styles.name}>
|
|
36
|
+
{receipt.name}
|
|
37
|
+
</Text>
|
|
38
|
+
</View>);
|
|
39
|
+
});
|
|
51
40
|
const useStyles = () => {
|
|
52
41
|
const theme = useTheme();
|
|
53
42
|
const { height } = useWindowDimensions();
|
|
54
43
|
const { bottom, top } = useSafeAreaInsets();
|
|
55
44
|
const headerHeight = useHeaderHeight();
|
|
56
45
|
const containerHeight = Platform.select({
|
|
57
|
-
android:
|
|
46
|
+
android: null,
|
|
58
47
|
ios: height - top - headerHeight,
|
|
59
48
|
});
|
|
60
49
|
return StyleSheet.create({
|
|
61
50
|
container: {
|
|
62
|
-
|
|
51
|
+
paddingTop: 16,
|
|
63
52
|
backgroundColor: theme.colors.fillColorNeutral100Inverted,
|
|
64
53
|
height: containerHeight,
|
|
65
54
|
flex: 1,
|
|
66
55
|
},
|
|
67
56
|
contentContainer: {
|
|
68
|
-
|
|
57
|
+
paddingHorizontal: 16,
|
|
69
58
|
},
|
|
70
59
|
header: {
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
paddingHorizontal: 16,
|
|
61
|
+
paddingBottom: 8,
|
|
73
62
|
},
|
|
74
63
|
receiptRow: {
|
|
75
64
|
flexDirection: 'row',
|
|
@@ -82,7 +71,7 @@ const useStyles = () => {
|
|
|
82
71
|
flex: 1,
|
|
83
72
|
},
|
|
84
73
|
footer: {
|
|
85
|
-
height: bottom +
|
|
74
|
+
height: bottom + 16,
|
|
86
75
|
},
|
|
87
76
|
emptyText: {
|
|
88
77
|
textAlign: 'center',
|
|
@@ -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,KAAK,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"message_read_receipts_screen.js","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;YACnB,KAAK,EAAE,MAAM;YACb,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 { useHeaderHeight } from '@react-navigation/elements'\nimport { StaticScreenProps } from '@react-navigation/native'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { memo } from 'react'\nimport { Platform, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Avatar, Heading, Text } from '../../components'\nimport { useTheme } from '../../hooks'\nimport { useReadReceipts } from '../../hooks/use_read_receipts'\nimport { FlatList } from 'react-native-gesture-handler'\nimport { ReadReceiptResource } from '../../types/resources/read_receipt'\n\nexport const MessageReadReceiptsScreenOptions: NativeStackNavigationOptions = {\n presentation: 'formSheet',\n sheetAllowedDetents: Platform.select({\n android: [0.25, 0.94], // Going straight to full 0.94 preserves height of screen on Android\n default: [0.25, 0.5, 1],\n }),\n sheetGrabberVisible: true,\n headerShown: false,\n sheetCornerRadius: 16,\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\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 <View style={styles.container} collapsable={false}>\n <Heading variant=\"h3\" style={styles.header}>\n Read receipts ({totalCount})\n </Heading>\n <FlatList\n data={receipts}\n style={styles.contentContainer}\n keyExtractor={item => item.id.toString()}\n renderItem={({ item }) => <Receipt receipt={item} />}\n nestedScrollEnabled\n ListFooterComponent={<View style={styles.footer} />}\n ListEmptyComponent={<Text style={styles.emptyText}>No one has read this message yet.</Text>}\n onEndReached={() => fetchNextPage()}\n onEndReachedThreshold={0.2}\n />\n </View>\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 theme = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n android: null,\n ios: height - top - headerHeight,\n })\n\n return StyleSheet.create({\n container: {\n paddingTop: 16,\n backgroundColor: theme.colors.fillColorNeutral100Inverted,\n height: containerHeight,\n flex: 1,\n },\n contentContainer: {\n paddingHorizontal: 16,\n },\n header: {\n paddingHorizontal: 16,\n paddingBottom: 8,\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 footer: {\n height: bottom + 16,\n },\n emptyText: {\n textAlign: 'center',\n color: '#888',\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_filters_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_filters_screen.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,4BAA4B,EAC7B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,OAAO,EACL,8BAA8B,EAE/B,MAAM,qCAAqC,CAAA;AA8B5C,eAAO,MAAM,gCAAgC,EAAE,
|
|
1
|
+
{"version":3,"file":"conversation_filters_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_filters_screen.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,4BAA4B,EAC7B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,OAAO,EACL,8BAA8B,EAE/B,MAAM,qCAAqC,CAAA;AA8B5C,eAAO,MAAM,gCAAgC,EAAE,4BAS9C,CAAA;AAoCD,eAAO,MAAM,yBAAyB,WAAY,8BAA8B,sBAU/E,CAAA"}
|
|
@@ -30,10 +30,7 @@ const HeaderRightWithContext = () => {
|
|
|
30
30
|
};
|
|
31
31
|
export const ConversationFiltersScreenOptions = {
|
|
32
32
|
presentation: Platform.select({ android: 'modal', ios: 'formSheet' }),
|
|
33
|
-
sheetAllowedDetents:
|
|
34
|
-
android: [0.75, 0.94],
|
|
35
|
-
default: [0.75, 1],
|
|
36
|
-
}),
|
|
33
|
+
sheetAllowedDetents: [0.75, 1],
|
|
37
34
|
sheetGrabberVisible: true,
|
|
38
35
|
headerBackVisible: false,
|
|
39
36
|
headerRight: HeaderRightWithContext,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_filters_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_filters_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC3F,OAAO,EAAE,kCAAkC,EAAa,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAClG,OAAO,EACL,0BAA0B,GAE3B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EACL,aAAa,EACb,cAAc,GACf,MAAM,4DAA4D,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAA;A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,eAAe;YACvB,IAAI,EAAE,CAAC;SACR;QACD,WAAW,EAAE;YACX,SAAS,EAAE,MAAM;YACjB,IAAI,EAAE,CAAC;SACR;QACD,SAAS,EAAE;YACT,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,2BAA2B;YACzD,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;YAC/B,UAAU,EAAE,QAAQ;YACpB,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,EAAE;YACnB,GAAG,EAAE,CAAC;SACP;QACD,eAAe,EAAE;YACf,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,gCAAgC;SAC5C;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,WAAW,EAAE;YACX,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,UAAU,EAAE,QAAQ;SACrB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { HeaderTitle, HeaderTitleProps, useHeaderHeight } from '@react-navigation/elements'\nimport { createComponentForStaticNavigation, RouteProp, useRoute } from '@react-navigation/native'\nimport {\n createNativeStackNavigator,\n NativeStackNavigationOptions,\n} from '@react-navigation/native-stack'\nimport React from 'react'\nimport { Platform, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Button, TextButton } from '../components'\nimport {\n FilterContext,\n FilterProvider,\n} from './conversation_filters/context/conversation_filter_context'\nimport { ConversationFilters } from './conversation_filters/components/conversation_filters'\nimport { GroupFilters } from './conversation_filters/group_filters'\nimport {\n ConversationFiltersScreenProps,\n ConversationFilterStackParamList,\n} from './conversation_filters/screen_props'\nimport { useTheme } from '../hooks'\nimport { TeamFilters } from './conversation_filters/team_filters'\n\nconst FilterHeaderTitle = ({ tintColor }: HeaderTitleProps) => {\n const styles = useStyles()\n return <HeaderTitle style={[styles.headerTitle, { color: tintColor }]}>Filters</HeaderTitle>\n}\n\nconst HeaderRight = () => {\n const { resetFilter, applyFilters } = React.useContext(FilterContext)\n const route = useRoute<RouteProp<ConversationFiltersScreenProps['route']>>()\n const styles = useStyles()\n\n return (\n <View style={styles.headerRight}>\n <TextButton onPress={resetFilter}>Reset</TextButton>\n <Button title=\"Apply\" onPress={() => applyFilters(route.params)} />\n </View>\n )\n}\n\nconst HeaderRightWithContext = () => {\n return (\n <FilterProvider>\n <HeaderRight />\n </FilterProvider>\n )\n}\n\nexport const ConversationFiltersScreenOptions: NativeStackNavigationOptions = {\n presentation: Platform.select({ android: 'modal', ios: 'formSheet' }),\n sheetAllowedDetents: [0.75, 1],\n sheetGrabberVisible: true,\n headerBackVisible: false,\n headerRight: HeaderRightWithContext,\n headerTitle: FilterHeaderTitle,\n headerTitleAlign: 'left',\n sheetCornerRadius: 16,\n}\n\nconst FilterNavigator = createNativeStackNavigator<ConversationFilterStackParamList>({\n initialRouteName: 'Filters',\n screens: {\n Filters: {\n screen: ConversationFilters,\n options: {\n headerShown: false,\n },\n },\n GroupFilters: {\n screen: GroupFilters,\n options: {\n headerTitle: Platform.select({\n android: 'Groups',\n ios: '',\n }),\n headerBackTitle: 'Groups',\n },\n },\n TeamFilters: {\n screen: TeamFilters,\n options: {\n headerTitle: Platform.select({\n android: 'Teams',\n ios: '',\n }),\n headerBackTitle: 'Teams',\n },\n },\n },\n})\n\nconst Filters = createComponentForStaticNavigation(FilterNavigator, 'Filters')\n\nexport const ConversationFiltersScreen = (_props: ConversationFiltersScreenProps) => {\n const styles = useStyles()\n\n return (\n <FilterProvider>\n <View style={styles.container}>\n <Filters />\n </View>\n </FilterProvider>\n )\n}\n\nconst useStyles = () => {\n const { top } = useSafeAreaInsets()\n const { height } = useWindowDimensions()\n const headerHeight = useHeaderHeight()\n const theme = useTheme()\n\n const containerHeight = Platform.select({\n android: height,\n ios: height - top - headerHeight,\n })\n\n return StyleSheet.create({\n container: {\n height: containerHeight,\n flex: 1,\n },\n headerTitle: {\n textAlign: 'left',\n flex: 1,\n },\n filterBar: {\n backgroundColor: theme.colors.fillColorNeutral100Inverted,\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n paddingHorizontal: 16,\n paddingVertical: 16,\n gap: 8,\n },\n filterBarScroll: {\n elevation: 4,\n boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.1)',\n },\n filterBarActions: {\n flexDirection: 'row',\n gap: 8,\n alignItems: 'center',\n },\n headerRight: {\n flexDirection: 'row',\n gap: 8,\n alignItems: 'center',\n },\n })\n}\n"]}
|
package/build/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,mCAAmC,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,mCAAmC,CAAA"}
|
package/build/utils/index.js
CHANGED
package/build/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,mCAAmC,CAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,mCAAmC,CAAA","sourcesContent":["export * from './session'\nexport * from './theme'\nexport * from './styles'\nexport * from './space'\nexport * from './client'\nexport * from './uri'\nexport * from './cache'\nexport * from './native_adapters'\nexport * from './pluralize'\nexport * from './destructure_chat_group_graph_id'\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.7.0-rc.
|
|
3
|
+
"version": "3.7.0-rc.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"prettier": "^3.4.2",
|
|
56
56
|
"typescript": "<5.6.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "7e6a66b01f150561ea8c8d195c6bc7e3badd2df1"
|
|
59
59
|
}
|
|
@@ -4,12 +4,13 @@ import ReanimatedSwipeable, {
|
|
|
4
4
|
SwipeableMethods,
|
|
5
5
|
} from 'react-native-gesture-handler/ReanimatedSwipeable'
|
|
6
6
|
import { useConversationsContext } from '../../contexts/conversations_context'
|
|
7
|
-
import { useTheme } from '../../hooks'
|
|
7
|
+
import { useTheme, useCreateAndroidRippleColor } from '../../hooks'
|
|
8
8
|
import {
|
|
9
9
|
useConversationsMarkRead,
|
|
10
10
|
useConversationsMute,
|
|
11
11
|
} from '../../hooks/use_conversations_actions'
|
|
12
12
|
import { ConversationResource } from '../../types'
|
|
13
|
+
import { platformPressedOpacityStyle } from '../../utils'
|
|
13
14
|
import { tokens } from '../../vendor/tapestry/tokens'
|
|
14
15
|
import { ActionToggleButton } from './action_toggle_button'
|
|
15
16
|
|
|
@@ -29,6 +30,9 @@ export function ConversationActions({
|
|
|
29
30
|
const { activeConversationId, setActiveConversationId } = useConversationsContext()
|
|
30
31
|
const [disabled, setDisabled] = useState(false)
|
|
31
32
|
const overshootLeft = Platform.OS === 'ios'
|
|
33
|
+
const androidRippleColor = useCreateAndroidRippleColor({
|
|
34
|
+
color: styles.swipeableChildContainer.backgroundColor,
|
|
35
|
+
})
|
|
32
36
|
|
|
33
37
|
const handleSwipeableClose = () => {
|
|
34
38
|
setDisabled(false)
|
|
@@ -66,7 +70,11 @@ export function ConversationActions({
|
|
|
66
70
|
<LeftActions conversation={conversation} onClose={handleSwipeableClose} />
|
|
67
71
|
)}
|
|
68
72
|
>
|
|
69
|
-
<Pressable
|
|
73
|
+
<Pressable
|
|
74
|
+
onPress={handlePress}
|
|
75
|
+
style={({ pressed }) => [style, pressed && platformPressedOpacityStyle]}
|
|
76
|
+
android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}
|
|
77
|
+
>
|
|
70
78
|
{children}
|
|
71
79
|
</Pressable>
|
|
72
80
|
</ReanimatedSwipeable>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { NativeStackNavigationOptions } from '@react-navigation/native-stack'
|
|
2
2
|
import React, { ReactNode } from 'react'
|
|
3
|
-
import { AccessibilityRole, StyleSheet, View } from 'react-native'
|
|
3
|
+
import { AccessibilityRole, Platform, StyleSheet, View } from 'react-native'
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
5
5
|
import { useTheme } from '../../hooks'
|
|
6
|
-
import { PLATFORM_SHEET_ALLOWED_DETENTS_FIT_TO_CONTENTS } from '../../utils/navigation_constants'
|
|
7
6
|
import { PlatformPressable } from '@react-navigation/elements'
|
|
8
7
|
import { Icon, IconString, Text } from '../display'
|
|
9
8
|
|
|
@@ -11,70 +10,97 @@ import { Icon, IconString, Text } from '../display'
|
|
|
11
10
|
// ====== Exports ==================
|
|
12
11
|
// =================================
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Screen options for the formsheet's NativeStackNavigation route
|
|
15
|
+
* @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.
|
|
16
|
+
* @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.
|
|
17
|
+
* @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions
|
|
18
|
+
* @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions
|
|
19
|
+
*/
|
|
20
|
+
export const getFormSheetScreenOptions = ({
|
|
21
|
+
headerTitle,
|
|
22
|
+
sheetAllowedDetents = [0.25],
|
|
23
|
+
...rest
|
|
24
|
+
}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({
|
|
15
25
|
presentation: 'formSheet',
|
|
16
26
|
headerShown: false,
|
|
17
|
-
sheetAllowedDetents
|
|
27
|
+
sheetAllowedDetents,
|
|
18
28
|
sheetCornerRadius: 16,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
sheetGrabberVisible: true,
|
|
30
|
+
headerTitle,
|
|
31
|
+
...rest,
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const FormSheet = {
|
|
35
|
+
Root: FormSheetRoot,
|
|
36
|
+
Action: FormSheetAction,
|
|
24
37
|
} as const
|
|
25
38
|
|
|
26
|
-
type
|
|
27
|
-
Root: React.FC<
|
|
28
|
-
Action: React.FC<
|
|
39
|
+
type FormSheetComponents = {
|
|
40
|
+
Root: React.FC<FormSheetRootProps>
|
|
41
|
+
Action: React.FC<FormSheetActionProps>
|
|
29
42
|
}
|
|
30
43
|
|
|
31
|
-
export default
|
|
32
|
-
export type {
|
|
44
|
+
export default FormSheet as FormSheetComponents
|
|
45
|
+
export type { FormSheetRootProps, FormSheetActionProps }
|
|
33
46
|
|
|
34
47
|
// ====================================
|
|
35
48
|
// ====== ActionsFormSheetRoot ========
|
|
36
49
|
// ====================================
|
|
37
50
|
|
|
38
|
-
interface
|
|
51
|
+
interface FormSheetRootProps {
|
|
39
52
|
children: ReactNode
|
|
40
53
|
}
|
|
41
54
|
|
|
42
|
-
export function
|
|
55
|
+
export function FormSheetRoot({ children }: FormSheetRootProps) {
|
|
43
56
|
const styles = useStyles()
|
|
44
57
|
|
|
45
58
|
return (
|
|
46
59
|
<View style={styles.container}>
|
|
47
|
-
<
|
|
48
|
-
<View style={styles.
|
|
60
|
+
<AndroidSheetGrabber />
|
|
61
|
+
<View style={styles.content}>{children}</View>
|
|
49
62
|
</View>
|
|
50
63
|
)
|
|
51
64
|
}
|
|
52
65
|
|
|
53
|
-
|
|
66
|
+
FormSheetRoot.displayName = 'FormSheet.Root'
|
|
67
|
+
|
|
68
|
+
// ====================================
|
|
69
|
+
// ====== AndroidSheetGrabber =========
|
|
70
|
+
// ====================================
|
|
71
|
+
|
|
72
|
+
function AndroidSheetGrabber() {
|
|
73
|
+
const styles = useStyles()
|
|
74
|
+
|
|
75
|
+
return Platform.select({
|
|
76
|
+
android: <View style={styles.androidSheetGrabber} />,
|
|
77
|
+
ios: null,
|
|
78
|
+
})
|
|
79
|
+
}
|
|
54
80
|
|
|
55
81
|
// ====================================
|
|
56
82
|
// ====== ActionsFormSheetAction ======
|
|
57
83
|
// ====================================
|
|
58
84
|
|
|
59
|
-
const
|
|
85
|
+
const FORM_SHEET_ACTION_APPEARANCES = {
|
|
60
86
|
neutral: 'neutral',
|
|
61
87
|
danger: 'danger',
|
|
62
88
|
} as const
|
|
63
89
|
|
|
64
|
-
type
|
|
65
|
-
(typeof
|
|
90
|
+
type FormSheetActionAppearanceUnion =
|
|
91
|
+
(typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]
|
|
66
92
|
|
|
67
|
-
interface
|
|
93
|
+
interface FormSheetActionProps {
|
|
68
94
|
title: string
|
|
69
95
|
iconName: IconString
|
|
70
96
|
onPress: () => void
|
|
71
97
|
accessibilityLabel?: string
|
|
72
98
|
accessibilityHint?: string
|
|
73
99
|
accessibilityRole?: AccessibilityRole
|
|
74
|
-
appearance?:
|
|
100
|
+
appearance?: FormSheetActionAppearanceUnion
|
|
75
101
|
}
|
|
76
102
|
|
|
77
|
-
function
|
|
103
|
+
function FormSheetAction({
|
|
78
104
|
title,
|
|
79
105
|
iconName,
|
|
80
106
|
onPress,
|
|
@@ -82,7 +108,7 @@ function ActionsFormSheetAction({
|
|
|
82
108
|
accessibilityHint,
|
|
83
109
|
accessibilityRole = 'button',
|
|
84
110
|
appearance = 'neutral',
|
|
85
|
-
}:
|
|
111
|
+
}: FormSheetActionProps) {
|
|
86
112
|
const styles = useStyles({ appearance })
|
|
87
113
|
|
|
88
114
|
return (
|
|
@@ -99,14 +125,14 @@ function ActionsFormSheetAction({
|
|
|
99
125
|
)
|
|
100
126
|
}
|
|
101
127
|
|
|
102
|
-
|
|
128
|
+
FormSheetAction.displayName = 'FormSheet.Action'
|
|
103
129
|
|
|
104
130
|
// ==================================
|
|
105
131
|
// ====== Styles ====================
|
|
106
132
|
// ==================================
|
|
107
133
|
|
|
108
134
|
interface Styles {
|
|
109
|
-
appearance?:
|
|
135
|
+
appearance?: FormSheetActionAppearanceUnion
|
|
110
136
|
}
|
|
111
137
|
|
|
112
138
|
const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
|
|
@@ -128,20 +154,20 @@ const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
|
|
|
128
154
|
container: {
|
|
129
155
|
flex: 1,
|
|
130
156
|
justifyContent: 'flex-start',
|
|
131
|
-
paddingTop: 12,
|
|
132
157
|
paddingBottom: bottom,
|
|
133
158
|
width: '100%',
|
|
134
159
|
backgroundColor: colors.fillColorNeutral100Inverted,
|
|
135
160
|
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
161
|
+
androidSheetGrabber: {
|
|
162
|
+
marginTop: 5,
|
|
163
|
+
width: 34,
|
|
164
|
+
height: 5,
|
|
165
|
+
backgroundColor: colors.fillColorNeutral040,
|
|
140
166
|
borderRadius: 100,
|
|
141
167
|
alignSelf: 'center',
|
|
142
168
|
},
|
|
143
|
-
|
|
144
|
-
paddingTop: 20,
|
|
169
|
+
content: {
|
|
170
|
+
paddingTop: Platform.select({ android: 16, ios: 20 }),
|
|
145
171
|
},
|
|
146
172
|
actionPressable: {
|
|
147
173
|
flexDirection: 'row',
|
package/src/navigation/index.tsx
CHANGED
|
@@ -219,10 +219,7 @@ export const ChatStack = createNativeStackNavigator({
|
|
|
219
219
|
},
|
|
220
220
|
MessageReadReceipts: {
|
|
221
221
|
screen: MessageReadReceiptsScreen,
|
|
222
|
-
options:
|
|
223
|
-
...MessageReadReceiptsScreenOptions,
|
|
224
|
-
headerTitle: 'Read receipts',
|
|
225
|
-
},
|
|
222
|
+
options: MessageReadReceiptsScreenOptions,
|
|
226
223
|
},
|
|
227
224
|
BugReport: {
|
|
228
225
|
screen: BugReportScreen,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { Linking } from 'react-native'
|
|
4
|
-
import
|
|
5
|
-
BaseActionsFormSheetOptions,
|
|
6
|
-
} from '../../components/primitive/actions_form_sheet'
|
|
4
|
+
import FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet'
|
|
7
5
|
import { useDeleteAttachment } from './hooks/useDeleteAttachment'
|
|
8
6
|
|
|
9
|
-
export const AttachmentActionsScreenOptions =
|
|
7
|
+
export const AttachmentActionsScreenOptions = getFormSheetScreenOptions({
|
|
8
|
+
headerTitle: 'Attachment actions',
|
|
9
|
+
})
|
|
10
10
|
|
|
11
11
|
export type AttachmentActionsScreenProps = StaticScreenProps<{
|
|
12
12
|
attachmentId: string
|
|
@@ -43,8 +43,8 @@ export function AttachmentActionsScreen({ route }: AttachmentActionsScreenProps)
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
|
-
<
|
|
47
|
-
<
|
|
46
|
+
<FormSheet.Root>
|
|
47
|
+
<FormSheet.Action
|
|
48
48
|
iconName="general.newWindow"
|
|
49
49
|
title="Open in browser"
|
|
50
50
|
accessibilityRole="link"
|
|
@@ -53,14 +53,14 @@ export function AttachmentActionsScreen({ route }: AttachmentActionsScreenProps)
|
|
|
53
53
|
onPress={handleOpenInBrowser}
|
|
54
54
|
/>
|
|
55
55
|
{canDelete && (
|
|
56
|
-
<
|
|
56
|
+
<FormSheet.Action
|
|
57
57
|
appearance="danger"
|
|
58
58
|
iconName="publishing.trash"
|
|
59
59
|
title={`Delete ${attachmentName}`}
|
|
60
60
|
onPress={handleDeleteAttachment}
|
|
61
61
|
/>
|
|
62
62
|
)}
|
|
63
|
-
</
|
|
63
|
+
</FormSheet.Root>
|
|
64
64
|
)
|
|
65
65
|
}
|
|
66
66
|
|