From e11d53b67d7b50990320c4b5206ef052b0ff834c Mon Sep 17 00:00:00 2001
From: Paul Frazee <pfrazee@gmail.com>
Date: Tue, 17 Jan 2023 10:40:09 -0600
Subject: Add loading spinners to lightbox views (close #38)

---
 src/view/com/lightbox/Images.tsx | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

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

diff --git a/src/view/com/lightbox/Images.tsx b/src/view/com/lightbox/Images.tsx
index 7179f0887..8890adb6f 100644
--- a/src/view/com/lightbox/Images.tsx
+++ b/src/view/com/lightbox/Images.tsx
@@ -1,5 +1,11 @@
 import React from 'react'
-import {Image, StyleSheet, useWindowDimensions, View} from 'react-native'
+import {
+  ActivityIndicator,
+  Image,
+  StyleSheet,
+  useWindowDimensions,
+  View,
+} from 'react-native'
 
 export function Component({
   uris,
@@ -12,8 +18,16 @@ export function Component({
 }) {
   const winDim = useWindowDimensions()
   const left = index * winDim.width * -1
+  const spinnerStyle = React.useMemo(
+    () => ({
+      left: winDim.width / 2 - 20,
+      top: winDim.height / 2 - 50,
+    }),
+    [winDim.width, winDim.height],
+  )
   return (
     <View style={[styles.container, {left}]}>
+      <ActivityIndicator style={[styles.loading, spinnerStyle]} size="large" />
       {uris.map((uri, i) => (
         <Image
           key={i}
@@ -36,6 +50,9 @@ const styles = StyleSheet.create({
     left: 0,
     width: '100%',
   },
+  loading: {
+    position: 'absolute',
+  },
   image: {
     position: 'absolute',
     top: 200,
-- 
cgit 1.4.1

