aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/TaggLoadingIndicator.tsx
blob: a829cb6f1cba7c0bbb11e35a476375173fd52603 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import * as React from 'react';
import {Image, StyleSheet, View} from 'react-native';
import {SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils';

interface TaggLoadingIndicatorProps {
  fullscreen?: boolean;
}

const TaggLoadingIndicator: React.FC<TaggLoadingIndicatorProps> = ({
  fullscreen = false,
}) => {
  return (
    <View
      style={[
        fullscreen ? styles.fullscreen : {},
        styles.container,
        styles.horizontal,
      ]}>
      <Image
        source={require('../../assets/gifs/loading-animation.gif')}
        style={styles.icon}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  fullscreen: {
    zIndex: 999,
    position: 'absolute',
    height: SCREEN_HEIGHT,
    width: SCREEN_WIDTH,
  },
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: 'rgba(0,0,0,0.3)',
  },
  horizontal: {
    flexDirection: 'row',
    justifyContent: 'space-around',
    padding: 10,
  },
  icon: {
    alignSelf: 'center',
    justifyContent: 'center',
    width: '40%',
    aspectRatio: 2,
  },
});

export default TaggLoadingIndicator;