used ElementList in the PrivacyView and using the dedicated file

This commit is contained in:
Clément Le Bihan
2023-04-10 23:12:18 +02:00
parent 4ec8878e8a
commit 8ce1beb518
3 changed files with 48 additions and 51 deletions

View File

@@ -34,7 +34,7 @@ const NotificationsView = ({ navigation }) => {
<ElementList
style={{
marginTop: 20,
width: "100%",
width: "90%",
maxWidth: 850,
}}
elements={[

View File

@@ -1,31 +1,52 @@
import React from "react";
import { View } from 'react-native';
import { View } from "react-native";
import { Center, Button, Text, Switch, Heading } from "native-base";
import { translate } from "../../i18n/i18n";
import ElementList from "../../components/GtkUI/ElementList";
const PrivacyView = ({navigation}) => {
return (
<Center style={{ flex: 1}}>
<Heading style={{ textAlign: "center" }}>{ translate('privBtn')}</Heading>
const PrivacyView = ({ navigation }) => {
const [dataCollection, setDataCollection] = React.useState(false);
const [customAds, setCustomAds] = React.useState(false);
const [recommendations, setRecommendations] = React.useState(false);
return (
<Center style={{ flex: 1 }}>
<Heading style={{ textAlign: "center" }}>{translate("privBtn")}</Heading>
<Button variant='outline' onPress={() => navigation.navigate('Settings')} style={{ margin: 10 }}>{ translate('backBtn') }</Button>
<ElementList
style={{
marginTop: 20,
width: "90%",
maxWidth: 850,
}}
elements={[
{
type: "toggle",
title: translate("dataCollection"),
data: {
value: dataCollection,
onToggle: () => setDataCollection(!dataCollection),
},
},
{
type: "toggle",
title: translate("customAds"),
data: {
value: customAds,
onToggle: () => setCustomAds(!customAds),
},
},
{
type: "toggle",
title: translate("recommendations"),
data: {
value: recommendations,
onToggle: () => setRecommendations(!recommendations),
},
},
]}
/>
</Center>
);
};
<View style={{margin: 20}} >
<Text style={{ textAlign: "center" }}>Data Collection</Text>
<Switch style={{ alignSelf: 'center', margin: 10 }} colorScheme="primary"/>
</View>
<View style={{margin: 20}}>
<Text style={{ textAlign: "center" }}>Custom Adds</Text>
<Switch style={{ alignSelf: 'center', margin: 10 }} colorScheme="primary"/>
</View>
<View style={{margin: 20}}>
<Text style={{ textAlign: "center" }}>Recommendations</Text>
<Switch style={{ alignSelf: 'center', margin: 10 }} colorScheme="primary"/>
</View>
</Center>
)
}
export default PrivacyView;
export default PrivacyView;

View File

@@ -15,6 +15,7 @@ import ChangePasswordForm from '../../components/forms/changePasswordForm';
import ChangeEmailForm from '../../components/forms/changeEmailForm';
import ProfileSettings from './SettingsProfileView';
import NotificationsView from './NotificationView';
import PrivacyView from './PrivacyView';
import API, { APIError } from '../../API';
@@ -159,31 +160,6 @@ export const PreferencesView = ({navigation}) => {
)
}
export const PrivacyView = ({navigation}) => {
return (
<Center style={{ flex: 1}}>
<Heading style={{ textAlign: "center" }}>
<Translate translationKey='privBtn'/>
</Heading>
<View style={{margin: 20}} >
<Text style={{ textAlign: "center" }}>Data Collection</Text>
<Switch style={{ alignSelf: 'center', margin: 10 }} colorScheme="primary"/>
</View>
<View style={{margin: 20}}>
<Text style={{ textAlign: "center" }}>Custom Adds</Text>
<Switch style={{ alignSelf: 'center', margin: 10 }} colorScheme="primary"/>
</View>
<View style={{margin: 20}}>
<Text style={{ textAlign: "center" }}>Recommendations</Text>
<Switch style={{ alignSelf: 'center', margin: 10 }} colorScheme="primary"/>
</View>
</Center>
)
}
export const ChangePasswordView = ({navigation}) => {
return (
<Center style={{ flex: 1}}>