diff options
-rw-r--r-- | src/view/com/util/Toast.style.tsx | 6 | ||||
-rw-r--r-- | src/view/com/util/Toast.tsx | 18 | ||||
-rw-r--r-- | src/view/com/util/Toast.web.tsx | 7 | ||||
-rw-r--r-- | src/view/screens/Storybook/Toasts.tsx | 14 |
4 files changed, 23 insertions, 22 deletions
diff --git a/src/view/com/util/Toast.style.tsx b/src/view/com/util/Toast.style.tsx index 9a7e6b82d..6bfb12bc1 100644 --- a/src/view/com/util/Toast.style.tsx +++ b/src/view/com/util/Toast.style.tsx @@ -1,8 +1,8 @@ -import {type Theme, select} from '#/alf' -import {CircleInfo_Stroke2_Corner0_Rounded as ErrorIcon} from '#/components/icons/CircleInfo' -import {Warning_Stroke2_Corner0_Rounded as WarningIcon} from '#/components/icons/Warning' import {Check_Stroke2_Corner0_Rounded as SuccessIcon} from '#/components/icons/Check' import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo' +import {CircleInfo_Stroke2_Corner0_Rounded as ErrorIcon} from '#/components/icons/CircleInfo' +import {type Theme, select} from '#/alf' +import {Warning_Stroke2_Corner0_Rounded as WarningIcon} from '#/components/icons/Warning' export type ToastType = 'default' | 'success' | 'error' | 'warning' | 'info' diff --git a/src/view/com/util/Toast.tsx b/src/view/com/util/Toast.tsx index 9c20e56be..6fe04f793 100644 --- a/src/view/com/util/Toast.tsx +++ b/src/view/com/util/Toast.tsx @@ -1,3 +1,12 @@ +import {atoms as a, useTheme} from '#/alf' +import {Text} from '#/components/Typography' +import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' +import { + type ToastType, + getToastTypeStyles, + TOAST_ANIMATION_CONFIG, + TOAST_TYPE_TO_ICON, +} from '#/view/com/util/Toast.style' import {useEffect, useMemo, useRef, useState} from 'react' import {AccessibilityInfo, View} from 'react-native' import { @@ -17,15 +26,6 @@ import Animated, { } from 'react-native-reanimated' import RootSiblings from 'react-native-root-siblings' import {useSafeAreaInsets} from 'react-native-safe-area-context' -import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' -import {atoms as a, useTheme} from '#/alf' -import {Text} from '#/components/Typography' -import { - type ToastType, - TOAST_TYPE_TO_ICON, - getToastTypeStyles, - TOAST_ANIMATION_CONFIG, -} from '#/view/com/util/Toast.style' const TIMEOUT = 2e3 diff --git a/src/view/com/util/Toast.web.tsx b/src/view/com/util/Toast.web.tsx index fbe31528e..9ed1f0397 100644 --- a/src/view/com/util/Toast.web.tsx +++ b/src/view/com/util/Toast.web.tsx @@ -4,14 +4,15 @@ import {useEffect, useState} from 'react' import {Pressable, StyleSheet, Text, View} from 'react-native' -import {atoms as a, useTheme} from '#/alf' + import { - type ToastType, - TOAST_TYPE_TO_ICON, getToastTypeStyles, getToastWebAnimationStyles, + TOAST_TYPE_TO_ICON, TOAST_WEB_KEYFRAMES, + type ToastType, } from '#/view/com/util/Toast.style' +import {atoms as a, useTheme} from '#/alf' const DURATION = 3500 diff --git a/src/view/screens/Storybook/Toasts.tsx b/src/view/screens/Storybook/Toasts.tsx index 5197ec2f4..da0f1c416 100644 --- a/src/view/screens/Storybook/Toasts.tsx +++ b/src/view/screens/Storybook/Toasts.tsx @@ -1,13 +1,13 @@ -import {View, Pressable} from 'react-native' +import {Pressable,View} from 'react-native' -import {atoms as a, useTheme} from '#/alf' -import {Text, H1} from '#/components/Typography' +import * as Toast from '#/view/com/util/Toast' import { - type ToastType, - TOAST_TYPE_TO_ICON, getToastTypeStyles, + TOAST_TYPE_TO_ICON, + type ToastType, } from '#/view/com/util/Toast.style' -import * as Toast from '#/view/com/util/Toast' +import {atoms as a, useTheme} from '#/alf' +import {H1,Text} from '#/components/Typography' function ToastPreview({message, type}: {message: string; type: ToastType}) { const t = useTheme() @@ -16,7 +16,7 @@ function ToastPreview({message, type}: {message: string; type: ToastType}) { const IconComponent = TOAST_TYPE_TO_ICON[type] return ( - <Pressable + <Pressable accessibilityRole="button" onPress={() => Toast.show(message, type)} style={[ {backgroundColor: colors.backgroundColor}, |