about summary refs log tree commit diff
path: root/src/view/com/lightbox/Images.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-01-17 10:40:09 -0600
committerPaul Frazee <pfrazee@gmail.com>2023-01-17 10:40:09 -0600
commite11d53b67d7b50990320c4b5206ef052b0ff834c (patch)
treefc5e710d09e3c37ab380b445de3ec47f1533cc0a /src/view/com/lightbox/Images.tsx
parent4e312d1d24f2e83db02cf0baa3ff8e3421b2e602 (diff)
downloadvoidsky-e11d53b67d7b50990320c4b5206ef052b0ff834c.tar.zst
Add loading spinners to lightbox views (close #38)
Diffstat (limited to 'src/view/com/lightbox/Images.tsx')
-rw-r--r--src/view/com/lightbox/Images.tsx19
1 files changed, 18 insertions, 1 deletions
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,