不要になったLottieRefを削除
This commit is contained in:
parent
343a0ad06e
commit
75b5f9b326
@ -40,13 +40,12 @@ export const JRSTraInfo = (props) => {
|
|||||||
loadingDelayData,
|
loadingDelayData,
|
||||||
setLoadingDelayData,
|
setLoadingDelayData,
|
||||||
delayData,
|
delayData,
|
||||||
LottieRef2,
|
|
||||||
} = props;
|
} = props;
|
||||||
return (
|
return (
|
||||||
<ActionSheet
|
<ActionSheet
|
||||||
ref={JRSTraInfoEXAcSR}
|
ref={JRSTraInfoEXAcSR}
|
||||||
gestureEnabled
|
gestureEnabled
|
||||||
CustomHeaderComponent={() => {}}
|
CustomHeaderComponent={() => { }}
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@ -107,7 +106,8 @@ export const JRSTraInfo = (props) => {
|
|||||||
{loadingDelayData ? (
|
{loadingDelayData ? (
|
||||||
<View style={{ alignItems: "center" }}>
|
<View style={{ alignItems: "center" }}>
|
||||||
<LottieView
|
<LottieView
|
||||||
ref={LottieRef2}
|
autoPlay
|
||||||
|
loop
|
||||||
style={{ width: 150, height: 150, backgroundColor: "#fff" }}
|
style={{ width: 150, height: 150, backgroundColor: "#fff" }}
|
||||||
source={require("../../assets/51690-loading-diamonds.json")}
|
source={require("../../assets/51690-loading-diamonds.json")}
|
||||||
/>
|
/>
|
||||||
|
26
menu.js
26
menu.js
@ -64,7 +64,7 @@ export default function Menu(props) {
|
|||||||
Location.requestForegroundPermissionsAsync().then((data) => {
|
Location.requestForegroundPermissionsAsync().then((data) => {
|
||||||
if (data.status !== "granted") {
|
if (data.status !== "granted") {
|
||||||
setErrorMsg("Permission to access location was denied");
|
setErrorMsg("Permission to access location was denied");
|
||||||
return () => {};
|
return () => { };
|
||||||
}
|
}
|
||||||
Location.getCurrentPositionAsync({}).then((location) =>
|
Location.getCurrentPositionAsync({}).then((location) =>
|
||||||
setLocation(location)
|
setLocation(location)
|
||||||
@ -87,8 +87,8 @@ export default function Menu(props) {
|
|||||||
const [stationName, setStationName] = useState(undefined);
|
const [stationName, setStationName] = useState(undefined);
|
||||||
const [currentStation, setCurrentStation] = useState(undefined);
|
const [currentStation, setCurrentStation] = useState(undefined);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!location) return () => {};
|
if (!location) return () => { };
|
||||||
if (!originalStationList) return () => {};
|
if (!originalStationList) return () => { };
|
||||||
const findStationEachLine = (selectLine) => {
|
const findStationEachLine = (selectLine) => {
|
||||||
const searchArea = 0.0015;
|
const searchArea = 0.0015;
|
||||||
const _calcDistance = (from, to) => {
|
const _calcDistance = (from, to) => {
|
||||||
@ -136,8 +136,6 @@ export default function Menu(props) {
|
|||||||
}
|
}
|
||||||
}, [location, originalStationList]);
|
}, [location, originalStationList]);
|
||||||
|
|
||||||
const LottieRef = useRef(null);
|
|
||||||
const LottieRef2 = useRef(null);
|
|
||||||
const [count, setCount] = useState(0);
|
const [count, setCount] = useState(0);
|
||||||
const [delayData, setDelayData] = useState(undefined);
|
const [delayData, setDelayData] = useState(undefined);
|
||||||
const [getTime, setGetTime] = useState(new Date());
|
const [getTime, setGetTime] = useState(new Date());
|
||||||
@ -148,22 +146,12 @@ export default function Menu(props) {
|
|||||||
"https://script.google.com/macros/s/AKfycbyKxch7z7l8e07LXulRHqxjVoIiB13kcgvoToLE-rqlxLmLSKdlmqz0FI1F2EuA7Zfg/exec"
|
"https://script.google.com/macros/s/AKfycbyKxch7z7l8e07LXulRHqxjVoIiB13kcgvoToLE-rqlxLmLSKdlmqz0FI1F2EuA7Zfg/exec"
|
||||||
)
|
)
|
||||||
.then((response) => response.text())
|
.then((response) => response.text())
|
||||||
.then((data) => {
|
.then(data => setDelayData(data !== "" ? data.split("^") : null))
|
||||||
if (data != "") {
|
.then(() => LayoutAnimation.easeInEaseOut())
|
||||||
setDelayData(data.split("^"));
|
|
||||||
} else setDelayData(null);
|
|
||||||
})
|
|
||||||
.then((data) => LayoutAnimation.easeInEaseOut())
|
|
||||||
.then(() => setGetTime(new Date()))
|
.then(() => setGetTime(new Date()))
|
||||||
.finally(() => setLoadingDelayData(false));
|
.finally(() => setLoadingDelayData(false));
|
||||||
}, [loadingDelayData]);
|
}, [loadingDelayData]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
try {
|
|
||||||
LottieRef?.current.play();
|
|
||||||
LottieRef2?.current.play();
|
|
||||||
} catch (e) {}
|
|
||||||
});
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@ -309,7 +297,8 @@ export default function Menu(props) {
|
|||||||
{loadingDelayData ? (
|
{loadingDelayData ? (
|
||||||
<View style={{ alignItems: "center" }}>
|
<View style={{ alignItems: "center" }}>
|
||||||
<LottieView
|
<LottieView
|
||||||
ref={LottieRef}
|
autoPlay
|
||||||
|
loop
|
||||||
style={{
|
style={{
|
||||||
width: 150,
|
width: 150,
|
||||||
height: 150,
|
height: 150,
|
||||||
@ -633,7 +622,6 @@ export default function Menu(props) {
|
|||||||
loadingDelayData={loadingDelayData}
|
loadingDelayData={loadingDelayData}
|
||||||
setLoadingDelayData={setLoadingDelayData}
|
setLoadingDelayData={setLoadingDelayData}
|
||||||
delayData={delayData}
|
delayData={delayData}
|
||||||
LottieRef2={LottieRef2}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user