diff options
Diffstat (limited to 'src/view')
-rw-r--r-- | src/view/com/lightbox/Images.tsx | 19 | ||||
-rw-r--r-- | 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 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, diff --git a/src/view/com/lightbox/ProfileImage.tsx b/src/view/com/lightbox/ProfileImage.tsx index f9c4ae73e..41417ea40 100644 --- a/src/view/com/lightbox/ProfileImage.tsx +++ b/src/view/com/lightbox/ProfileImage.tsx @@ -1,13 +1,26 @@ import React from 'react' -import {StyleSheet, useWindowDimensions, View} from 'react-native' +import { + ActivityIndicator, + StyleSheet, + useWindowDimensions, + View, +} from 'react-native' import {UserAvatar} from '../util/UserAvatar' import {ProfileViewModel} from '../../../state/models/profile-view' export function Component({profileView}: {profileView: ProfileViewModel}) { const winDim = useWindowDimensions() const top = winDim.height / 2 - (winDim.width - 40) / 2 - 100 + const spinnerStyle = React.useMemo( + () => ({ + left: winDim.width / 2 - 30, + top: winDim.height / 2 - (winDim.width - 40) / 2 - 80, + }), + [winDim.width, winDim.height], + ) return ( <View style={[styles.container, {top}]}> + <ActivityIndicator style={[styles.loading, spinnerStyle]} size="large" /> <UserAvatar handle={profileView.handle} displayName={profileView.displayName} @@ -23,4 +36,7 @@ const styles = StyleSheet.create({ position: 'absolute', left: 20, }, + loading: { + position: 'absolute', + }, }) |