From 1d2cd6fb4a3b935f5b2e11d50fd2044ac0ab19ad Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 7 Aug 2025 08:35:18 -0500 Subject: [PATCH] Fix alignment --- src/components/Toast/Toast.tsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/Toast/Toast.tsx b/src/components/Toast/Toast.tsx index 321180254e..2d1ea4261e 100644 --- a/src/components/Toast/Toast.tsx +++ b/src/components/Toast/Toast.tsx @@ -1,7 +1,7 @@ import {createContext, useContext, useMemo} from 'react' import {View} from 'react-native' -import {atoms as a, select, useTheme} from '#/alf' +import {atoms as a, select, useAlf, useTheme} from '#/alf' import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo' import {CircleInfo_Stroke2_Corner0_Rounded as ErrorIcon} from '#/components/icons/CircleInfo' import {Warning_Stroke2_Corner0_Rounded as WarningIcon} from '#/components/icons/Warning' @@ -32,9 +32,19 @@ export function Toast({ type: ToastType content: React.ReactNode }) { + const {fonts} = useAlf() const t = useTheme() const styles = useToastStyles({type}) const Icon = ICONS[type] + /** + * Vibes-based number, adjusts `top` of `View` that wraps the text to + * compensate for different type sizes and keep the first line of text + * aligned with the icon. - esb + */ + const fontScaleCompensation = useMemo( + () => parseInt(fonts.scale) * -1 * 0.65, + [fonts.scale], + ) return ( ({type}), [type])}> @@ -56,7 +66,13 @@ export function Toast({ ]}> - + {typeof content === 'string' ? ( {content} ) : (