地図の設置テスト

This commit is contained in:
harukin-DeskMini
2022-07-04 20:58:58 +09:00
parent dedd8bc352
commit 6c008cf46c
6 changed files with 125 additions and 7 deletions

View File

@@ -9,10 +9,14 @@ import { Switch } from 'react-native-elements';
export default function Setting(props){
const { navigation: { navigate } } = props;
const [iconSetting, setIconSetting] = useState(undefined)
const [mapSwitch, setMapSwitch] = useState(undefined)
useEffect(()=>{
AsyncStorage.getItem("iconSwitch").then( d =>{
setIconSetting(d)
})
AsyncStorage.getItem("mapSwitch").then( d =>{
setMapSwitch(d)
})
},[])
console.log(iconSetting);
return(
@@ -35,11 +39,21 @@ export default function Setting(props){
<Text style={{fontSize:25,alignItems:"center",alignContent:"center",textAlign:"center",textAlignVertical:"center"}}>releaseChannel: {Updates.releaseChannel}</Text>
<View style={{flex:1}} />
</View>
<View style={{flexDirection:"row",padding:10}}>
<Text style={{fontSize:25,alignItems:"center",alignContent:"center",textAlign:"center",textAlignVertical:"center"}}>マップを表示する(beta)</Text>
<View style={{flex:1}} />
<Switch value={mapSwitch == "true" ? true : false} color={mapSwitch == "true" ? "red": null} onValueChange={(value)=>setMapSwitch(value.toString())}/>
</View>
</View>
</View>
<TouchableOpacity style={{padding:10,flexDirection:"row",borderColor:"white",borderWidth:1,margin:10,borderRadius:5,alignItems:"center"}} onPress={()=>{
AsyncStorage.setItem("iconSwitch",iconSetting.toString()).then(()=>{
Promise.all([
AsyncStorage.setItem("iconSwitch",iconSetting.toString()),
AsyncStorage.setItem("mapSwitch",mapSwitch.toString())
])
.then(()=>{
Updates.reloadAsync()
})
}}>