From 5216f8fb3b7b245f53ba27afec5a50ebceb4a2e7 Mon Sep 17 00:00:00 2001 From: Jon Tzeng Date: Fri, 22 Mar 2024 11:13:01 -0700 Subject: [PATCH] Fix insets when notifications are not enabled for a scene --- src/components/common/SceneWrapper.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/common/SceneWrapper.tsx b/src/components/common/SceneWrapper.tsx index b6f04506448..8e1f0d247a3 100644 --- a/src/components/common/SceneWrapper.tsx +++ b/src/components/common/SceneWrapper.tsx @@ -161,6 +161,8 @@ function SceneWrapperComponent(props: SceneWrapperProps): JSX.Element { // Calculate app insets considering the app's header, tab-bar, // notification area, etc: + const maybeNotificationHeight = hasNotifications ? notificationHeight : 0 + const maybeHeaderHeight = hasHeader ? headerBarHeight : 0 // Ignore tab bar height when keyboard is open because it is rendered behind it const maybeTabBarHeight = hasTabs && !isKeyboardOpen ? MAX_TAB_BAR_HEIGHT : 0 @@ -170,10 +172,19 @@ function SceneWrapperComponent(props: SceneWrapperProps): JSX.Element { () => ({ top: safeAreaInsets.top + maybeHeaderHeight, right: safeAreaInsets.right, - bottom: maybeInsetBottom + notificationHeight + maybeTabBarHeight + footerHeight, + bottom: maybeInsetBottom + maybeNotificationHeight + maybeTabBarHeight + footerHeight, left: safeAreaInsets.left }), - [footerHeight, maybeHeaderHeight, maybeInsetBottom, notificationHeight, maybeTabBarHeight, safeAreaInsets.left, safeAreaInsets.right, safeAreaInsets.top] + [ + footerHeight, + maybeHeaderHeight, + maybeInsetBottom, + maybeNotificationHeight, + maybeTabBarHeight, + safeAreaInsets.left, + safeAreaInsets.right, + safeAreaInsets.top + ] ) // This is a convenient styles object which may be applied as