@planningcenter/chat-react-native 3.14.0 → 3.15.0-rc.1
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_preview.d.ts.map +1 -1
- package/build/components/conversations/conversation_preview.js +26 -16
- package/build/components/conversations/conversation_preview.js.map +1 -1
- package/build/components/conversations/mute_indicator.d.ts.map +1 -1
- package/build/components/conversations/mute_indicator.js +3 -1
- package/build/components/conversations/mute_indicator.js.map +1 -1
- package/build/components/conversations/swipeable_toggle_button.d.ts.map +1 -1
- package/build/components/conversations/swipeable_toggle_button.js +6 -3
- package/build/components/conversations/swipeable_toggle_button.js.map +1 -1
- package/build/components/conversations/unread_count_badge.js +9 -6
- package/build/components/conversations/unread_count_badge.js.map +1 -1
- package/build/components/display/action_button.d.ts.map +1 -1
- package/build/components/display/action_button.js +2 -2
- package/build/components/display/action_button.js.map +1 -1
- package/build/components/display/badge.d.ts +5 -1
- package/build/components/display/badge.d.ts.map +1 -1
- package/build/components/display/badge.js +2 -2
- package/build/components/display/badge.js.map +1 -1
- package/build/components/display/toggle_button.d.ts +3 -1
- package/build/components/display/toggle_button.d.ts.map +1 -1
- package/build/components/display/toggle_button.js +1 -1
- package/build/components/display/toggle_button.js.map +1 -1
- package/build/hooks/index.d.ts +2 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use_at_font_scale_breakpoint.d.ts +2 -0
- package/build/hooks/use_at_font_scale_breakpoint.d.ts.map +1 -0
- package/build/hooks/use_at_font_scale_breakpoint.js +9 -0
- package/build/hooks/use_at_font_scale_breakpoint.js.map +1 -0
- package/build/hooks/use_scalable_number_of_lines.d.ts +2 -0
- package/build/hooks/use_scalable_number_of_lines.d.ts.map +1 -0
- package/build/hooks/use_scalable_number_of_lines.js +9 -0
- package/build/hooks/use_scalable_number_of_lines.js.map +1 -0
- package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +9 -3
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations/conversations_screen.js +1 -1
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/utils/styles.d.ts +1 -1
- package/build/utils/styles.js +1 -1
- package/build/utils/styles.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversations/conversation_preview.tsx +33 -14
- package/src/components/conversations/mute_indicator.tsx +9 -1
- package/src/components/conversations/swipeable_toggle_button.tsx +18 -3
- package/src/components/conversations/unread_count_badge.tsx +9 -6
- package/src/components/display/action_button.tsx +3 -1
- package/src/components/display/badge.tsx +6 -1
- package/src/components/display/toggle_button.tsx +12 -1
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use_at_font_scale_breakpoint.ts +11 -0
- package/src/hooks/use_scalable_number_of_lines.ts +10 -0
- package/src/screens/conversations/components/list_header_component.tsx +11 -2
- package/src/screens/conversations/conversations_screen.tsx +2 -0
- package/src/utils/styles.ts +1 -1
|
@@ -17,11 +17,20 @@ import { Icon, IconString } from './icon'
|
|
|
17
17
|
import { tokens } from '../../vendor/tapestry/tokens'
|
|
18
18
|
import { Haptic } from '../../utils/native_adapters/configuration'
|
|
19
19
|
|
|
20
|
+
// =================================
|
|
21
|
+
// ====== Constants ================
|
|
22
|
+
// =================================
|
|
23
|
+
|
|
24
|
+
// We are omitting `onLongPress` because we are instead supporting `accessibilityShowsLargeContentViewer`.
|
|
25
|
+
// This is triggered by an `onLongPress` event when an iOS device is in Apple's accessible font scale range.
|
|
26
|
+
// Triggering this prop will display an almost full screen iOS a11y button.
|
|
27
|
+
type RestrictedPressableProps = Omit<PressableProps, 'onLongPress'>
|
|
28
|
+
|
|
20
29
|
// =================================
|
|
21
30
|
// ====== Component ================
|
|
22
31
|
// =================================
|
|
23
32
|
|
|
24
|
-
export interface ToggleButtonProps extends
|
|
33
|
+
export interface ToggleButtonProps extends RestrictedPressableProps {
|
|
25
34
|
/**
|
|
26
35
|
* Pressable container styles
|
|
27
36
|
*/
|
|
@@ -102,6 +111,8 @@ export function ToggleButton({
|
|
|
102
111
|
accessibilityState={{ checked: active }}
|
|
103
112
|
android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}
|
|
104
113
|
onPress={handlePress}
|
|
114
|
+
accessibilityShowsLargeContentViewer
|
|
115
|
+
accessibilityLargeContentTitle={title}
|
|
105
116
|
{...props}
|
|
106
117
|
>
|
|
107
118
|
{iconNameLeft && (
|
package/src/hooks/index.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useFontScale } from './use_font_scale'
|
|
2
|
+
|
|
3
|
+
// Based on iOS's AX1 font scale https://developer.apple.com/design/human-interface-guidelines/typography#iOS-iPadOS-larger-accessibility-type-sizes
|
|
4
|
+
const FONT_SCALE_BREAKPOINT_FALLBACK = 1.78
|
|
5
|
+
|
|
6
|
+
export const useAtFontScaleBreakpoint = (scaleBreakpoint?: number) => {
|
|
7
|
+
const fontScale = useFontScale()
|
|
8
|
+
const breakpoint = scaleBreakpoint ?? FONT_SCALE_BREAKPOINT_FALLBACK
|
|
9
|
+
|
|
10
|
+
return fontScale >= breakpoint
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useAtFontScaleBreakpoint } from './use_at_font_scale_breakpoint'
|
|
2
|
+
|
|
3
|
+
export const useScalableNumberOfLines = (numberOfLines?: number): number | undefined => {
|
|
4
|
+
const atFontScaleBreakpoint = useAtFontScaleBreakpoint()
|
|
5
|
+
|
|
6
|
+
if (!numberOfLines) return undefined
|
|
7
|
+
|
|
8
|
+
const numberOfLinesDoubled = numberOfLines + 1
|
|
9
|
+
return atFontScaleBreakpoint ? numberOfLinesDoubled : numberOfLines
|
|
10
|
+
}
|
|
@@ -2,7 +2,7 @@ import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'
|
|
|
2
2
|
import React, { useCallback, useMemo } from 'react'
|
|
3
3
|
import { Alert, ScrollView, StyleSheet, View } from 'react-native'
|
|
4
4
|
import { Heading, TextButton, ToggleButton } from '../../../components'
|
|
5
|
-
import { useCurrentPersonCache, useTheme } from '../../../hooks'
|
|
5
|
+
import { useAtFontScaleBreakpoint, useCurrentPersonCache, useTheme } from '../../../hooks'
|
|
6
6
|
import { useMarkAllRead } from '../../../hooks/use_conversations_actions'
|
|
7
7
|
import { useCanDisplayGroups } from '../../../hooks/use_groups'
|
|
8
8
|
import { ConversationsScreenProps } from '../conversations_screen'
|
|
@@ -68,6 +68,8 @@ export const ListHeaderComponent = () => {
|
|
|
68
68
|
onPress={alertMarkAllRead}
|
|
69
69
|
disabled={isPending}
|
|
70
70
|
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
|
|
71
|
+
accessibilityShowsLargeContentViewer
|
|
72
|
+
accessibilityLargeContentTitle="Mark all read"
|
|
71
73
|
>
|
|
72
74
|
Mark all read
|
|
73
75
|
</TextButton>
|
|
@@ -136,6 +138,8 @@ export const ListHeaderComponent = () => {
|
|
|
136
138
|
|
|
137
139
|
const useStyles = () => {
|
|
138
140
|
const theme = useTheme()
|
|
141
|
+
const atFontScaleBreakpoint = useAtFontScaleBreakpoint()
|
|
142
|
+
|
|
139
143
|
return StyleSheet.create({
|
|
140
144
|
listHeader: {
|
|
141
145
|
borderBottomWidth: 1,
|
|
@@ -144,9 +148,14 @@ const useStyles = () => {
|
|
|
144
148
|
gap: 12,
|
|
145
149
|
},
|
|
146
150
|
titleRow: {
|
|
147
|
-
flexDirection: 'row',
|
|
151
|
+
flexDirection: atFontScaleBreakpoint ? 'column' : 'row',
|
|
148
152
|
justifyContent: 'space-between',
|
|
153
|
+
alignItems: atFontScaleBreakpoint ? 'flex-start' : 'center',
|
|
154
|
+
flexWrap: 'wrap',
|
|
155
|
+
rowGap: 8,
|
|
156
|
+
columnGap: 16,
|
|
149
157
|
paddingTop: 8,
|
|
158
|
+
paddingBottom: atFontScaleBreakpoint ? 4 : 0,
|
|
150
159
|
paddingHorizontal: ROW_PADDING_HORIZONTAL,
|
|
151
160
|
},
|
|
152
161
|
filterRow: {
|
|
@@ -73,6 +73,8 @@ export function ConversationsScreen({ route }: ConversationsScreenProps) {
|
|
|
73
73
|
variant="tertiary"
|
|
74
74
|
onPress={reportABug}
|
|
75
75
|
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
|
|
76
|
+
accessibilityShowsLargeContentViewer
|
|
77
|
+
accessibilityLargeContentTitle="Report a bug"
|
|
76
78
|
>
|
|
77
79
|
Report a bug
|
|
78
80
|
</TextButton>
|
package/src/utils/styles.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Platform } from 'react-native'
|
|
|
2
2
|
import { tokens } from '../vendor/tapestry/tokens'
|
|
3
3
|
|
|
4
4
|
export const MAX_FONT_SIZE_MULTIPLIER = 1.5
|
|
5
|
-
export const MAX_FONT_SIZE_MULTIPLIER_LANDMARK = 1.
|
|
5
|
+
export const MAX_FONT_SIZE_MULTIPLIER_LANDMARK = 1.2 // Use in headers, footers, toolbars, etc.
|
|
6
6
|
|
|
7
7
|
export const CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL = 16 // TODO: move to `screens/conversation/utils/styles` when `/screens/conversation` is created
|
|
8
8
|
|