MCPcopy Create free account
hub / github.com/dailydotdev/apps / useIOSError

Function useIOSError

packages/shared/src/hooks/useIOSError.ts:10–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8};
9
10export const useIOSError = (): void => {
11 const { displayToast } = useToastNotification();
12 const eventName = 'generic-error';
13
14 useEffect(() => {
15 if (!isIOSNative()) {
16 return () => {};
17 }
18
19 promisifyEventListener<void, GenericIOSError>(
20 eventName,
21 ({ detail }) => {
22 if (detail.description) {
23 displayToast(detail.description);
24 }
25 },
26 { once: false },
27 );
28
29 return () => {
30 (
31 globalThis as typeof globalThis & {
32 eventControllers?: Partial<Record<string, AbortController>>;
33 }
34 ).eventControllers?.[eventName]?.abort();
35 };
36 }, [displayToast]);
37};

Callers 1

InternalAppFunction · 0.90

Calls 4

useToastNotificationFunction · 0.90
isIOSNativeFunction · 0.90
promisifyEventListenerFunction · 0.90
displayToastFunction · 0.85

Tested by

no test coverage detected