1- import React from "react" ;
1+ import React , { useEffect , useState } from "react" ;
22import { View , StyleSheet , Modal , TouchableOpacity , ScrollView , useWindowDimensions } from "react-native" ;
33import SettingItem from "./setting-item" ;
44import Bell from "@assets/svg/icon/Bell" ;
@@ -11,14 +11,24 @@ import { useBottomSheet } from "@/context/BottomSheetContext";
1111import { DrugsBottomSheet } from "@/components/DrugsBottomSheet" ;
1212import localStorage from "@/utils/localStorage" ;
1313import logEvents from "@/services/logEvents" ;
14+ import AsyncStorage from "@react-native-async-storage/async-storage" ;
15+ import { useFocusEffect } from "@react-navigation/native" ;
1416
1517const SettingsModal = ( { navigation, visible, onClick } ) => {
1618 const { showBottomSheet, closeBottomSheet } = useBottomSheet ( ) ;
1719 const { width, height } = useWindowDimensions ( ) ;
1820 const isLandscape = width > height ;
19-
2021 const ContentWrapper = isLandscape ? ScrollView : View ;
2122
23+ const [ isDevMode , setIsDevMode ] = useState ( false ) ;
24+
25+ useFocusEffect ( ( ) => {
26+ ( async ( ) => {
27+ const devMode = await AsyncStorage . getItem ( "devMode" ) ;
28+ setIsDevMode ( devMode === "true" ) ;
29+ } ) ( ) ;
30+ } ) ;
31+
2232 return (
2333 < Modal animationType = "slide" visible = { visible } transparent = { true } supportedOrientations = { [ "portrait" , "landscape" ] } >
2434 < TouchableOpacity activeOpacity = { 1 } style = { styles . container } onPressOut = { onClick } >
@@ -84,16 +94,18 @@ const SettingsModal = ({ navigation, visible, onClick }) => {
8494 } }
8595 icon = { < Download /> }
8696 />
87- < SettingItem
88- title = "Sauvegarder mes données"
89- path = "data-export-import"
90- navigation = { navigation }
91- onClick = { ( ) => {
92- onClick ( ) ;
93- logEvents . logOpenExportSummary ( ) ;
94- } }
95- icon = { < Save /> }
96- />
97+ { isDevMode && (
98+ < SettingItem
99+ title = "Sauvegarder mes données"
100+ path = "data-export-import"
101+ navigation = { navigation }
102+ onClick = { ( ) => {
103+ onClick ( ) ;
104+ logEvents . logOpenExportSummary ( ) ;
105+ } }
106+ icon = { < Save /> }
107+ />
108+ ) }
97109 </ ContentWrapper >
98110 </ TouchableOpacity >
99111 </ Modal >
0 commit comments