@ -5,10 +5,6 @@ import stylesScreen from './style/screens.style';
import styles from './style/Settings.style' ;
import styles from './style/Settings.style' ;
import { TopBar } from '../components/TopBar' ;
import { TopBar } from '../components/TopBar' ;
import { ButtonGreySmall } from '../components/ButtonGreySmall' ;
import { ButtonGreySmall } from '../components/ButtonGreySmall' ;
import { useDispatch , useSelector } from 'react-redux' ;
import { RootState } from '../redux/store' ;
import Dialog from "react-native-dialog"
import RNPickerSelect from "react-native-picker-select" ;
import { PickerGreySmall } from '../components/PickerGreySmall' ;
import { PickerGreySmall } from '../components/PickerGreySmall' ;
import { useUserStore } from '../context/userContext' ;
import { useUserStore } from '../context/userContext' ;
import DialogInput from 'react-native-dialog-input' ;
import DialogInput from 'react-native-dialog-input' ;
@ -17,6 +13,7 @@ import { MANAGER_USER } from '../../appManagers';
function Settings ( props : { navigation : any ; } ) {
function Settings ( props : { navigation : any ; } ) {
const { navigation } = props
const { navigation } = props
const setUser = useUserStore ( ( state ) = > state . setUser ) ;
const setUser = useUserStore ( ( state ) = > state . setUser ) ;
@ -51,7 +48,7 @@ function Settings(props: { navigation: any; }) {
async function changeSexe ( sexe :string ) {
async function changeSexe ( sexe :string ) {
let userManager = new UserModificationManager ( ) ;
let userManager = new UserModificationManager ( ) ;
let tmp = MANAGER_USER . getCurrentUser ( ) ;
let tmp = MANAGER_USER . getCurrentUser ( ) ;
if ( tmp != null ) {
if ( tmp != null && sexe != null ) {
await userManager . changeSexe ( tmp , sexe ) ;
await userManager . changeSexe ( tmp , sexe ) ;
setUser ( tmp ) ;
setUser ( tmp ) ;
MANAGER_USER . setCurrentUser ( tmp ) ;
MANAGER_USER . setCurrentUser ( tmp ) ;
@ -61,7 +58,7 @@ function Settings(props: { navigation: any; }) {
async function changeNationality ( nationality :string ) {
async function changeNationality ( nationality :string ) {
let userManager = new UserModificationManager ( ) ;
let userManager = new UserModificationManager ( ) ;
let tmp = MANAGER_USER . getCurrentUser ( ) ;
let tmp = MANAGER_USER . getCurrentUser ( ) ;
if ( tmp != null ) {
if ( tmp != null && nationality != null ) {
await userManager . changeNationality ( tmp , nationality ) ;
await userManager . changeNationality ( tmp , nationality ) ;
setUser ( tmp ) ;
setUser ( tmp ) ;
MANAGER_USER . setCurrentUser ( tmp ) ;
MANAGER_USER . setCurrentUser ( tmp ) ;
@ -91,11 +88,11 @@ function Settings(props: { navigation: any; }) {
< / View >
< / View >
< View >
< View >
< Text style = { styles . text } > Nationalit é : { useUserStore ( ) . user ? . getNationality ( ) } < / Text >
< Text style = { styles . text } > Nationalit é : { useUserStore ( ) . user ? . getNationality ( ) } < / Text >
< PickerGreySmall title = ' Changer la nationalité ' valueChange = { ( value :string ) = > setSelectedNationality ( value ) } donePress = { ( ) = > changeNationality ( selectedNationality ) } values = { [ "Francais" , "Anglais" ] } / >
< PickerGreySmall title = ' Selectionner un pays ' valueChange = { ( value :string ) = > setSelectedNationality ( value ) } donePress = { ( ) = > changeNationality ( selectedNationality ) } values = { [ { label : 'France' , value : 'Francais(e)' } , { label : 'Royaume-Uni' , value : 'Anglais(e)' } , { label : 'Espagne' , value : 'Espagnol(e)' } , { label : 'Belgique' , value : 'Belge' } , { label : 'Allemagne' , value : 'Allemand(e)' } , ] } / >
< / View >
< / View >
< View >
< View >
< Text style = { styles . text } > Sexe : { useUserStore ( ) . user ? . getSexe ( ) } < / Text >
< Text style = { styles . text } > Sexe : { useUserStore ( ) . user ? . getSexe ( ) } < / Text >
< PickerGreySmall title = ' Chang er le sexe' valueChange = { ( value :string ) = > setSelectedSex ( value ) } donePress = { ( ) = > changeSexe ( selectedSex ) } values = { [ "Homme" , "Femme" , "Autre" ] } / >
< PickerGreySmall title = ' Selectionn er le sexe' valueChange = { ( value :string ) = > setSelectedSex ( value ) } donePress = { ( ) = > changeSexe ( selectedSex ) } values = { [ { label : 'Homme' , value : 'Homme' } , { label : 'Femme' , value : 'Femme' } , { label : 'Autre' , value : 'Autre' } ] } / >
< / View >
< / View >
< / View >
< / View >
< Text style = { styles . textID } > ID : { useUserStore ( ) . user ? . getId ( ) } < / Text >
< Text style = { styles . textID } > ID : { useUserStore ( ) . user ? . getId ( ) } < / Text >