Browse Source

fix(android): adjust depth sheet top offset for android compatibility

charlie 1 month ago
parent
commit
97634a44a7
2 changed files with 7 additions and 1 deletions
  1. 3 1
      packages/ui/src/silkhq/SheetWithDepth.tsx
  2. 4 0
      src/main/mobile/components/app.css

+ 3 - 1
packages/ui/src/silkhq/SheetWithDepth.tsx

@@ -103,7 +103,9 @@ SheetWithDepthStackRoot.displayName = 'SheetWithDepthStack.Root'
 // The SheetStack outlets that define the scenery of the stack
 // (i.e. the content underneath) for the depth effect.
 
-const initialTopOffset = 'max(env(safe-area-inset-top), 1.3vh)'
+const isIOS = window.navigator.userAgent?.match(/iPhone|iPad/i)
+const initialTopOffset = isIOS ?
+  'max(env(safe-area-inset-top), 1.3vh)' : 'max(var(--safe-area-inset-top), 1.3vh)'
 
 const SheetWithDepthStackSceneryOutlets = React.forwardRef<
   React.ElementRef<typeof SheetStack.Outlet>,

+ 4 - 0
src/main/mobile/components/app.css

@@ -38,6 +38,10 @@ html.is-native-android {
       padding-top: calc(var(--safe-area-inset-top) + 14px);
     }
   }
+
+  .SheetWithDepth-content {
+    height: calc(100% - max(calc(var(--safe-area-inset-top) + 1.3vh), 2.6vh));
+  }
 }
 
 #main-container {