Untitled
unknown
plain_text
a year ago
2.7 kB
6
Indexable
Never
import React, { useEffect, useState } from 'react'; import { Switch, Text, View, Button, Colors } from 'react-native-ui-lib'; import { useReportBack } from '../../context'; import { GoogleSignin } from '@react-native-google-signin/google-signin'; import { firebase } from '@react-native-firebase/auth'; import CompanyPicker from '../../components/CompanyPicker'; import CodePush from 'react-native-code-push'; import Icon from 'react-native-vector-icons/FontAwesome5'; import { TouchableOpacity } from 'react-native-gesture-handler'; const data = [ { icon: 'user-edit', title: 'Edit Profile' }, { icon: 'user-friends', title: 'Select your peers' }, { icon: 'share', title: 'Connect your business' }, { icon: 'credit-card', title: 'View subscription' }, { icon: 'undo', title: 'Update data in feed' }, { icon: 'user-plus', title: 'Share with others' }, { icon: 'user-shield', title: 'Change your password' } ] export function SettingsDashboardScreen() { const [version, setVersion] = useState('v1.0.1'); useEffect(() => { const getversion = async () => { const md: any = await CodePush.getUpdateMetadata(); setVersion(`v${md.appVersion}-${md.label}`); }; getversion(); }, []); const { store: { theme, setTheme, logout }, } = useReportBack(); return ( <View flex padding-16 backgroundColor={Colors.$backgroundGeneralDark}> <View marginB-50 center marginT-10 row spread> <CompanyPicker /> </View> { data.map((value, index) => ( <View> <TouchableOpacity> <View row margin-10> <View center paddingR-10> <Icon color={Colors.grey30} name={value.icon} size={20} /> </View> <View flex-1> <Text grey30 text50BO>{value.title}</Text> </View> </View> </TouchableOpacity> </View> )) } <View marginT-20 row spread> <Text grey30 text50BO> {' '} Dark Theme{' '} </Text> <Switch value={theme === 'dark'} onValueChange={() => setTheme(theme === 'dark' ? 'light' : 'dark')} /> </View> <View flex-1 marginT-50> <Button label="Logout" labelStyle={{fontSize: 20}} backgroundColor={Colors.orange40} onPress={() => { firebase.auth().signOut(); GoogleSignin.signOut(); logout(); }} /> </View> {/* <View marginT-50> <Text>{version}</Text> </View> */} </View> ); }