徳島線の徳島駅、阿波池田駅の地点情報が無かった問題をデータソース側の改変で対処
This commit is contained in:
@@ -24,7 +24,7 @@ export default function TrainMenu({ style }) {
|
||||
const { originalStationList } = useStationList();
|
||||
useEffect(() => {
|
||||
const stationPinData = [];
|
||||
Object.keys(originalStationList).forEach((d, indexBase) => {
|
||||
Object.keys(lineList_LineWebID).forEach((d, indexBase) => {
|
||||
originalStationList[d].forEach((D, index) => {
|
||||
if (selectedLine && selectedLine != lineList_LineWebID[d]) return;
|
||||
const latlng = [D.lat,D.lng];
|
||||
@@ -35,14 +35,14 @@ export default function TrainMenu({ style }) {
|
||||
setStationPin(stationPinData);
|
||||
}, [originalStationList, selectedLine]);
|
||||
useLayoutEffect(() => {
|
||||
mapRef.current.fitToCoordinates(
|
||||
mapRef?.current.fitToCoordinates(
|
||||
stationPin.map(({ latlng }) => ({
|
||||
latitude: parseFloat(latlng[0]),
|
||||
longitude: parseFloat(latlng[1]),
|
||||
})),
|
||||
{ edgePadding: { top: 80, bottom: 120, left: 50, right: 50 } } // Add margin values here
|
||||
);
|
||||
}, [stationPin]);
|
||||
}, [stationPin,mapRef]);
|
||||
return (
|
||||
<View style={{ height: "100%", backgroundColor: "#0099CC", ...style }}>
|
||||
<MapView
|
||||
@@ -70,7 +70,7 @@ export default function TrainMenu({ style }) {
|
||||
d={d}
|
||||
navigate={navigate}
|
||||
webview={webview}
|
||||
key={D.StationNumber + d}
|
||||
key={D.Station_JP + D.StationNumber + d}
|
||||
/>
|
||||
))}
|
||||
</MapView>
|
||||
|
Reference in New Issue
Block a user