aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/SocialLinkModal.tsx
blob: 8544515549114248a3f130f1e2a9c3736b3dc834 (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
import React from 'react';
import {TouchableOpacity} from 'react-native';
import {Modal, StyleSheet, Text, TouchableHighlight, View, ViewProps} from 'react-native';
import {TextInput} from 'react-native-gesture-handler';
import { TAGG_LIGHT_BLUE } from '../../constants';
import {SCREEN_WIDTH} from '../../utils';
import CloseIcon from '../../assets/ionicons/close-outline.svg';

interface SocialLinkModalProps {
  modalVisible: boolean;
  setModalVisible: (_: boolean) => void;
  completionCallback: (username: string) => void;
  close: () => void;
}

const SocialLinkModal: React.FC<SocialLinkModalProps> = ({
  modalVisible,
  setModalVisible,
  close,
  completionCallback,
}) => {
  const [username, setUsername] = React.useState('');
  return (
    <>
      <View style={styles.centeredView}>
        <Modal
          animationType="slide"
          transparent={true}
          visible={modalVisible}
          onRequestClose={() => {}}>
          <View style={styles.centeredView}>
            <View style={styles.modalView}>
              <Text>
                Insert your snapchat username to link your snapchat account to your profile!
              </Text>
              <TextInput
                autoCapitalize={'none'}
                autoCorrect={false}
                textAlign={'center'}
                placeholder={'Username'}
                style={styles.textInput}
                onChangeText={setUsername}
                value={username}
              />
              {/* link button */}
              <TouchableHighlight
                style={styles.openButton}
                onPress={() => {
                  setModalVisible(!modalVisible);
                  setUsername('');
                  completionCallback(username);
                }}>
                <Text style={styles.textStyle}>Submit</Text>
              </TouchableHighlight>
              {/* cancel button */}
              <TouchableOpacity style={styles.closeButton} onPress={close}>
                <CloseIcon height={'100%'} width={'100%'} color={'white'} />
              </TouchableOpacity>
              {/* <Text
                onPress={() => {
                  setUsername('');
                  setModalVisible(!modalVisible);
                }}
                style={styles.cancelStyle}>
                Cancel
              </Text> */}
            </View>
          </View>
        </Modal>
      </View>
    </>
  );
};

const styles = StyleSheet.create({
  centeredView: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    marginTop: 22,
  },
  modalView: {
    width: (SCREEN_WIDTH * 2) / 3,
    margin: 20,
    backgroundColor: 'white',
    borderRadius: 20,
    padding: 35,
    alignItems: 'center',
    shadowColor: '#000',
    shadowOffset: {
      width: 0,
      height: 2,
    },
    shadowOpacity: 0.25,
    shadowRadius: 3.84,
    elevation: 5,
  },
  openButton: {
    borderRadius: 20,
    padding: 10,
    elevation: 2,
    backgroundColor: '#2196F3',
  },
  textStyle: {
    color: 'white',
    fontWeight: 'bold',
    textAlign: 'center',
  },
  closeButton: {
    position: 'absolute',
    height: '50%',
    aspectRatio: 1,
    left: '3%',
  },
  // cancelStyle: {
  //   position: 'absolute',
  //   height: 17,
  //   // fontStyle: 'normal',
  //   // fontWeight: '500',
  //   // fontSize: 14,
  //   /* identical to box height */
  //   left: '3%',
  //   // textAlign: 'center',
  //   // color: TAGG_LIGHT_BLUE,
  // },
  textInput: {
    height: 20,
    width: '75%',
    borderBottomWidth: 0.4,
    borderBottomColor: '#C4C4C4',
    marginBottom: 20,
  },
});

export default SocialLinkModal;