rererefactoring
This commit is contained in:
parent
75b5f9b326
commit
06c5102225
133
menu.js
133
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) => {
|
||||||
@ -146,7 +146,7 @@ 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 => setDelayData(data !== "" ? data.split("^") : null))
|
.then((data) => setDelayData(data !== "" ? data.split("^") : null))
|
||||||
.then(() => LayoutAnimation.easeInEaseOut())
|
.then(() => LayoutAnimation.easeInEaseOut())
|
||||||
.then(() => setGetTime(new Date()))
|
.then(() => setGetTime(new Date()))
|
||||||
.finally(() => setLoadingDelayData(false));
|
.finally(() => setLoadingDelayData(false));
|
||||||
@ -224,18 +224,16 @@ export default function Menu(props) {
|
|||||||
</Text>
|
</Text>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
{currentStation && (
|
{currentStation && (
|
||||||
<Sign
|
<>
|
||||||
currentStation={currentStation}
|
<Sign
|
||||||
originalStationList={originalStationList}
|
currentStation={currentStation}
|
||||||
oP={() => StationBoardAcSR.current?.setModalVisible()}
|
originalStationList={originalStationList}
|
||||||
/>
|
oP={StationBoardAcSR.current?.setModalVisible}
|
||||||
|
/>
|
||||||
|
<LED_vision station={currentStation[0]} />
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
{currentStation && <LED_vision station={currentStation[0]} />}
|
<TouchableOpacity onPress={JRSTraInfoEXAcSR.current?.setModalVisible}>
|
||||||
<TouchableOpacity
|
|
||||||
onPress={() => {
|
|
||||||
JRSTraInfoEXAcSR.current?.setModalVisible();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: "#0099CC",
|
backgroundColor: "#0099CC",
|
||||||
@ -272,8 +270,8 @@ export default function Menu(props) {
|
|||||||
>
|
>
|
||||||
{getTime
|
{getTime
|
||||||
? getTime.toLocaleTimeString("ja-JP").split(":")[0] +
|
? getTime.toLocaleTimeString("ja-JP").split(":")[0] +
|
||||||
":" +
|
":" +
|
||||||
getTime.toLocaleTimeString("ja-JP").split(":")[1]
|
getTime.toLocaleTimeString("ja-JP").split(":")[1]
|
||||||
: NaN}
|
: NaN}
|
||||||
</Text>
|
</Text>
|
||||||
<Ionicons
|
<Ionicons
|
||||||
@ -282,7 +280,8 @@ export default function Menu(props) {
|
|||||||
size={30}
|
size={30}
|
||||||
style={{ margin: 5 }}
|
style={{ margin: 5 }}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
LayoutAnimation.easeInEaseOut(), setLoadingDelayData(true);
|
LayoutAnimation.easeInEaseOut();
|
||||||
|
setLoadingDelayData(true);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@ -521,55 +520,55 @@ export default function Menu(props) {
|
|||||||
<Icon name="chevron-right" size={20} />
|
<Icon name="chevron-right" size={20} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
)))([
|
)))([
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/JRshikoku_eigyo",
|
url: "https://twitter.com/JRshikoku_eigyo",
|
||||||
name: "JR四国営業部【公式】",
|
name: "JR四国営業部【公式】",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/JRshikoku_tokyo",
|
url: "https://twitter.com/JRshikoku_tokyo",
|
||||||
name: "JR四国 東京営業情報【公式】",
|
name: "JR四国 東京営業情報【公式】",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/JRshikoku_osaka",
|
url: "https://twitter.com/JRshikoku_osaka",
|
||||||
name: "JR四国 大阪営業部【公式】",
|
name: "JR四国 大阪営業部【公式】",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/jr_shikoku_info",
|
url: "https://twitter.com/jr_shikoku_info",
|
||||||
name: "JR四国列車運行情報【公式】",
|
name: "JR四国列車運行情報【公式】",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/Smile_Eki_Chan",
|
url: "https://twitter.com/Smile_Eki_Chan",
|
||||||
name: "すまいるえきちゃん♡JR四国【公式】",
|
name: "すまいるえきちゃん♡JR四国【公式】",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/jrs_matsuyama",
|
url: "https://twitter.com/jrs_matsuyama",
|
||||||
name: "JR四国 松山駅 【公式】",
|
name: "JR四国 松山駅 【公式】",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/jrshikoku_kochi",
|
url: "https://twitter.com/jrshikoku_kochi",
|
||||||
name: "JR四国 高知駅【公式】",
|
name: "JR四国 高知駅【公式】",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/jr_tokust",
|
url: "https://twitter.com/jr_tokust",
|
||||||
name: "JR四国 徳島駅【公式】",
|
name: "JR四国 徳島駅【公式】",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/jrshikoku_uwjm",
|
url: "https://twitter.com/jrshikoku_uwjm",
|
||||||
name: "JR四国 宇和島駅【公式】",
|
name: "JR四国 宇和島駅【公式】",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/JRshikoku_wkoch",
|
url: "https://twitter.com/JRshikoku_wkoch",
|
||||||
name: "JR四国 ワープ高知支店【公式】",
|
name: "JR四国 ワープ高知支店【公式】",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/jrshikoku_nihaw",
|
url: "https://twitter.com/jrshikoku_nihaw",
|
||||||
name: "JR四国 ワープ新居浜営業所【公式】",
|
name: "JR四国 ワープ新居浜営業所【公式】",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/Yoakemonogatari",
|
url: "https://twitter.com/Yoakemonogatari",
|
||||||
name: "志国土佐 時代の夜明けのものがたり【公式】",
|
name: "志国土佐 時代の夜明けのものがたり【公式】",
|
||||||
},
|
},
|
||||||
])}
|
])}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<Text style={{ fontWeight: "bold", fontSize: 20 }}>
|
<Text style={{ fontWeight: "bold", fontSize: 20 }}>
|
||||||
|
Loading…
Reference in New Issue
Block a user