From e11d53b67d7b50990320c4b5206ef052b0ff834c Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 17 Jan 2023 10:40:09 -0600 Subject: [PATCH] Add loading spinners to lightbox views (close #38) --- src/view/com/lightbox/Images.tsx | 19 ++++++++++++++++++- src/view/com/lightbox/ProfileImage.tsx | 18 +++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/view/com/lightbox/Images.tsx b/src/view/com/lightbox/Images.tsx index 7179f088..8890adb6 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 ( + {uris.map((uri, i) => ( ({ + left: winDim.width / 2 - 30, + top: winDim.height / 2 - (winDim.width - 40) / 2 - 80, + }), + [winDim.width, winDim.height], + ) return ( +