aboutsummaryrefslogtreecommitdiff
path: root/src/screens/profile/PrivacyScreen.tsx
blob: 40e459b10cfff5ae8a69b708b81b632d93f09088 (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
import React from 'react';
import {
  SectionList,
  StatusBar,
  StyleSheet,
  View,
  SafeAreaView,
} from 'react-native';
import {useSelector} from 'react-redux';
import {RootState} from '../../store/rootReducer';
import {Background} from '../../components';
import {NO_PROFILE} from '../../store/initialStates';
import {BackgroundGradientType} from '../../types';
import {SCREEN_HEIGHT} from '../../utils/layouts';
import SettingsCell from './SettingsCell';
import {SETTINGS_DATA} from '../../constants/constants';

const PrivacyScreen: React.FC = () => {
  const {profile: {is_private} = NO_PROFILE} = useSelector(
    (state: RootState) => state.user,
  );

  return (
    <>
      <StatusBar barStyle="light-content" />
      <Background gradientType={BackgroundGradientType.Light}>
        <SafeAreaView>
          <View style={styles.container}>
            <SectionList
              sections={SETTINGS_DATA.PrivacyScreen}
              keyExtractor={(item, index) => item.title + index}
              renderItem={({item: {title, preimage, postimage}}) => (
                <SettingsCell
                  {...{title, preimage, postimage, isPrivate: is_private}}
                />
              )}
            />
          </View>
        </SafeAreaView>
      </Background>
    </>
  );
};

const styles = StyleSheet.create({
  container: {height: SCREEN_HEIGHT, marginHorizontal: '8%', marginTop: '8%'},
});

export default PrivacyScreen;