aboutsummaryrefslogtreecommitdiff
path: root/src/screens/onboarding/legacy/TaggPopup.tsx
blob: e71a4d2ab3242668592002e441a210a6c2048229 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import {BlurView} from '@react-native-community/blur';
import {RouteProp} from '@react-navigation/native';
import {StackNavigationProp} from '@react-navigation/stack';
import * as React from 'react';
import {Platform, StyleSheet, Text, TouchableOpacity} from 'react-native';
import {Image, View} from 'react-native-animatable';
import {ArrowButton} from '../../../components/onboarding';
import {OnboardingStackParams} from '../../../routes';
import {SCREEN_HEIGHT, SCREEN_WIDTH} from '../../../utils';
import CloseIcon from '../../../assets/ionicons/close-outline.svg';

type TaggPopupRouteProps = RouteProp<OnboardingStackParams, 'TaggPopup'>;
type TaggPopupNavigationProps = StackNavigationProp<
  OnboardingStackParams,
  'TaggPopup'
>;

interface TaggPopupProps {
  route: TaggPopupRouteProps;
  navigation: TaggPopupNavigationProps;
}

const TaggPopup: React.FC<TaggPopupProps> = ({route, navigation}) => {
  /**
   * Custom popup / Tutorial screen for Tagg
   * Just like a  Singly Linked List, we have a next node
   * if (next !== undefined)
   *    Display the next button and navigate to next popup node on click
   * else
   *    Display close button, navigate back on close
   */
  const {messageHeader, messageBody, next} = route.params.popupProps;

  return (
    <BlurView blurType="light" blurAmount={2} style={styles.container}>
      <TouchableOpacity
        style={styles.container}
        onPressOut={() => {
          navigation.goBack();
        }}>
        <View style={styles.popup}>
          <Image
            style={styles.icon}
            source={require('../../../assets/icons/notificationPrompts/plus-logo.png')}
          />
          <View style={styles.textContainer}>
            <Text style={styles.header}>{messageHeader}</Text>
            <Text style={styles.subtext}>{messageBody}</Text>
          </View>
          {!next && (
            <TouchableOpacity
              style={styles.closeButton}
              onPress={() => {
                navigation.goBack();
              }}>
              <CloseIcon height={'50%'} width={'50%'} color={'white'} />
            </TouchableOpacity>
          )}
        </View>
        {next && (
          <View style={styles.footer}>
            <ArrowButton
              direction="forward"
              onPress={() => {
                navigation.navigate('TaggPopup', {popupProps: next});
              }}
            />
          </View>
        )}
      </TouchableOpacity>
    </BlurView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: 'column',
    justifyContent: 'center',
    alignItems: 'center',
    width: '100%',
    height: '100%',
  },
  whiteColor: {
    color: 'white',
  },
  closeButton: {
    position: 'relative',
    height: '50%',
    aspectRatio: 1,
    left: '20%',
  },
  textContainer: {
    flex: 1,
    flexDirection: 'column',
  },
  icon: {
    width: 40,
    height: 40,
    marginVertical: '1%',
  },
  header: {
    color: '#fff',
    fontSize: SCREEN_WIDTH / 25,
    fontWeight: '600',
    textAlign: 'justify',
    marginBottom: '2%',
    marginLeft: '4%',
  },
  subtext: {
    color: '#fff',
    fontSize: SCREEN_WIDTH / 30,
    fontWeight: '600',
    textAlign: 'justify',
    marginBottom: '15%',
    marginLeft: '3%',
  },
  popup: {
    width: SCREEN_WIDTH * 0.8,
    height: SCREEN_WIDTH * 0.24,
    backgroundColor: 'black',
    borderRadius: 8,
    flexDirection: 'row',
    alignSelf: 'auto',
    flexWrap: 'wrap',
    position: 'absolute',
    bottom: SCREEN_HEIGHT * 0.7,
    padding: SCREEN_WIDTH / 40,
  },
  footer: {
    marginLeft: '50%',
    flexDirection: 'column-reverse',
    ...Platform.select({
      ios: {
        bottom: '20%',
      },
      android: {
        bottom: '10%',
      },
    }),
  },
});
export default TaggPopup;