Androidでスクロールしなかった問題を解消

This commit is contained in:
harukin-OneMix4 2023-07-01 14:49:55 +09:00
parent 0618ff0180
commit b2624d319b

View File

@ -8,6 +8,7 @@ import {
TouchableOpacity, TouchableOpacity,
TouchableWithoutFeedback, TouchableWithoutFeedback,
TouchableHighlight, TouchableHighlight,
Platform,
} from "react-native"; } from "react-native";
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"; import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
import ActionSheet from "react-native-actions-sheet"; import ActionSheet from "react-native-actions-sheet";
@ -26,6 +27,7 @@ export const EachTrainInfo = ({
from, from,
}) => { }) => {
const [trainData, setTrainData] = useState([]); const [trainData, setTrainData] = useState([]);
const [isTop, setIsTop] = useState(true);
const stationList = const stationList =
originalStationList && originalStationList &&
lineList.map((d) => lineList.map((d) =>
@ -36,6 +38,7 @@ export const EachTrainInfo = ({
); );
useEffect(() => { useEffect(() => {
setIsTop(true);
if (!data.trainNum) return; if (!data.trainNum) return;
const TD = trainList[data.trainNum]; const TD = trainList[data.trainNum];
if (!TD) { if (!TD) {
@ -60,7 +63,11 @@ export const EachTrainInfo = ({
}; };
return ( return (
<ActionSheet ref={setRef} gestureEnabled CustomHeaderComponent={<></>}> <ActionSheet
ref={setRef}
gestureEnabled={isTop}
CustomHeaderComponent={<></>}
>
<View <View
style={{ style={{
backgroundColor: "#0099CC", backgroundColor: "#0099CC",
@ -114,7 +121,14 @@ export const EachTrainInfo = ({
/> />
)} )}
</View> </View>
<ScrollView style={{ maxHeight: heightPercentageToDP("70%") }}> <ScrollView
style={{ maxHeight: heightPercentageToDP("70%") }}
nestedScrollEnabled
onScroll={(e) => {
if (!Platform.OS !== "android") return;
setIsTop(e.nativeEvent.contentOffset.y < 0);
}}
>
<View <View
style={{ style={{
padding: 10, padding: 10,