From cb76c2f6df5956fcf043ea9ecce82b43f462eeee Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Sun, 23 Feb 2020 10:22:55 +0500 Subject: [PATCH] fix settings --- apps/mobile/src/views/Notes/index.js | 30 ++-- apps/mobile/src/views/Settings/index.js | 191 ++++++++++++------------ 2 files changed, 113 insertions(+), 108 deletions(-) diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.js index f025ae5b1..c00787de7 100644 --- a/apps/mobile/src/views/Notes/index.js +++ b/apps/mobile/src/views/Notes/index.js @@ -152,6 +152,21 @@ export const Notes = ({navigation}) => { ); + const _onRefresh = async () => { + setRefreshing(true); + try { + await db.sync(); + + init(); + dispatch({type: ACTIONS.USER}); + setRefreshing(false); + ToastEvent.show('Sync Complete', 'success'); + } catch (e) { + setRefreshing(false); + ToastEvent.show('Sync failed, network error', 'error'); + } + }; + const _listKeyExtractor = (item, index) => item.dateCreated.toString(); return ( @@ -177,20 +192,7 @@ export const Notes = ({navigation}) => { tintColor={colors.accent} colors={[colors.accent]} progressViewOffset={165} - onRefresh={async () => { - setRefreshing(true); - try { - await db.sync(); - - init(); - dispatch({type: ACTIONS.USER}); - setRefreshing(false); - ToastEvent.show('Sync Complete', 'success'); - } catch (e) { - setRefreshing(false); - ToastEvent.show('Sync failed, network error', 'error'); - } - }} + onRefresh={_onRefresh} refreshing={refreshing} /> } diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js index ac0741861..0a7f82567 100644 --- a/apps/mobile/src/views/Settings/index.js +++ b/apps/mobile/src/views/Settings/index.js @@ -96,6 +96,7 @@ export const Settings = ({navigation}) => { borderRadius: 5, padding: 5, marginTop: 10, + marginBottom: pv + 5, width: '100%', alignSelf: 'center', flexDirection: 'row', @@ -228,7 +229,7 @@ export const Settings = ({navigation}) => { alignItems: 'center', justifyContent: 'space-between', - paddingBottom: pv + 5, + paddingVertical: pv + 5, }}> { Account Settings - - Logged in as: - - {user ? ( - - - - - {user.username} - - {' '} - - - Pro - - - - ) : null} - - {[ - { - name: 'Backup my notes', - }, - - { - name: 'My vault', - }, - { - name: 'Subscription status', - }, - { - name: 'Change password', - }, - { - name: 'Logout', - }, - ].map(item => ( - + <> - {item.name} + Logged in as: - - ))} + + + + + + {user.username} + + + + + Pro + + + + + {[ + { + name: 'Backup my notes', + }, + + { + name: 'My vault', + }, + { + name: 'Subscription status', + }, + { + name: 'Change password', + }, + { + name: 'Logout', + }, + ].map(item => ( + + + {item.name} + + + ))} + + ) : null}