Add loading spinners to lightbox views (close #38)
parent
4e312d1d24
commit
e11d53b67d
|
@ -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,
|
||||
|
|
|
@ -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',
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue