@planningcenter/chat-react-native 3.15.0-rc.1 → 3.15.0-rc.10

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.
Files changed (160) hide show
  1. package/build/components/conversations/conversation_actions.js +1 -1
  2. package/build/components/conversations/conversation_actions.js.map +1 -1
  3. package/build/components/display/action_button.js +1 -3
  4. package/build/components/display/action_button.js.map +1 -1
  5. package/build/components/display/avatar.d.ts +3 -1
  6. package/build/components/display/avatar.d.ts.map +1 -1
  7. package/build/components/display/avatar.js +2 -2
  8. package/build/components/display/avatar.js.map +1 -1
  9. package/build/components/display/avatar_group.d.ts +3 -1
  10. package/build/components/display/avatar_group.d.ts.map +1 -1
  11. package/build/components/display/avatar_group.js +2 -2
  12. package/build/components/display/avatar_group.js.map +1 -1
  13. package/build/components/display/icon.d.ts +26 -13
  14. package/build/components/display/icon.d.ts.map +1 -1
  15. package/build/components/display/icon.js +0 -12
  16. package/build/components/display/icon.js.map +1 -1
  17. package/build/components/display/index.d.ts +1 -0
  18. package/build/components/display/index.d.ts.map +1 -1
  19. package/build/components/display/index.js +1 -0
  20. package/build/components/display/index.js.map +1 -1
  21. package/build/components/display/pressable_row.d.ts +14 -0
  22. package/build/components/display/pressable_row.d.ts.map +1 -0
  23. package/build/components/display/pressable_row.js +65 -0
  24. package/build/components/display/pressable_row.js.map +1 -0
  25. package/build/components/primitive/avatar_primitive.d.ts +2 -0
  26. package/build/components/primitive/avatar_primitive.d.ts.map +1 -1
  27. package/build/components/primitive/avatar_primitive.js +20 -19
  28. package/build/components/primitive/avatar_primitive.js.map +1 -1
  29. package/build/components/primitive/form_sheet.d.ts +3 -2
  30. package/build/components/primitive/form_sheet.d.ts.map +1 -1
  31. package/build/components/primitive/form_sheet.js +5 -3
  32. package/build/components/primitive/form_sheet.js.map +1 -1
  33. package/build/hooks/use_api.d.ts +1 -1
  34. package/build/hooks/use_api.d.ts.map +1 -1
  35. package/build/hooks/use_api.js.map +1 -1
  36. package/build/hooks/use_api_client.d.ts +1 -1
  37. package/build/hooks/use_api_client.d.ts.map +1 -1
  38. package/build/hooks/use_api_client.js +1 -1
  39. package/build/hooks/use_api_client.js.map +1 -1
  40. package/build/hooks/use_app_name.d.ts +3 -0
  41. package/build/hooks/use_app_name.d.ts.map +1 -0
  42. package/build/hooks/use_app_name.js +12 -0
  43. package/build/hooks/use_app_name.js.map +1 -0
  44. package/build/hooks/use_async_storage.d.ts +1 -1
  45. package/build/hooks/use_async_storage.d.ts.map +1 -1
  46. package/build/hooks/use_async_storage.js +6 -5
  47. package/build/hooks/use_async_storage.js.map +1 -1
  48. package/build/hooks/use_report_bug_action.d.ts +1 -1
  49. package/build/hooks/use_report_bug_action.d.ts.map +1 -1
  50. package/build/hooks/use_report_bug_action.js +1 -9
  51. package/build/hooks/use_report_bug_action.js.map +1 -1
  52. package/build/hooks/use_suspense_api.d.ts +1 -1
  53. package/build/hooks/use_suspense_api.d.ts.map +1 -1
  54. package/build/hooks/use_suspense_api.js.map +1 -1
  55. package/build/index.d.ts +2 -0
  56. package/build/index.d.ts.map +1 -1
  57. package/build/index.js +2 -0
  58. package/build/index.js.map +1 -1
  59. package/build/navigation/index.d.ts +20 -5
  60. package/build/navigation/index.d.ts.map +1 -1
  61. package/build/navigation/index.js +23 -15
  62. package/build/navigation/index.js.map +1 -1
  63. package/build/polyfills/events/CustomEvent.d.ts +21 -0
  64. package/build/polyfills/events/CustomEvent.d.ts.map +1 -0
  65. package/build/polyfills/events/CustomEvent.js +22 -0
  66. package/build/polyfills/events/CustomEvent.js.map +1 -0
  67. package/build/polyfills/events/Event.d.ts +49 -0
  68. package/build/polyfills/events/Event.d.ts.map +1 -0
  69. package/build/polyfills/events/Event.js +125 -0
  70. package/build/polyfills/events/Event.js.map +1 -0
  71. package/build/polyfills/events/EventHandlerAttributes.d.ts +8 -0
  72. package/build/polyfills/events/EventHandlerAttributes.d.ts.map +1 -0
  73. package/build/polyfills/events/EventHandlerAttributes.js +46 -0
  74. package/build/polyfills/events/EventHandlerAttributes.js.map +1 -0
  75. package/build/polyfills/events/EventTarget.d.ts +33 -0
  76. package/build/polyfills/events/EventTarget.d.ts.map +1 -0
  77. package/build/polyfills/events/EventTarget.js +238 -0
  78. package/build/polyfills/events/EventTarget.js.map +1 -0
  79. package/build/polyfills/events/internals/EventInternals.d.ts +30 -0
  80. package/build/polyfills/events/internals/EventInternals.d.ts.map +1 -0
  81. package/build/polyfills/events/internals/EventInternals.js +76 -0
  82. package/build/polyfills/events/internals/EventInternals.js.map +1 -0
  83. package/build/polyfills/events/internals/EventTargetInternals.d.ts +9 -0
  84. package/build/polyfills/events/internals/EventTargetInternals.d.ts.map +1 -0
  85. package/build/polyfills/events/internals/EventTargetInternals.js +11 -0
  86. package/build/polyfills/events/internals/EventTargetInternals.js.map +1 -0
  87. package/build/polyfills/webidl/PlatformObjects.d.ts +31 -0
  88. package/build/polyfills/webidl/PlatformObjects.d.ts.map +1 -0
  89. package/build/polyfills/webidl/PlatformObjects.js +39 -0
  90. package/build/polyfills/webidl/PlatformObjects.js.map +1 -0
  91. package/build/screens/bug_report_screen.d.ts.map +1 -1
  92. package/build/screens/bug_report_screen.js +62 -57
  93. package/build/screens/bug_report_screen.js.map +1 -1
  94. package/build/screens/conversation_filters/components/conversation_filters.js +9 -7
  95. package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
  96. package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
  97. package/build/screens/conversation_filters/components/rows.js +50 -31
  98. package/build/screens/conversation_filters/components/rows.js.map +1 -1
  99. package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
  100. package/build/screens/conversations/conversations_screen.js +6 -6
  101. package/build/screens/conversations/conversations_screen.js.map +1 -1
  102. package/build/screens/design_system_screen.js +1 -1
  103. package/build/screens/design_system_screen.js.map +1 -1
  104. package/build/screens/get_help_screen.d.ts +5 -0
  105. package/build/screens/get_help_screen.d.ts.map +1 -0
  106. package/build/screens/get_help_screen.js +94 -0
  107. package/build/screens/get_help_screen.js.map +1 -0
  108. package/build/screens/message_actions_screen.d.ts +1 -1
  109. package/build/screens/message_actions_screen.d.ts.map +1 -1
  110. package/build/screens/message_actions_screen.js +14 -11
  111. package/build/screens/message_actions_screen.js.map +1 -1
  112. package/build/utils/client/index.d.ts +1 -0
  113. package/build/utils/client/index.d.ts.map +1 -1
  114. package/build/utils/client/index.js +1 -0
  115. package/build/utils/client/index.js.map +1 -1
  116. package/build/utils/client/types.d.ts +61 -0
  117. package/build/utils/client/types.d.ts.map +1 -0
  118. package/build/utils/client/types.js +2 -0
  119. package/build/utils/client/types.js.map +1 -0
  120. package/build/utils/theme.d.ts +1 -0
  121. package/build/utils/theme.d.ts.map +1 -1
  122. package/build/utils/theme.js +2 -0
  123. package/build/utils/theme.js.map +1 -1
  124. package/package.json +5 -5
  125. package/src/__tests__/event-polyfill.test.ts +314 -0
  126. package/src/components/conversations/conversation_actions.tsx +1 -1
  127. package/src/components/display/action_button.tsx +1 -4
  128. package/src/components/display/avatar.tsx +5 -1
  129. package/src/components/display/avatar_group.tsx +5 -1
  130. package/src/components/display/icon.tsx +17 -14
  131. package/src/components/display/index.ts +1 -0
  132. package/src/components/display/pressable_row.tsx +103 -0
  133. package/src/components/primitive/avatar_primitive.tsx +35 -19
  134. package/src/components/primitive/form_sheet.tsx +33 -5
  135. package/src/hooks/use_api.ts +1 -1
  136. package/src/hooks/use_api_client.ts +2 -2
  137. package/src/hooks/use_app_name.ts +17 -0
  138. package/src/hooks/use_async_storage.ts +8 -5
  139. package/src/hooks/use_report_bug_action.ts +2 -10
  140. package/src/hooks/use_suspense_api.ts +1 -1
  141. package/src/index.tsx +2 -0
  142. package/src/navigation/index.tsx +38 -25
  143. package/src/polyfills/events/CustomEvent.ts +32 -0
  144. package/src/polyfills/events/Event.ts +186 -0
  145. package/src/polyfills/events/EventHandlerAttributes.ts +67 -0
  146. package/src/polyfills/events/EventTarget.ts +360 -0
  147. package/src/polyfills/events/README.md +1 -0
  148. package/src/polyfills/events/internals/EventInternals.ts +95 -0
  149. package/src/polyfills/events/internals/EventTargetInternals.ts +16 -0
  150. package/src/polyfills/webidl/PlatformObjects.ts +50 -0
  151. package/src/screens/bug_report_screen.tsx +79 -67
  152. package/src/screens/conversation_filters/components/conversation_filters.tsx +10 -7
  153. package/src/screens/conversation_filters/components/rows.tsx +63 -50
  154. package/src/screens/conversations/conversations_screen.tsx +7 -7
  155. package/src/screens/design_system_screen.tsx +1 -1
  156. package/src/screens/get_help_screen.tsx +131 -0
  157. package/src/screens/message_actions_screen.tsx +34 -12
  158. package/src/utils/client/index.ts +1 -0
  159. package/src/utils/theme.ts +3 -0
  160. /package/src/utils/client/{types.d.ts → types.ts} +0 -0
@@ -14,6 +14,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'
14
14
  import { useTheme } from '../../hooks'
15
15
  import type { ButtonProps, TextButtonProps } from '../display'
16
16
  import { Button, Heading, Icon, IconString, Text, TextButton } from '../display'
17
+ import { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'
17
18
 
18
19
  // =================================
19
20
  // ====== Exports ==================
@@ -146,7 +147,11 @@ function FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {
146
147
  const styles = useStyles()
147
148
 
148
149
  return (
149
- <Heading variant="h3" style={styles.headerTitle} maxFontSizeMultiplier={1}>
150
+ <Heading
151
+ variant="h3"
152
+ style={styles.headerTitle}
153
+ maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
154
+ >
150
155
  {children}
151
156
  </Heading>
152
157
  )
@@ -174,10 +179,23 @@ FormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'
174
179
  // ====== FormSheetHeaderTextButton ==========
175
180
  // ===========================================
176
181
 
177
- interface FormSheetHeaderTextButtonProps extends Omit<TextButtonProps, 'maxFontSizeMultiplier'> {}
182
+ // We are omitting `onLongPress` because we are instead supporting `accessibilityShowsLargeContentViewer`.
183
+ // This is triggered by an `onLongPress` event when an iOS device is in Apple's accessible font scale range.
184
+ // Triggering this prop will display an almost full screen iOS a11y button.
185
+ interface FormSheetHeaderTextButtonProps
186
+ extends Omit<TextButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {
187
+ children: string
188
+ }
178
189
 
179
190
  function FormSheetHeaderTextButton(props: FormSheetHeaderTextButtonProps) {
180
- return <TextButton {...props} maxFontSizeMultiplier={1} />
191
+ return (
192
+ <TextButton
193
+ {...props}
194
+ maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
195
+ accessibilityShowsLargeContentViewer
196
+ accessibilityLargeContentTitle={props.children}
197
+ />
198
+ )
181
199
  }
182
200
 
183
201
  FormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'
@@ -186,10 +204,19 @@ FormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'
186
204
  // ====== FormSheetHeaderButton ============
187
205
  // =========================================
188
206
 
189
- interface FormSheetHeaderButtonProps extends Omit<ButtonProps, 'maxFontSizeMultiplier'> {}
207
+ // Same `onLongPress`note as `FormSheetHeaderTextButtonProps`
208
+ interface FormSheetHeaderButtonProps
209
+ extends Omit<ButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {}
190
210
 
191
211
  function FormSheetHeaderButton(props: FormSheetHeaderButtonProps) {
192
- return <Button {...props} maxFontSizeMultiplier={1} />
212
+ return (
213
+ <Button
214
+ {...props}
215
+ maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
216
+ accessibilityShowsLargeContentViewer
217
+ accessibilityLargeContentTitle={props.title}
218
+ />
219
+ )
193
220
  }
194
221
 
195
222
  FormSheetHeaderButton.displayName = 'FormSheet.HeaderButton'
@@ -324,6 +351,7 @@ const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
324
351
  },
325
352
  headerTitle: {
326
353
  textAlign: 'left',
354
+ flex: 1,
327
355
  },
328
356
  headerActions: {
329
357
  flexDirection: 'row',
@@ -5,7 +5,7 @@ import {
5
5
  useQuery,
6
6
  } from '@tanstack/react-query'
7
7
  import { ApiCollection, ApiError, ApiResource, ResourceObject } from '../types'
8
- import { GetRequest, RequestData } from '../utils/client/types'
8
+ import { GetRequest, RequestData } from '../utils/client'
9
9
  import { App, useApiClient } from './use_api_client'
10
10
  import { getRequestQueryKey, RequestQueryKey } from './use_suspense_api'
11
11
 
@@ -3,8 +3,8 @@ import { ChatContext } from '../contexts/chat_context'
3
3
  import { Client } from '../utils/client'
4
4
  import { Uri } from '../utils'
5
5
 
6
- export type App = 'chat' | 'groups' | 'services'
7
- const apps: App[] = ['chat', 'groups', 'services']
6
+ export type App = 'chat' | 'groups' | 'services' | 'people'
7
+ const apps: App[] = ['chat', 'groups', 'services', 'people']
8
8
 
9
9
  export type ApiClient = { [_K in App]: Client }
10
10
 
@@ -0,0 +1,17 @@
1
+ import DeviceInfo from 'react-native-device-info'
2
+
3
+ export type AppName = 'chat' | 'churchcenter' | 'services'
4
+
5
+ export const useAppName = (): AppName => {
6
+ const applicationName = DeviceInfo.getApplicationName()
7
+
8
+ if (/churchcenter/i.test(applicationName)) {
9
+ return 'churchcenter'
10
+ }
11
+
12
+ if (/services/i.test(applicationName)) {
13
+ return 'services'
14
+ }
15
+
16
+ return 'chat'
17
+ }
@@ -4,7 +4,7 @@ import { useCallback } from 'react'
4
4
 
5
5
  const cacheKeyGenerator = (key: string) => [`AsyncStorageResource:${key}`]
6
6
 
7
- type SetValue<TCacheData> = (_itemValue?: TCacheData | null) => void
7
+ type SetValue<TCacheData> = (_itemValue?: TCacheData | null) => Promise<void>
8
8
 
9
9
  export function useAsyncStorage<TCacheData>(
10
10
  key: string,
@@ -28,11 +28,14 @@ export function useAsyncStorage<TCacheData>(
28
28
  const setValue: SetValue<TCacheData> = useCallback(
29
29
  itemValue => {
30
30
  if (itemValue === null || itemValue === undefined) {
31
- AsyncStorage.removeItem(key)
32
- } else {
33
- AsyncStorage.setItem(key, JSON.stringify(itemValue))
31
+ return AsyncStorage.removeItem(key).then(() => {
32
+ refetch()
33
+ })
34
34
  }
35
- refetch()
35
+
36
+ return AsyncStorage.setItem(key, JSON.stringify(itemValue)).then(() => {
37
+ refetch()
38
+ })
36
39
  },
37
40
  [key, refetch]
38
41
  )
@@ -1,12 +1,5 @@
1
1
  import { useMutation } from '@tanstack/react-query'
2
2
  import { useApiClient } from './use_api_client'
3
- import DeviceInfo from 'react-native-device-info'
4
- const brand = DeviceInfo.getBrand()
5
- const model = DeviceInfo.getModel()
6
- const systemName = DeviceInfo.getSystemName()
7
- const systemVersion = DeviceInfo.getSystemVersion()
8
- const readableVersion = DeviceInfo.getReadableVersion()
9
- const appName = DeviceInfo.getApplicationName()
10
3
 
11
4
  export const useReportBugAction = () => {
12
5
  const apiClient = useApiClient()
@@ -18,7 +11,7 @@ export const useReportBugAction = () => {
18
11
  attachmentIds,
19
12
  }: {
20
13
  description: string
21
- description_json: string
14
+ description_json: Record<string, any>
22
15
  attachmentIds: string[]
23
16
  }) => {
24
17
  return apiClient.chat.post({
@@ -28,8 +21,7 @@ export const useReportBugAction = () => {
28
21
  type: '',
29
22
  attributes: {
30
23
  description,
31
- description_json,
32
- device_info: `${appName}/${readableVersion} (${brand}, ${model}, ${systemName}, ${systemVersion})`,
24
+ description_json: JSON.stringify(description_json),
33
25
  attachment_ids: attachmentIds,
34
26
  },
35
27
  },
@@ -6,7 +6,7 @@ import {
6
6
  UseSuspenseQueryOptions,
7
7
  } from '@tanstack/react-query'
8
8
  import { ApiCollection, ApiResource, ResourceObject } from '../types'
9
- import { GetRequest, RequestData } from '../utils/client/types'
9
+ import { GetRequest, RequestData } from '../utils/client'
10
10
  import { App, useApiClient } from './use_api_client'
11
11
  import { Log } from '../utils'
12
12
  import { ApiError } from '../types/api_primitives'
package/src/index.tsx CHANGED
@@ -8,3 +8,5 @@ export * from './types'
8
8
  export { platformFontWeightBold, Session, TemporaryDefaultColorsType, Uri } from './utils'
9
9
  export * from './utils/client'
10
10
  export * from './utils/native_adapters'
11
+ export { default as Event } from './polyfills/events/Event'
12
+ export { CustomEvent } from './polyfills/events/CustomEvent'
@@ -4,47 +4,50 @@ import {
4
4
  createNativeStackNavigator,
5
5
  NativeStackHeaderRightProps,
6
6
  } from '@react-navigation/native-stack'
7
+ import { CardStyleInterpolators } from '@react-navigation/stack'
7
8
  import React from 'react'
9
+ import { Platform } from 'react-native'
8
10
  import { Icon } from '../components'
11
+ import { HeaderTextButton } from '../components/display/platform_modal_header_buttons'
12
+ import {
13
+ AttachmentActionsScreen,
14
+ AttachmentActionsScreenOptions,
15
+ } from '../screens/attachment_actions/attachment_actions_screen'
16
+ import { BugReportScreen, BugReportScreenOptions } from '../screens/bug_report_screen'
17
+ import {
18
+ MessageReadReceiptsScreen,
19
+ MessageReadReceiptsScreenOptions,
20
+ } from '../screens/conversation/message_read_receipts_screen'
9
21
  import { ConversationDetailsScreen } from '../screens/conversation_details_screen'
22
+ import {
23
+ ConversationFilterReceipientsScreenOptions,
24
+ ConversationFilterRecipientsScreen,
25
+ } from '../screens/conversation_filter_recipients/conversation_filter_recipients_screen'
26
+ import { ConversationFiltersParams } from '../screens/conversation_filters/screen_props'
27
+ import {
28
+ ConversationFiltersScreen,
29
+ ConversationFiltersScreenOptions,
30
+ } from '../screens/conversation_filters_screen'
31
+ import { ConversationNewScreen } from '../screens/conversation_new/conversation_new_screen'
10
32
  import {
11
33
  ConversationRouteProps,
12
34
  ConversationScreen,
13
35
  ConversationScreenTitle,
14
36
  } from '../screens/conversation_screen'
15
- import { ConversationsScreen } from '../screens/conversations/conversations_screen'
16
- import { ConversationNewScreen } from '../screens/conversation_new/conversation_new_screen'
17
- import {
18
- ConversationFilterReceipientsScreenOptions,
19
- ConversationFilterRecipientsScreen,
20
- } from '../screens/conversation_filter_recipients/conversation_filter_recipients_screen'
37
+ import { ConversationSelectGroupRecipientsScreen } from '../screens/conversation_select_recipients/conversation_select_group_recipients_screen'
21
38
  import { ConversationSelectRecipientsScreen } from '../screens/conversation_select_recipients/conversation_select_recipients_screen'
39
+ import { ConversationSelectTeamsILeadRecipientsScreen } from '../screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen'
40
+ import { ConversationsScreen } from '../screens/conversations/conversations_screen'
41
+ import { GetHelpScreen } from '../screens/get_help_screen'
22
42
  import {
23
43
  MessageActionsScreen,
24
44
  MessageActionsScreenOptions,
25
45
  } from '../screens/message_actions_screen'
26
- import { SendGiphyScreen, SendGiphyScreenOptions } from '../screens/send_giphy_screen'
27
46
  import { NotFound } from '../screens/not_found'
28
47
  import { ReactionsScreen, ReactionsScreenOptions } from '../screens/reactions_screen'
29
- import { ScreenLayout } from './screenLayout'
30
- import {
31
- ConversationFiltersScreen,
32
- ConversationFiltersScreenOptions,
33
- } from '../screens/conversation_filters_screen'
34
- import { ConversationFiltersParams } from '../screens/conversation_filters/screen_props'
35
- import { ConversationSelectGroupRecipientsScreen } from '../screens/conversation_select_recipients/conversation_select_group_recipients_screen'
36
- import { ConversationSelectTeamsILeadRecipientsScreen } from '../screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen'
37
- import { AttachmentActionsScreenOptions } from '../screens/attachment_actions/attachment_actions_screen'
38
- import { AttachmentActionsScreen } from '../screens/attachment_actions/attachment_actions_screen'
39
- import { BugReportScreen, BugReportScreenOptions } from '../screens/bug_report_screen'
40
- import {
41
- MessageReadReceiptsScreen,
42
- MessageReadReceiptsScreenOptions,
43
- } from '../screens/conversation/message_read_receipts_screen'
44
- import { Platform } from 'react-native'
45
- import { HeaderTextButton } from '../components/display/platform_modal_header_buttons'
48
+ import { SendGiphyScreen, SendGiphyScreenOptions } from '../screens/send_giphy_screen'
46
49
  import { TeamConversationScreen } from '../screens/team_conversation_screen'
47
- import { CardStyleInterpolators } from '@react-navigation/stack'
50
+ import { ScreenLayout } from './screenLayout'
48
51
 
49
52
  const HEADER_BACK_BUTTON_LAYOUT_RESET_STYLES = {
50
53
  marginLeft: Platform.select({ ios: -8, default: -3 }),
@@ -231,6 +234,16 @@ export const ChatStack = createNativeStackNavigator({
231
234
  screen: BugReportScreen,
232
235
  options: BugReportScreenOptions,
233
236
  },
237
+ GetHelp: {
238
+ screen: GetHelpScreen,
239
+ options: ({ navigation }) => ({
240
+ headerTitle: 'Get help',
241
+ presentation: 'modal',
242
+ headerLeft: props => (
243
+ <HeaderTextButton {...props} onPress={navigation.goBack} title="Close" />
244
+ ),
245
+ }),
246
+ },
234
247
  NotFound: {
235
248
  screen: NotFound,
236
249
  options: {
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ /**
9
+ * This module implements the `CustomEvent` interface from the DOM.
10
+ * See https://dom.spec.whatwg.org/#interface-customevent.
11
+ */
12
+
13
+ import Event from './Event'
14
+ import type { EventInit as RNEventInit } from './Event'
15
+
16
+ export interface CustomEventInit extends RNEventInit {
17
+ detail?: unknown
18
+ }
19
+
20
+ export class CustomEvent extends Event {
21
+ private _detail: unknown
22
+
23
+ constructor(type: string, options?: CustomEventInit) {
24
+ super(type, options)
25
+
26
+ this._detail = options?.detail
27
+ }
28
+
29
+ get detail(): unknown {
30
+ return this._detail
31
+ }
32
+ }
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ /**
9
+ * This module implements the `Event` interface from the DOM.
10
+ * See https://dom.spec.whatwg.org/#interface-event.
11
+ */
12
+
13
+ import type RNEventTarget from './EventTarget'
14
+ import {
15
+ getComposedPath,
16
+ getCurrentTarget,
17
+ getEventPhase,
18
+ getInPassiveListenerFlag,
19
+ getIsTrusted,
20
+ getTarget,
21
+ setStopImmediatePropagationFlag,
22
+ setStopPropagationFlag,
23
+ setIsTrusted,
24
+ setEventPhase,
25
+ } from './internals/EventInternals'
26
+ import { setPlatformObject } from '../webidl/PlatformObjects'
27
+
28
+ export interface EventInit {
29
+ bubbles?: boolean
30
+ cancelable?: boolean
31
+ composed?: boolean
32
+ }
33
+
34
+ export type EventPhase = 0 | 1 | 2 | 3
35
+
36
+ export default class Event {
37
+ static NONE: 0
38
+ static CAPTURING_PHASE: 1
39
+ static AT_TARGET: 2
40
+ static BUBBLING_PHASE: 3
41
+
42
+ readonly NONE!: 0
43
+ readonly CAPTURING_PHASE!: 1
44
+ readonly AT_TARGET!: 2
45
+ readonly BUBBLING_PHASE!: 3
46
+
47
+ private _bubbles: boolean
48
+ private _cancelable: boolean
49
+ private _composed: boolean
50
+ private _type: string
51
+
52
+ private _defaultPrevented: boolean = false
53
+ private _timeStamp: number = performance.now()
54
+
55
+ // Symbol-keyed fields are internal and managed via helpers; not declared here.
56
+
57
+ constructor(type: string, options?: EventInit | null) {
58
+ if (arguments.length < 1) {
59
+ throw new TypeError("Failed to construct 'Event': 1 argument required, but only 0 present.")
60
+ }
61
+
62
+ const typeOfOptions = typeof options
63
+ if (options != null && typeOfOptions !== 'object' && typeOfOptions !== 'function') {
64
+ throw new TypeError(
65
+ "Failed to construct 'Event': The provided value is not of type 'EventInit'."
66
+ )
67
+ }
68
+
69
+ this._type = String(type)
70
+ this._bubbles = Boolean((options as EventInit | undefined)?.bubbles)
71
+ this._cancelable = Boolean((options as EventInit | undefined)?.cancelable)
72
+ this._composed = Boolean((options as EventInit | undefined)?.composed)
73
+
74
+ // Initialize internal flags
75
+ setIsTrusted(this, false)
76
+ setEventPhase(this, 0 as 0)
77
+ }
78
+
79
+ get bubbles(): boolean {
80
+ return this._bubbles
81
+ }
82
+
83
+ get cancelable(): boolean {
84
+ return this._cancelable
85
+ }
86
+
87
+ get composed(): boolean {
88
+ return this._composed
89
+ }
90
+
91
+ get currentTarget(): RNEventTarget | null {
92
+ return getCurrentTarget(this)
93
+ }
94
+
95
+ get defaultPrevented(): boolean {
96
+ return this._defaultPrevented
97
+ }
98
+
99
+ get eventPhase(): EventPhase {
100
+ return getEventPhase(this)
101
+ }
102
+
103
+ get isTrusted(): boolean {
104
+ return getIsTrusted(this)
105
+ }
106
+
107
+ get target(): RNEventTarget | null {
108
+ return getTarget(this)
109
+ }
110
+
111
+ get timeStamp(): number {
112
+ return this._timeStamp
113
+ }
114
+
115
+ get type(): string {
116
+ return this._type
117
+ }
118
+
119
+ composedPath(): ReadonlyArray<RNEventTarget> {
120
+ return getComposedPath(this).slice()
121
+ }
122
+
123
+ preventDefault(): void {
124
+ if (!this._cancelable) {
125
+ return
126
+ }
127
+
128
+ if (getInPassiveListenerFlag(this)) {
129
+ console.error(new Error('Unable to preventDefault inside passive event listener invocation.'))
130
+ return
131
+ }
132
+
133
+ this._defaultPrevented = true
134
+ }
135
+
136
+ stopImmediatePropagation(): void {
137
+ setStopPropagationFlag(this, true)
138
+ setStopImmediatePropagationFlag(this, true)
139
+ }
140
+
141
+ stopPropagation(): void {
142
+ setStopPropagationFlag(this, true)
143
+ }
144
+ }
145
+
146
+ Object.defineProperty(Event, 'NONE', {
147
+ enumerable: true,
148
+ value: 0,
149
+ })
150
+
151
+ Object.defineProperty(Event.prototype, 'NONE', {
152
+ enumerable: true,
153
+ value: 0,
154
+ })
155
+
156
+ Object.defineProperty(Event, 'CAPTURING_PHASE', {
157
+ enumerable: true,
158
+ value: 1,
159
+ })
160
+
161
+ Object.defineProperty(Event.prototype, 'CAPTURING_PHASE', {
162
+ enumerable: true,
163
+ value: 1,
164
+ })
165
+
166
+ Object.defineProperty(Event, 'AT_TARGET', {
167
+ enumerable: true,
168
+ value: 2,
169
+ })
170
+
171
+ Object.defineProperty(Event.prototype, 'AT_TARGET', {
172
+ enumerable: true,
173
+ value: 2,
174
+ })
175
+
176
+ Object.defineProperty(Event, 'BUBBLING_PHASE', {
177
+ enumerable: true,
178
+ value: 3,
179
+ })
180
+
181
+ Object.defineProperty(Event.prototype, 'BUBBLING_PHASE', {
182
+ enumerable: true,
183
+ value: 3,
184
+ })
185
+
186
+ setPlatformObject(Event)
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Helpers to implement event handler IDL attributes.
3
+ */
4
+
5
+ import type EventTarget from './EventTarget'
6
+ import type { EventCallback } from './EventTarget'
7
+
8
+ type EventHandler = Readonly<{
9
+ handleEvent: EventCallback
10
+ }>
11
+ type EventHandlerAttributeMap = Map<string, EventHandler | null>
12
+
13
+ const EVENT_HANDLER_CONTENT_ATTRIBUTE_MAP_KEY = Symbol('eventHandlerAttributeMap')
14
+
15
+ function getEventHandlerAttributeMap(
16
+ target: EventTarget
17
+ ): EventHandlerAttributeMap | null | undefined {
18
+ return (target as any)[EVENT_HANDLER_CONTENT_ATTRIBUTE_MAP_KEY]
19
+ }
20
+
21
+ function setEventHandlerAttributeMap(target: EventTarget, map: EventHandlerAttributeMap | null) {
22
+ ;(target as any)[EVENT_HANDLER_CONTENT_ATTRIBUTE_MAP_KEY] = map
23
+ }
24
+
25
+ export function getEventHandlerAttribute(target: EventTarget, type: string): EventCallback | null {
26
+ const listener = getEventHandlerAttributeMap(target)?.get(type)
27
+ return listener != null ? listener.handleEvent : null
28
+ }
29
+
30
+ export function setEventHandlerAttribute(
31
+ target: EventTarget,
32
+ type: string,
33
+ callback: EventCallback | null | undefined
34
+ ): void {
35
+ let map = getEventHandlerAttributeMap(target)
36
+ if (map != null) {
37
+ const currentListener = map.get(type)
38
+ if (currentListener) {
39
+ target.removeEventListener(type, currentListener)
40
+ map.delete(type)
41
+ }
42
+ }
43
+
44
+ if (
45
+ callback != null &&
46
+ (typeof callback === 'function' || typeof (callback as any) === 'object')
47
+ ) {
48
+ const listener: EventHandler = {
49
+ handleEvent: callback as EventCallback,
50
+ }
51
+
52
+ try {
53
+ target.addEventListener(type, listener)
54
+ if (map == null) {
55
+ map = new Map()
56
+ setEventHandlerAttributeMap(target, map)
57
+ }
58
+ map.set(type, listener)
59
+ } catch (_e) {
60
+ // Assigning incorrect listener does not throw in setters.
61
+ }
62
+ }
63
+
64
+ if (map != null && map.size === 0) {
65
+ setEventHandlerAttributeMap(target, null)
66
+ }
67
+ }