トグルスイッチの固定化
This commit is contained in:
parent
6e0943846a
commit
69f9f1279f
@ -13,6 +13,7 @@ import { checkDuplicateTrainData } from "../../lib/checkDuplicateTrainData";
|
||||
import { useCurrentTrain } from "../../stateBox/useCurrentTrain";
|
||||
import { useAreaInfo } from "../../stateBox/useAreaInfo";
|
||||
import { SheetManager } from "react-native-actions-sheet";
|
||||
import { AS } from "../../storageControl";
|
||||
|
||||
/**
|
||||
*
|
||||
@ -59,6 +60,31 @@ export default function LED_vision(props) {
|
||||
const [trainDescriptionSwitch, setTrainDescriptionSwitch] = useState(false);
|
||||
const { areaInfo } = useAreaInfo();
|
||||
|
||||
useEffect(() => {
|
||||
AS.getItem("LEDSettings/trainIDSwitch").then((data) => {
|
||||
console.log(data);
|
||||
if (data == "true") {
|
||||
setTrainIDSwitch(true);
|
||||
} else {
|
||||
setTrainIDSwitch(false);
|
||||
}
|
||||
});
|
||||
AS.getItem("LEDSettings/trainDescriptionSwitch").then((data) => {
|
||||
if (data == "true") {
|
||||
setTrainDescriptionSwitch(true);
|
||||
} else {
|
||||
setTrainDescriptionSwitch(false);
|
||||
}
|
||||
});
|
||||
AS.getItem("LEDSettings/finalSwitch").then((data) => {
|
||||
if (data == "true") {
|
||||
setFinalSwitch(true);
|
||||
} else {
|
||||
setFinalSwitch(false);
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// 現在の駅に停車するダイヤを作成する副作用[列車ダイヤと現在駅情報]
|
||||
if (!trainDiagram) {
|
||||
@ -288,16 +314,31 @@ const Footer = (props) => {
|
||||
return (
|
||||
<View style={{ flexDirection: "row", padding: 10, alignItems: "center" }}>
|
||||
<Text style={textStyle}>種別名 / 列番</Text>
|
||||
<Switch value={trainIDSwitch} onValueChange={setTrainIDSwitch} />
|
||||
<Switch
|
||||
value={trainIDSwitch}
|
||||
onValueChange={(value) => {
|
||||
AS.setItem("LEDSettings/trainIDSwitch", value.toString());
|
||||
setTrainIDSwitch(value);
|
||||
}}
|
||||
/>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text style={textStyle}>列車情報</Text>
|
||||
<Switch
|
||||
value={trainDescriptionSwitch}
|
||||
onValueChange={setTrainDescriptionSwitch}
|
||||
onValueChange={(value) => {
|
||||
AS.setItem("LEDSettings/trainDescriptionSwitch", value.toString());
|
||||
setTrainDescriptionSwitch(value);
|
||||
}}
|
||||
/>
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text style={textStyle}>当駅止表示</Text>
|
||||
<Switch value={finalSwitch} onValueChange={setFinalSwitch} />
|
||||
<Switch
|
||||
value={finalSwitch}
|
||||
onValueChange={(value) => {
|
||||
AS.setItem("LEDSettings/finalSwitch", value.toString());
|
||||
setFinalSwitch(value);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user