コンポーネントの整理

This commit is contained in:
harukin-expo-dev-env 2024-08-31 07:57:33 +00:00
parent 09e123222f
commit 1d27a80776

View File

@ -101,9 +101,9 @@ export default function Sign(props) {
const lottieRef = useRef(); const lottieRef = useRef();
const isMatsuyama = currentStation[0].StationNumber == "Y55"; const isMatsuyama = currentStation[0].StationNumber == "Y55";
//const isMatsuyama = true; //const isMatsuyama = true;
if (isMatsuyama) {
return ( return (
<TouchableOpacity style={styleSheet.外枠} onPress={oP} onLongPress={oLP}> <TouchableOpacity style={styleSheet.外枠} onPress={oP} onLongPress={oLP}>
{isMatsuyama && (
<LottieView <LottieView
autoPlay autoPlay
loop loop
@ -112,8 +112,11 @@ export default function Sign(props) {
height: (wp("80%") / 20) * 9, height: (wp("80%") / 20) * 9,
backgroundColor: "#fff", backgroundColor: "#fff",
}} }}
source={{ uri: "https://cdn.lottielab.com/l/D4m3dmEqsjVN77.json?s" }} source={{
uri: "https://cdn.lottielab.com/l/D4m3dmEqsjVN77.json?s",
}}
/> />
)}
<StationNumberMaker <StationNumberMaker
currentStation={currentStation} currentStation={currentStation}
isMatsuyama={isMatsuyama} isMatsuyama={isMatsuyama}
@ -168,8 +171,8 @@ export default function Sign(props) {
)} )}
<Text style={styleSheet.JRStyle}>JR</Text> <Text style={styleSheet.JRStyle}>JR</Text>
<View style={styleSheet.下帯B} /> <View style={styleSheet[isMatsuyama ? "下帯B" : "下帯"]} />
<View style={styleSheet.下帯内容B}> <View style={styleSheet[isMatsuyama ? "下帯内容B" : "下帯内容"]}>
<NexPreStationLine <NexPreStationLine
preStation={preStation} preStation={preStation}
nexStation={nexStation} nexStation={nexStation}
@ -178,74 +181,6 @@ export default function Sign(props) {
</View> </View>
</TouchableOpacity> </TouchableOpacity>
); );
} else {
return (
<TouchableOpacity style={styleSheet.外枠} onPress={oP} onLongPress={oLP}>
<StationNumberMaker
currentStation={currentStation}
isMatsuyama={isMatsuyama}
/>
<StationNameArea
currentStation={currentStation}
isMatsuyama={isMatsuyama}
/>
{isCurrentStation ? (
<TouchableOpacity style={{ position: "absolute", right: 0, top: 0 }}>
<MaterialCommunityIcons
name="crosshairs-gps"
style={{ padding: 5 }}
color="#2E94BB"
size={30}
/>
</TouchableOpacity>
) : (
<TouchableOpacity
style={{ position: "absolute", right: -15, top: -20 }}
onPress={() => {
if (testButtonStatus) {
const otherData = favoriteStation.filter((d) => {
const compare = JSON.stringify(d);
const current = JSON.stringify(currentStation);
if (compare !== current) {
return true;
} else {
return false;
}
});
AS.setItem("favoriteStation", JSON.stringify(otherData));
setFavoriteStation(otherData);
} else {
let ret = favoriteStation;
ret.push(currentStation);
AS.setItem("favoriteStation", JSON.stringify(ret));
setFavoriteStation(ret);
}
setTestButtonStatus(!testButtonStatus);
}}
>
<LottieDelayView
progress={testButtonStatus ? 1 : 0}
speed={1.4}
style={{ width: 80, height: 80 }}
source={require("../../assets/939-star.json")}
lottieRef={lottieRef}
loop={false}
/>
</TouchableOpacity>
)}
<Text style={styleSheet.JRStyle}>JR</Text>
<View style={styleSheet.下帯} />
<View style={styleSheet.下帯内容}>
<NexPreStationLine
preStation={preStation}
nexStation={nexStation}
isMatsuyama={isMatsuyama}
/>
</View>
</TouchableOpacity>
);
}
} }
const LottieDelayView = ({ const LottieDelayView = ({