From 75b5f9b3269d2a791f78ad2e044b3adb63b0d980 Mon Sep 17 00:00:00 2001 From: harukin-OneMix4 Date: Fri, 18 Nov 2022 19:28:40 +0900 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AB=E3=81=AA=E3=81=A3?= =?UTF-8?q?=E3=81=9FLottieRef=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ActionSheetComponents/JRSTraInfo.js | 10 +- menu.js | 128 ++++++++---------- 2 files changed, 63 insertions(+), 75 deletions(-) diff --git a/components/ActionSheetComponents/JRSTraInfo.js b/components/ActionSheetComponents/JRSTraInfo.js index a333206..3444367 100644 --- a/components/ActionSheetComponents/JRSTraInfo.js +++ b/components/ActionSheetComponents/JRSTraInfo.js @@ -40,13 +40,12 @@ export const JRSTraInfo = (props) => { loadingDelayData, setLoadingDelayData, delayData, - LottieRef2, } = props; return ( {}} + CustomHeaderComponent={() => { }} > { {getTime ? getTime.toLocaleTimeString("ja-JP").split(":")[0] + - ":" + - getTime.toLocaleTimeString("ja-JP").split(":")[1] + ":" + + getTime.toLocaleTimeString("ja-JP").split(":")[1] : NaN}{" "} { {loadingDelayData ? ( diff --git a/menu.js b/menu.js index b651dd3..f1d1633 100644 --- a/menu.js +++ b/menu.js @@ -64,7 +64,7 @@ export default function Menu(props) { Location.requestForegroundPermissionsAsync().then((data) => { if (data.status !== "granted") { setErrorMsg("Permission to access location was denied"); - return () => {}; + return () => { }; } Location.getCurrentPositionAsync({}).then((location) => setLocation(location) @@ -87,8 +87,8 @@ export default function Menu(props) { const [stationName, setStationName] = useState(undefined); const [currentStation, setCurrentStation] = useState(undefined); useEffect(() => { - if (!location) return () => {}; - if (!originalStationList) return () => {}; + if (!location) return () => { }; + if (!originalStationList) return () => { }; const findStationEachLine = (selectLine) => { const searchArea = 0.0015; const _calcDistance = (from, to) => { @@ -136,8 +136,6 @@ export default function Menu(props) { } }, [location, originalStationList]); - const LottieRef = useRef(null); - const LottieRef2 = useRef(null); const [count, setCount] = useState(0); const [delayData, setDelayData] = useState(undefined); const [getTime, setGetTime] = useState(new Date()); @@ -148,22 +146,12 @@ export default function Menu(props) { "https://script.google.com/macros/s/AKfycbyKxch7z7l8e07LXulRHqxjVoIiB13kcgvoToLE-rqlxLmLSKdlmqz0FI1F2EuA7Zfg/exec" ) .then((response) => response.text()) - .then((data) => { - if (data != "") { - setDelayData(data.split("^")); - } else setDelayData(null); - }) - .then((data) => LayoutAnimation.easeInEaseOut()) + .then(data => setDelayData(data !== "" ? data.split("^") : null)) + .then(() => LayoutAnimation.easeInEaseOut()) .then(() => setGetTime(new Date())) .finally(() => setLoadingDelayData(false)); }, [loadingDelayData]); - useEffect(() => { - try { - LottieRef?.current.play(); - LottieRef2?.current.play(); - } catch (e) {} - }); return ( {getTime ? getTime.toLocaleTimeString("ja-JP").split(":")[0] + - ":" + - getTime.toLocaleTimeString("ja-JP").split(":")[1] + ":" + + getTime.toLocaleTimeString("ja-JP").split(":")[1] : NaN} )))([ - { - url: "https://twitter.com/JRshikoku_eigyo", - name: "JR四国営業部【公式】", - }, - { - url: "https://twitter.com/JRshikoku_tokyo", - name: "JR四国 東京営業情報【公式】", - }, - { - url: "https://twitter.com/JRshikoku_osaka", - name: "JR四国 大阪営業部【公式】", - }, - { - url: "https://twitter.com/jr_shikoku_info", - name: "JR四国列車運行情報【公式】", - }, - { - url: "https://twitter.com/Smile_Eki_Chan", - name: "すまいるえきちゃん♡JR四国【公式】", - }, - { - url: "https://twitter.com/jrs_matsuyama", - name: "JR四国 松山駅 【公式】", - }, - { - url: "https://twitter.com/jrshikoku_kochi", - name: "JR四国 高知駅【公式】", - }, - { - url: "https://twitter.com/jr_tokust", - name: "JR四国 徳島駅【公式】", - }, - { - url: "https://twitter.com/jrshikoku_uwjm", - name: "JR四国 宇和島駅【公式】", - }, - { - url: "https://twitter.com/JRshikoku_wkoch", - name: "JR四国 ワープ高知支店【公式】", - }, - { - url: "https://twitter.com/jrshikoku_nihaw", - name: "JR四国 ワープ新居浜営業所【公式】", - }, - { - url: "https://twitter.com/Yoakemonogatari", - name: "志国土佐 時代の夜明けのものがたり【公式】", - }, - ])} + { + url: "https://twitter.com/JRshikoku_eigyo", + name: "JR四国営業部【公式】", + }, + { + url: "https://twitter.com/JRshikoku_tokyo", + name: "JR四国 東京営業情報【公式】", + }, + { + url: "https://twitter.com/JRshikoku_osaka", + name: "JR四国 大阪営業部【公式】", + }, + { + url: "https://twitter.com/jr_shikoku_info", + name: "JR四国列車運行情報【公式】", + }, + { + url: "https://twitter.com/Smile_Eki_Chan", + name: "すまいるえきちゃん♡JR四国【公式】", + }, + { + url: "https://twitter.com/jrs_matsuyama", + name: "JR四国 松山駅 【公式】", + }, + { + url: "https://twitter.com/jrshikoku_kochi", + name: "JR四国 高知駅【公式】", + }, + { + url: "https://twitter.com/jr_tokust", + name: "JR四国 徳島駅【公式】", + }, + { + url: "https://twitter.com/jrshikoku_uwjm", + name: "JR四国 宇和島駅【公式】", + }, + { + url: "https://twitter.com/JRshikoku_wkoch", + name: "JR四国 ワープ高知支店【公式】", + }, + { + url: "https://twitter.com/jrshikoku_nihaw", + name: "JR四国 ワープ新居浜営業所【公式】", + }, + { + url: "https://twitter.com/Yoakemonogatari", + name: "志国土佐 時代の夜明けのものがたり【公式】", + }, + ])} @@ -633,7 +622,6 @@ export default function Menu(props) { loadingDelayData={loadingDelayData} setLoadingDelayData={setLoadingDelayData} delayData={delayData} - LottieRef2={LottieRef2} /> );