menuに新しい概念を作成
This commit is contained in:
parent
49ed69d541
commit
fdacc00f93
34
menu.js
34
menu.js
@ -8,7 +8,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
LayoutAnimation,
|
LayoutAnimation,
|
||||||
Dimensions,
|
useWindowDimensions,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import Constants from "expo-constants";
|
import Constants from "expo-constants";
|
||||||
import * as Location from "expo-location";
|
import * as Location from "expo-location";
|
||||||
@ -42,6 +42,16 @@ export default function Menu({ getCurrentTrain }) {
|
|||||||
const { navigate } = useNavigation();
|
const { navigate } = useNavigation();
|
||||||
const { favoriteStation } = useFavoriteStation();
|
const { favoriteStation } = useFavoriteStation();
|
||||||
const { originalStationList } = useStationList();
|
const { originalStationList } = useStationList();
|
||||||
|
const { height, width } = useWindowDimensions();
|
||||||
|
const scrollRef = useRef(null);
|
||||||
|
useEffect(() => {
|
||||||
|
if (scrollRef.current) {
|
||||||
|
scrollRef.current.scrollTo({
|
||||||
|
y: (height / 100) * 60 - (((width / 100) * 80) / 20) * 9 + 30,
|
||||||
|
animated: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
//位置情報
|
//位置情報
|
||||||
const [locationStatus, setLocationStatus] = useState(null);
|
const [locationStatus, setLocationStatus] = useState(null);
|
||||||
@ -131,7 +141,7 @@ export default function Menu({ getCurrentTrain }) {
|
|||||||
}, [selectedCurrentStation]);
|
}, [selectedCurrentStation]);
|
||||||
|
|
||||||
//全列車ダイヤリストを作成するuseEffect
|
//全列車ダイヤリストを作成するuseEffect
|
||||||
const { allTrainDiagram:trainDiagram} = useAllTrainDiagram();
|
const { allTrainDiagram: trainDiagram } = useAllTrainDiagram();
|
||||||
|
|
||||||
const oPSign = () => {
|
const oPSign = () => {
|
||||||
const payload = {
|
const payload = {
|
||||||
@ -165,7 +175,6 @@ export default function Menu({ getCurrentTrain }) {
|
|||||||
);
|
);
|
||||||
setDotButton(!dotButton);
|
setDotButton(!dotButton);
|
||||||
};
|
};
|
||||||
const width = Dimensions.get("window").width;
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@ -176,14 +185,29 @@ export default function Menu({ getCurrentTrain }) {
|
|||||||
>
|
>
|
||||||
<StatusbarDetect />
|
<StatusbarDetect />
|
||||||
<TitleBar />
|
<TitleBar />
|
||||||
<ScrollView>
|
<ScrollView
|
||||||
|
stickyHeaderIndices={[0, 2]}
|
||||||
|
ref={scrollRef}
|
||||||
|
snapToStart={false}
|
||||||
|
snapToEnd={false}
|
||||||
|
decelerationRate={"normal"}
|
||||||
|
snapToOffsets={[
|
||||||
|
(height / 100) * 60 - (((width / 100) * 80) / 20) * 9 + 30,
|
||||||
|
]}
|
||||||
|
>
|
||||||
<TopMenuButton />
|
<TopMenuButton />
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
height: (height / 100) * 60 - (((width / 100) * 80) / 20) * 9 + 30,
|
||||||
|
}}
|
||||||
|
></View>
|
||||||
|
<></>
|
||||||
{originalStationList.length != 0 && allStationData.length != 0 && (
|
{originalStationList.length != 0 && allStationData.length != 0 && (
|
||||||
<View style={{ flex: 1, paddingTop: 10 }}>
|
<View style={{ flex: 1, paddingTop: 10 }}>
|
||||||
<Carousel
|
<Carousel
|
||||||
ref={carouselRef}
|
ref={carouselRef}
|
||||||
data={originalStationList && allStationData}
|
data={originalStationList && allStationData}
|
||||||
height={(wp("80%") / 20) * 9 + 10}
|
height={(((width / 100) * 80) / 20) * 9 + 10}
|
||||||
pagingEnabled={true}
|
pagingEnabled={true}
|
||||||
snapEnabled={true}
|
snapEnabled={true}
|
||||||
loop={false}
|
loop={false}
|
||||||
|
Loading…
Reference in New Issue
Block a user