From 8825d6b1a7d13e6b3ac0719258d976f3a7cfc454 Mon Sep 17 00:00:00 2001
From: Samuel Newman <mozzius@protonmail.com>
Date: Tue, 26 Nov 2024 23:59:31 +0000
Subject: Lightbox status bar behaviour (#6637)

* lightbox status bar

* add hideTransitionAnimation="slide"

* move navigation bar logic to util
---
 src/view/com/lightbox/ImageViewing/index.tsx | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

(limited to 'src/view/com/lightbox/ImageViewing/index.tsx')

diff --git a/src/view/com/lightbox/ImageViewing/index.tsx b/src/view/com/lightbox/ImageViewing/index.tsx
index 4ba056eb0..e7d158d03 100644
--- a/src/view/com/lightbox/ImageViewing/index.tsx
+++ b/src/view/com/lightbox/ImageViewing/index.tsx
@@ -8,7 +8,7 @@
 // Original code copied and simplified from the link below as the codebase is currently not maintained:
 // https://github.com/jobtoday/react-native-image-viewing
 
-import React, {useCallback, useState} from 'react'
+import React, {useCallback, useEffect, useState} from 'react'
 import {
   LayoutAnimation,
   PixelRatio,
@@ -40,6 +40,7 @@ import {
   useSafeAreaFrame,
   useSafeAreaInsets,
 } from 'react-native-safe-area-context'
+import {StatusBar} from 'expo-status-bar'
 import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
 import {Trans} from '@lingui/macro'
 
@@ -50,6 +51,8 @@ import {Lightbox} from '#/state/lightbox'
 import {Button} from '#/view/com/util/forms/Button'
 import {Text} from '#/view/com/util/text/Text'
 import {ScrollView} from '#/view/com/util/Views'
+import {ios, useTheme} from '#/alf'
+import {setNavigationBar} from '#/alf/util/navigationBar'
 import {PlatformInfo} from '../../../../../modules/expo-bluesky-swiss-army'
 import {ImageSource, Transform} from './@types'
 import ImageDefaultHeader from './components/ImageDefaultHeader'
@@ -276,8 +279,26 @@ function ImageView({
     },
   )
 
+  // style nav bar on android
+  const t = useTheme()
+  useEffect(() => {
+    setNavigationBar('lightbox', t)
+    return () => {
+      setNavigationBar('theme', t)
+    }
+  }, [t])
+
   return (
     <Animated.View style={[styles.container, containerStyle]}>
+      <StatusBar
+        animated
+        style="light"
+        hideTransitionAnimation="slide"
+        backgroundColor="black"
+        // hiding causes layout shifts on android,
+        // so avoid until we add edge-to-edge mode
+        hidden={ios(isScaled || !showControls)}
+      />
       <Animated.View
         style={[styles.backdrop, backdropStyle]}
         renderToHardwareTextureAndroid
-- 
cgit 1.4.1

