import React, { useContext, useEffect, useState } from 'react';
import { ScrollView, Platform, TouchableWithoutFeedback, TouchableOpacity, StyleSheet } from 'react-native';
import navigationStyle from '../../components/navigationStyle';
import { BlueLoading, BlueText, BlueSpacing20, BlueListItem, BlueCard } from '../../BlueComponents';
import { useNavigation, useTheme } from '@react-navigation/native';
import loc from '../../loc';
import { BlueStorageContext } from '../../blue_modules/storage-context';
const styles = StyleSheet.create({
root: {
flex: 1,
},
});
const GeneralSettings = () => {
const { isAdancedModeEnabled, setIsAdancedModeEnabled, wallets, isHandOffUseEnabled, setIsHandOffUseEnabledAsyncStorage } = useContext(
BlueStorageContext,
);
const [isLoading, setIsLoading] = useState(true);
const [isAdancedModeSwitchEnabled, setIsAdancedModeSwitchEnabled] = useState(false);
const { navigate } = useNavigation();
const { colors } = useTheme();
const onAdvancedModeSwitch = async value => {
await setIsAdancedModeEnabled(value);
setIsAdancedModeSwitchEnabled(value);
};
useEffect(() => {
(async () => {
setIsAdancedModeSwitchEnabled(await isAdancedModeEnabled());
setIsLoading(false);
})();
});
const navigateToPrivacy = () => {
navigate('SettingsPrivacy');
};
const stylesWithThemeHook = {
root: {
...styles.root,
backgroundColor: colors.background,
},
scroll: {
...styles.scroll,
backgroundColor: colors.background,
},
scrollBody: {
...styles.scrollBody,
backgroundColor: colors.background,
},
};
return isLoading ? (
) : (
{wallets.length > 1 && (
<>
navigate('DefaultView')} title={loc.settings.default_title} chevron />
>
)}
{Platform.OS === 'ios' ? (
<>
{loc.settings.general_continuity_e}
>
) : null}
{loc.settings.general_adv_mode_e}
);
};
GeneralSettings.navigationOptions = navigationStyle({}, opts => ({ ...opts, title: loc.settings.general }));
export default GeneralSettings;