From 53c7ca68ba1b934ddded40602cc9bf040d1ae7c1 Mon Sep 17 00:00:00 2001 From: Avinash Lingaloo Date: Thu, 21 Apr 2022 13:40:30 +0400 Subject: [PATCH] adjust width --- app/screens/snack_bar/index.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/screens/snack_bar/index.tsx b/app/screens/snack_bar/index.tsx index 3bb2e2798d..0176d23675 100644 --- a/app/screens/snack_bar/index.tsx +++ b/app/screens/snack_bar/index.tsx @@ -72,9 +72,9 @@ const SnackBar = ({barType, componentId, onUndoPress, sourceScreen}: SnackBarPro }; }); - const toastStyle = useMemo(() => { + const snackBarStyle = useMemo(() => { const diffWidth = windowWidth - TABLET_SIDEBAR_WIDTH; - const TABLET_PORTRAIT_RATIO = 96; + const SNACK_BAR_WIDTH = 96; let tabletStyle: Partial; @@ -82,7 +82,7 @@ const SnackBar = ({barType, componentId, onUndoPress, sourceScreen}: SnackBarPro case sourceScreen === Screens.THREAD : tabletStyle = { marginLeft: 0, - width: `${TABLET_PORTRAIT_RATIO}%`, + width: `${SNACK_BAR_WIDTH}%`, marginBottom: 30, }; break; @@ -90,26 +90,29 @@ const SnackBar = ({barType, componentId, onUndoPress, sourceScreen}: SnackBarPro tabletStyle = { marginBottom: 20, marginLeft: TABLET_SIDEBAR_WIDTH, - width: (TABLET_PORTRAIT_RATIO / 100) * diffWidth, + width: (SNACK_BAR_WIDTH / 100) * diffWidth, }; break; case [Screens.PERMALINK, Screens.MENTIONS].includes(sourceScreen): tabletStyle = { marginBottom: 0, marginLeft: 0, - width: (TABLET_PORTRAIT_RATIO / 100) * windowWidth, + width: (SNACK_BAR_WIDTH / 100) * windowWidth, }; break; default: tabletStyle = { marginBottom: 40, marginLeft: TABLET_SIDEBAR_WIDTH, - width: (TABLET_PORTRAIT_RATIO / 100) * diffWidth, + width: (SNACK_BAR_WIDTH / 100) * diffWidth, }; } return [ - {backgroundColor: theme[config.themeColor]}, + { + backgroundColor: theme[config.themeColor], + width: '96%', + }, isTablet && tabletStyle, ]; }, [theme, barType]); @@ -144,7 +147,7 @@ const SnackBar = ({barType, componentId, onUndoPress, sourceScreen}: SnackBarPro message={intl.formatMessage({id: config.id, defaultMessage: config.defaultMessage})} iconName={config.iconName} textStyle={styles.text} - style={toastStyle} + style={snackBarStyle} > {config.canUndo && onUndoPress && (