diff options
Diffstat (limited to 'src/screens/profile/PrivacyScreen.tsx')
-rw-r--r-- | src/screens/profile/PrivacyScreen.tsx | 124 |
1 files changed, 12 insertions, 112 deletions
diff --git a/src/screens/profile/PrivacyScreen.tsx b/src/screens/profile/PrivacyScreen.tsx index 37f042af..d91c7841 100644 --- a/src/screens/profile/PrivacyScreen.tsx +++ b/src/screens/profile/PrivacyScreen.tsx @@ -1,114 +1,40 @@ import {useNavigation} from '@react-navigation/core'; import React from 'react'; import { - Image, SectionList, StatusBar, StyleSheet, - Text, - TouchableOpacity, View, + SafeAreaView, } from 'react-native'; -import {SafeAreaView} from 'react-native-safe-area-context'; import {useSelector} from 'react-redux'; import {RootState} from 'src/store/rootReducer'; import {Background} from '../../components'; import {NO_PROFILE} from '../../store/initialStates'; import {BackgroundGradientType} from '../../types'; -import {normalize, SCREEN_WIDTH} from '../../utils/layouts'; - -const DATA = [ - { - title: '', - data: [ - { - title: 'Account Type', - preimage: require('../../assets/images/settings/lock-white.png'), - postimage: require('../../assets/images/settings/white-arrow.png'), - }, - { - title: 'Blocked Accounts', - preimage: require('../../assets/images/settings/blocked-white.png'), - postimage: require('../../assets/images/settings/white-arrow.png'), - }, - ], - }, -]; +import {normalize} from '../../utils/layouts'; +import SettingsCell from './SettingsCell'; +import {SETTINGS_DATA} from '../../constants/constants'; const PrivacyScreen: React.FC = () => { - const navigation = useNavigation(); const {profile: {is_private} = NO_PROFILE} = useSelector( (state: RootState) => state.user, ); - const getActions = (type: string) => { - switch (type) { - case 'Account Type': - navigateTo('AccountTypeScreen', {}); - break; - case 'Blocked Accounts': - navigateTo('Blocked Accounts', {}); - break; - default: - break; - } - }; - - const navigateTo = (screen: string, options: object) => { - navigation.navigate(screen, options); - }; - - const Item = ({ - title, - preimage, - postimage, - }: { - title: string; - preimage: number; - postimage: number; - }) => ( - <TouchableOpacity onPress={() => getActions(title)} style={styles.item}> - <Image - resizeMode={'cover'} - style={{width: SCREEN_WIDTH * 0.05, height: SCREEN_WIDTH * 0.05}} - source={preimage} - /> - <View style={{marginLeft: 40}}> - <Text style={styles.title}>{title}</Text> - </View> - <View style={[styles.item, {position: 'absolute', right: 0}]}> - {title === 'Account Type' && ( - <Text style={[styles.title, {color: '#C4C4C4', marginRight: 13}]}> - {is_private ? 'Private' : 'Public'} - </Text> - )} - <Image style={{width: 15, height: 15}} source={postimage} /> - </View> - </TouchableOpacity> - ); - return ( <> <StatusBar barStyle="light-content" /> <Background gradientType={BackgroundGradientType.Light}> <SafeAreaView> - <View style={{marginLeft: 28, marginRight: 43}}> + <View style={styles.container}> <SectionList - sections={DATA} + sections={SETTINGS_DATA.PrivacyScreen} keyExtractor={(item, index) => item.title + index} - renderItem={({item: {title, preimage, postimage}}) => { - return <Item {...{title, preimage, postimage}} />; - }} - renderSectionHeader={({section: {title}}) => { - if (title.length === 0) { - return null; - } - return ( - <View style={{marginTop: 46}}> - <Text style={styles.header}>{title}</Text> - </View> - ); - }} + renderItem={({item: {title, preimage, postimage}}) => ( + <SettingsCell + {...{title, preimage, postimage, isPrivate: is_private}} + /> + )} /> </View> </SafeAreaView> @@ -118,33 +44,7 @@ const PrivacyScreen: React.FC = () => { }; const styles = StyleSheet.create({ - container: { - flex: 1, - }, - item: { - marginTop: 36, - flexDirection: 'row', - justifyContent: 'flex-start', - alignItems: 'center', - }, - header: { - fontSize: normalize(18), - fontWeight: '600', - lineHeight: normalize(21.48), - color: '#E9E9E9', - }, - title: { - fontSize: normalize(15), - fontWeight: '600', - lineHeight: normalize(17.9), - color: 'white', - }, - logoutStyle: { - fontSize: normalize(20), - fontWeight: '600', - lineHeight: normalize(23.87), - color: 'white', - }, + container: {marginHorizontal: '8%', marginTop: '8%'}, }); export default PrivacyScreen; |