aboutsummaryrefslogtreecommitdiff
path: root/src/components/moments/TaggedUsersDrawer.tsx
blob: 86698d30107fae32b2f3118e0f8017f3e7ab4461 (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
import React from 'react';
import {
  ScrollView,
  StyleSheet,
  Text,
  TouchableOpacity,
  View,
} from 'react-native';
import {BottomDrawer, ProfilePreview} from '..';
import {ProfilePreviewType, ScreenType} from '../../types';
import {isIPhoneX, normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils';

interface TaggedUsersDrawerProps {
  users: ProfilePreviewType[];
  isOpen: boolean;
  setIsOpen: (open: boolean) => void;
}
const TaggedUsersDrawer: React.FC<TaggedUsersDrawerProps> = ({
  users,
  isOpen,
  setIsOpen,
}) => {
  return (
    <BottomDrawer
      initialSnapPosition={isIPhoneX() ? '35%' : '40%'}
      showHeader={false}
      isOpen={isOpen}
      setIsOpen={setIsOpen}>
      <View style={styles.mainContainer}>
        <View style={styles.headerContainer}>
          <Text style={styles.title}>Tagged Friends</Text>
        </View>
        <View style={styles.scrollViewContainer}>
          <ScrollView
            contentContainerStyle={styles.scrollView}
            horizontal
            showsHorizontalScrollIndicator={false}>
            {users.map((profilePreview) => (
              <ProfilePreview
                previewType={'Suggested People Drawer'}
                screenType={ScreenType.SuggestedPeople}
                profilePreview={profilePreview}
                setMFDrawer={setIsOpen}
              />
            ))}
          </ScrollView>
        </View>
        <TouchableOpacity
          style={styles.cancelButton}
          onPress={() => setIsOpen(false)}>
          <Text style={styles.cancelButtonText}>Cancel</Text>
        </TouchableOpacity>
      </View>
    </BottomDrawer>
  );
};

const styles = StyleSheet.create({
  mainContainer: {
    flexDirection: 'column',
    backgroundColor: '#f9f9f9',
    width: SCREEN_WIDTH,
    height: SCREEN_HEIGHT * 0.46,
    borderTopRightRadius: normalize(13),
    borderTopLeftRadius: normalize(13),
    borderWidth: 0.5,
    borderColor: '#fff',
  },
  headerContainer: {
    alignItems: 'center',
    justifyContent: 'center',
    paddingVertical: normalize(17),
    shadowOffset: {width: 0, height: 2},
    shadowRadius: 3,
    shadowColor: '#000',
    shadowOpacity: 0.15,
    backgroundColor: '#fff',
    borderTopRightRadius: normalize(13),
    borderTopLeftRadius: normalize(13),
  },
  title: {
    fontSize: normalize(18),
    lineHeight: 20,
    fontWeight: 'bold',
  },
  scrollViewContainer: {
    height: isIPhoneX() ? 153 : 135,
    shadowColor: 'rgb(125, 125, 125)',
    marginTop: '1%',
  },
  scrollView: {
    height: '95%',
    padding: 0,
    marginHorizontal: '5%',
  },
  cancelButton: {
    backgroundColor: '#F0F0F0',
    height: 100,
    flexDirection: 'row',
    justifyContent: 'center',
  },
  cancelButtonText: {
    top: isIPhoneX() ? '6%' : '7%',
    color: '#698DD3',
    fontSize: normalize(16),
    fontWeight: '700',
    lineHeight: normalize(20),
    letterSpacing: normalize(0.1),
  },
});

export default TaggedUsersDrawer;