From d92c082086d380d4db69f6bbebccfd2a287bb037 Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Sun, 13 Sep 2020 11:25:28 +0500 Subject: [PATCH] some refactoring --- apps/mobile/src/views/Settings/index.js | 417 +++++++----------------- 1 file changed, 124 insertions(+), 293 deletions(-) diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js index 12359b191..d9ecf4914 100644 --- a/apps/mobile/src/views/Settings/index.js +++ b/apps/mobile/src/views/Settings/index.js @@ -1,6 +1,7 @@ import {useIsFocused} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; import { + Appearance, Clipboard, Linking, Modal, @@ -10,11 +11,8 @@ import { Text, TouchableOpacity, View, - Appearance, - Pressable, } from 'react-native'; import * as Animatable from 'react-native-animatable'; - import QRCode from 'react-native-qrcode-generator'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import { @@ -29,24 +27,24 @@ import { SIZE, WEIGHT, } from '../../common/common'; +import {PressableButton} from '../../components/PressableButton'; +import Seperator from '../../components/Seperator'; import {Toast} from '../../components/Toast'; import {useTracked} from '../../provider'; import {ACTIONS} from '../../provider/actions'; import {eSendEvent} from '../../services/eventManager'; import {eOpenLoginDialog, eResetApp} from '../../services/events'; import NavigationService from '../../services/NavigationService'; +import {MMKV} from '../../utils/storage'; import { db, DDS, + hexToRGBA, + RGB_Linear_Shade, setSetting, ToastEvent, w, - RGB_Linear_Shade, - hexToRGBA, } from '../../utils/utils'; -import {MMKV} from '../../utils/storage'; -import {PressableButton} from '../../components/PressableButton'; -import Seperator from '../../components/Seperator'; export const Settings = ({route, navigation}) => { const [state, dispatch] = useTracked(); @@ -112,6 +110,60 @@ export const Settings = ({route, navigation}) => { } }, [isFocused]); + const SectionHeader = ({title}) => ( + + {title} + + ); + + const Button = ({title, tagline, customComponent, onPress, key}) => ( + + + {title} + {tagline ? '\n' : null} + + + {tagline} + + + {customComponent ? customComponent : null} + + ); + return ( { }}> {user ? ( <> - - Account Settings - + { }, }, ].map((item) => ( - - - {item.name} - - +