1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Scroll to toot working

This commit is contained in:
Zhiyuan Zheng
2020-12-12 12:49:29 +01:00
parent 0fa9f87f66
commit 81a21d1d07
13 changed files with 140 additions and 116 deletions

View File

@ -0,0 +1,49 @@
import { Feather } from '@expo/vector-icons'
import React from 'react'
import { ActivityIndicator, StyleSheet, Text, View } from 'react-native'
import { ButtonRow } from 'src/components/Button'
import { StyleConstants } from 'src/utils/styles/constants'
import { useTheme } from 'src/utils/styles/ThemeManager'
export interface Props {
isLoading: boolean
isError: boolean
refetch: () => void
}
const TimelineEmpty: React.FC<Props> = ({ isLoading, isError, refetch }) => {
const { theme } = useTheme()
return (
<View style={styles.base}>
{isLoading && <ActivityIndicator />}
{isError && (
<>
<Feather
name='frown'
size={StyleConstants.Font.Size.L}
color={theme.primary}
/>
<Text style={[styles.error, { color: theme.primary }]}></Text>
<ButtonRow text='重试' onPress={() => refetch()} />
</>
)}
</View>
)
}
const styles = StyleSheet.create({
base: {
flex: 1,
minHeight: '100%',
justifyContent: 'center',
alignItems: 'center'
},
error: {
fontSize: StyleConstants.Font.Size.M,
marginTop: StyleConstants.Spacing.S,
marginBottom: StyleConstants.Spacing.L
}
})
export default TimelineEmpty