aboutsummaryrefslogtreecommitdiff
path: root/src/screens/onboarding/SocialMedia.tsx
blob: 2a978f94d5fd4ebaaffa6c58ffd88bed3773397d (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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import {RouteProp} from '@react-navigation/native';
import {StackNavigationProp} from '@react-navigation/stack';
import React from 'react';
import {
  KeyboardAvoidingView,
  Platform,
  StatusBar,
  StyleSheet,
  Text,
  TouchableOpacity,
  View,
} from 'react-native';
import {useDispatch} from 'react-redux';
import {
  BackgroundGradientType,
  CategorySelectionScreenType,
  LinkerType,
} from '../..//types';
import {
  Background,
  LinkSocialMedia,
  RegistrationWizard,
} from '../../components';
import {SOCIAL_LIST, MOMENT_CATEGORIES} from '../../constants/';
import {OnboardingStackParams} from '../../routes';

/**
 * Social Media Screen for displaying social media linkers
 */

type SocialMediaRouteProps = RouteProp<OnboardingStackParams, 'SocialMedia'>;

type SocialMediaNavigationProps = StackNavigationProp<
  OnboardingStackParams,
  'SocialMedia'
>;

interface SocialMediaProps {
  route: SocialMediaRouteProps;
  navigation: SocialMediaNavigationProps;
}

const SocialMedia: React.FC<SocialMediaProps> = ({route, navigation}) => {
  const {userId, username} = route.params;
  const linkers: Array<LinkerType> = [];

  //   let numSocials: Number = state.showMore ? 9 : 3;

  for (let i = 0; i < SOCIAL_LIST.length; i++) {
    let linker: LinkerType = {
      label: SOCIAL_LIST[i],
    };
    linkers.push(linker);
  }

  /**
   * Just commenting this out, in case we need it in the future
   */
  //   const handleShowPress = () => {
  //     setState({
  //       ...state,
  //       showMore: !state.showMore,
  //     });
  //   };

  const handleNext = () => {
    navigation.navigate('CategorySelection', {
      screenType: CategorySelectionScreenType.Onboarding,
      user: {userId: userId, username: username},
      newCustomCategory: undefined,
    });
  };

  return (
    <Background
      style={styles.container}
      gradientType={BackgroundGradientType.Light}>
      <StatusBar barStyle="light-content" />
      <KeyboardAvoidingView
        behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
        style={styles.container}>
        <RegistrationWizard style={styles.wizard} step="seven" />
        <View style={styles.headerContainer}>
          <Text style={styles.header}>SOCIAL MEDIA</Text>
          <Text style={styles.subtext}>
            Select the social media you want to add
          </Text>
        </View>
        <View style={styles.linkerContainer}>
          {linkers.map((linker, index) => (
            <LinkSocialMedia key={index} social={linker} />
          ))}
        </View>
      </KeyboardAvoidingView>
      <TouchableOpacity onPress={handleNext} style={styles.nextButton}>
        <Text style={styles.nextButtonLabel}>Next</Text>
      </TouchableOpacity>
    </Background>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'space-around',
  },
  headerContainer: {
    marginTop: '28%',
  },
  wizard: {
    ...Platform.select({
      ios: {
        top: 50,
      },
      android: {
        bottom: 40,
      },
    }),
  },
  linkerContainer: {
    bottom: '15%',
    flexDirection: 'row',
    flexWrap: 'wrap',
    justifyContent: 'center',
    alignContent: 'center',
    marginBottom: '10%',
  },
  header: {
    color: '#fff',
    fontSize: 22,
    fontWeight: '600',
    textAlign: 'center',
    marginBottom: '4%',
  },
  subtext: {
    color: '#fff',
    fontSize: 14,
    fontWeight: '600',
    textAlign: 'center',
    marginBottom: '35%',
    marginHorizontal: '10%',
  },
  nextButton: {
    backgroundColor: '#8F01FF',
    justifyContent: 'center',
    alignItems: 'center',
    width: 150,
    height: 40,
    borderRadius: 5,
    borderWidth: 1,
    borderColor: '#8F01FF',
    marginBottom: '15%',
  },
  nextButtonLabel: {
    fontSize: 16,
    fontWeight: '500',
    color: '#ddd',
  },
});

export default SocialMedia;