diff --git a/components/ActionSheetComponents/EachTrainInfo/ShowSpecialTrain.js b/components/ActionSheetComponents/EachTrainInfo/ShowSpecialTrain.js new file mode 100644 index 0000000..c0a82f7 --- /dev/null +++ b/components/ActionSheetComponents/EachTrainInfo/ShowSpecialTrain.js @@ -0,0 +1,36 @@ +import { Text, TouchableOpacity } from "react-native"; +import React, { useState } from "react"; +export const ShowSpecialTrain = ({ + isTrainDataNothing, + setTrainData, + trainList, + trueTrainID, +}) => { + const replaceSpecialTrainDetail = (trainNum) => { + let TD = trainList[trainNum]; + if (!TD) return; + setTrainData(TD.split("#").filter((d) => d != "")); + }; + return ( + <> + {isTrainDataNothing && trueTrainID && ( + replaceSpecialTrainDetail(trueTrainID)} + style={{ + padding: 10, + flexDirection: "row", + borderColor: "blue", + borderWidth: 1, + margin: 10, + borderRadius: 5, + alignItems: "center", + }} + > + + 本来の列車情報を表示 + + + )} + + ); +}; diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index 0752178..84956a1 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -31,6 +31,7 @@ import { migrateTrainName } from "../../lib/eachTrainInfoCoreLib/migrateTrainNam import { getType } from "../../lib/eachTrainInfoCoreLib/getType"; import { searchSpecialTrain } from "../../lib/eachTrainInfoCoreLib/searchSpecialTrain"; import { openBackTrainInfo } from "../../lib/eachTrainInfoCoreLib/openBackTrainInfo"; +import { ShowSpecialTrain } from "./EachTrainInfo/ShowSpecialTrain"; export const EachTrainInfoCore = ({ actionSheetRef, @@ -69,7 +70,6 @@ export const EachTrainInfoCore = ({ ); return () => backHandler.remove(); }, []); - //bconst insets = useSafeAreaInsets(); const [headStation, setHeadStation] = useState([]); const [tailStation, setTailStation] = useState([]); @@ -184,12 +184,6 @@ export const EachTrainInfoCore = ({ } }, [currentTrainData]); - const replaceSpecialTrainDetail = (trainNum) => { - let TD = trainList[trainNum]; - if (!TD) return; - setTrainData(TD.split("#").filter((d) => d != "")); - }; - useEffect(() => { //列車現在地アイコン表示スイッチ AS.getItem("trainPositionSwitch") @@ -229,6 +223,10 @@ export const EachTrainInfoCore = ({ }); } }; + const viewHeader = + from == "AllTrainDiagramView" || + from == "NearTrainDiagramView" || + from == "LED2"; return ( ) : ( ) : ( ) )} - {/* - ほげほげふがふが */} - {trainData.length == 0 && trueTrainID && ( - replaceSpecialTrainDetail(trueTrainID)} - style={{ - padding: 10, - flexDirection: "row", - borderColor: "blue", - borderWidth: 1, - margin: 10, - borderRadius: 5, - alignItems: "center", - }} - > - - 本来の列車情報を表示 - - - )} + {trainData.map((i, index) => i.split(",")[1] == "提" ? ( diff --git a/components/DynamicHeaderScrollView.js b/components/DynamicHeaderScrollView.js index 82b9353..6845a69 100644 --- a/components/DynamicHeaderScrollView.js +++ b/components/DynamicHeaderScrollView.js @@ -15,8 +15,6 @@ export const DynamicHeaderScrollView = (props) => { } = props; const Scroll_Distance = Max_Header_Height - Min_Header_Height; - - const [headerVisible, setHeaderVisible] = useState(false); const shotHeaderStyle = { on: { height: Min_Header_Height, @@ -67,6 +65,18 @@ export const DynamicHeaderScrollView = (props) => { }, }; + const [headerVisible, setHeaderVisible] = useState(false); + + const onScroll = (event) => { + const scrollY = event.nativeEvent.contentOffset.y; + if (Scroll_Distance < scrollY == headerVisible) return; + LayoutAnimation.configureNext({ + duration: 100, + update: { type: "easeOut" }, + }); + setHeaderVisible(Scroll_Distance < scrollY); + }; + return ( @@ -92,27 +102,12 @@ export const DynamicHeaderScrollView = (props) => { { - const scrollY = event.nativeEvent.contentOffset.y; - LayoutAnimation.configureNext({ - duration: 100, - update: { type: "easeOut" }, - }); - setHeaderVisible(Scroll_Distance < scrollY); - }} + onScroll={onScroll} > - + {topStickyContent && (