Merge commit '8818addecd906d2172c3edd0e47a67857d938bd2' into develop

This commit is contained in:
harukin-expo-dev-env 2025-02-05 13:19:06 +00:00
commit 9df1fc1ed2
6 changed files with 115 additions and 19 deletions

12
Apps.js
View File

@ -14,15 +14,13 @@ export function AppContainer() {
const Tab = createBottomTabNavigator();
const { areaInfo, areaIconBadgeText, isInfo } = useAreaInfo();
const navigationRef = React.useRef();
const getTabProps = (name, label, icon, iconFamily, tabBarBadge, style) => ({
const getTabProps = (name, label, icon, iconFamily, tabBarBadge, isInfo) => ({
name,
options: {
tabBarLabel: label,
headerShown: false,
gestureEnabled: true,
tabBarIcon: initIcon(icon, iconFamily),
tabBarBadge,
tabBarBadgeStyle: style,
tabBarIcon: initIcon(icon, iconFamily,tabBarBadge,isInfo),
},
});
@ -38,7 +36,6 @@ export function AppContainer() {
screenOptions={{
lazy: false,
animation: "shift",
tabBarVariant: "uikit",
}}
detachInactiveScreens={false}
lazy={false}
@ -59,10 +56,7 @@ export function AppContainer() {
"train",
"Ionicons",
areaInfo ? areaIconBadgeText : undefined,
isInfo && {
backgroundColor: "#00b8ff",
color: "white",
}
isInfo
)}
children={TNDView}
/>

View File

@ -9,6 +9,7 @@ import {
import ActionSheet, { SheetManager } from "react-native-actions-sheet";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useTrainMenu } from "../../stateBox/useTrainMenu";
import { useCurrentTrain } from "../../stateBox/useCurrentTrain";
import lineColorList from "../../assets/originData/lineColorList";
import { stationIDPair } from "../../lib/getStationList2";
import { lineListPair } from "../../lib/getStationList";
@ -19,6 +20,7 @@ export const TrainMenuLineSelector = () => {
setSelectedLine,
mapsStationData: stationData,
} = useTrainMenu();
const { webview } = useCurrentTrain();
const actionSheetRef = useRef(null);
const insets = useSafeAreaInsets();
const platformIs = Platform.OS == "android";
@ -52,7 +54,25 @@ export const TrainMenuLineSelector = () => {
}}
onPress={() => {
SheetManager.hide("TrainMenuLineSelector");
setSelectedLine(selectedLine == d ? undefined : d);
const s = selectedLine == d ? undefined : d;
if(!s) return;
setSelectedLine(s);
Object.keys(stationData).forEach((data, indexBase) => {
stationData[data].forEach((D, index) => {
if (!D.StationMap) return null;
if (s && s != data) return;
const latlng = D.StationMap.replace(
"https://www.google.co.jp/maps/place/",
""
).split(",");
if (latlng.length == 0) return null;
if (index == 0 ) {
webview.current
?.injectJavaScript(`MoveDisplayStation('${data}_${D.MyStation}_${D.Station_JP}');
document.getElementById("disp").insertAdjacentHTML("afterbegin", "<div />");`);
}
});
});
}}
>
<View

View File

@ -147,6 +147,7 @@ export default function TrainMenu({ style }) {
}}
onPress={() => {
const s = selectedLine == d ? undefined : d;
if(!s) return;
setSelectedLine(s);
Object.keys(stationData).forEach((data, indexBase) => {
stationData[data].forEach((D, index) => {

View File

@ -1,20 +1,72 @@
import React from "react";
import React, { FC } from "react";
import { Ionicons, AntDesign } from "@expo/vector-icons";
import { Text, View } from "react-native";
type name = keyof typeof Ionicons.glyphMap & keyof typeof AntDesign.glyphMap;
type type = "Ionicons" | "AntDesign";
export const initIcon = (name: name, type:type) => {
export const initIcon = (
name: name,
type: type,
tabBarBadge: string,
isInfo: boolean
) => {
switch (type) {
case "Ionicons":
return ({ focused, color, size }) => (
<Ionicons name={name} size={30} color={focused ? "#0099CC" : "black"} />
<>
{!!tabBarBadge && <Badge tabBarBadge={tabBarBadge} isInfo={isInfo} />}
<Ionicons
name={name}
size={30}
color={focused ? "#0099CC" : "black"}
/>
</>
);
case "AntDesign":
return ({ focused, color, size }) => (
<AntDesign
name={name}
size={30}
color={focused ? "#0099CC" : "black"}
/>
<>
{!!tabBarBadge && <Badge tabBarBadge={tabBarBadge} isInfo={isInfo} />}
<AntDesign
name={name}
size={30}
color={focused ? "#0099CC" : "black"}
/>
</>
);
}
};
type BadgeProps = { tabBarBadge: string; isInfo: boolean };
export const Badge: FC<BadgeProps> = ({ tabBarBadge, isInfo }) => {
return (
<View
style={{
position: "relative",
top: -5,
right: 0,
zIndex: 100,
padding: 1,
width: 0,
}}
>
<View
style={{
position: "absolute",
top: 0,
left: 0,
backgroundColor: isInfo ? "#00b8ff" : "red",
borderRadius: 10,
padding: 2,
shadowColor: "#000",
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 0.5,
shadowRadius: 4,
elevation: 2
}}
>
<Text style={{ color: "white", paddingHorizontal: 4 }}>
{tabBarBadge}
</Text>
</View>
</View>
);
};

View File

@ -9,6 +9,7 @@
"dependencies": {
"@expo/ngrok": "^4.1.0",
"@expo/vector-icons": "^14.0.2",
"@gorhom/bottom-sheet": "^5",
"@react-native-async-storage/async-storage": "1.23.1",
"@react-native-masked-view/masked-view": "0.3.2",
"@react-navigation/bottom-tabs": "^7.2.0",
@ -57,6 +58,7 @@
"react-native-safe-area-context": "4.12.0",
"react-native-screens": "~4.4.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-sortables": "^1.1.0",
"react-native-storage": "^1.0.1",
"react-native-svg": "15.8.0",
"react-native-svg-uri": "^1.2.3",

View File

@ -1896,6 +1896,21 @@
resolved "https://registry.yarnpkg.com/@firebase/webchannel-wrapper/-/webchannel-wrapper-0.4.1.tgz#600f2275ff54739ad5ac0102f1467b8963cd5f71"
integrity sha512-0yPjzuzGMkW1GkrC8yWsiN7vt1OzkMIi9HgxRmKREZl2wnNPOKo/yScTjXf/O57HM8dltqxPF6jlNLFVtc2qdw==
"@gorhom/bottom-sheet@^5":
version "5.0.6"
resolved "https://registry.yarnpkg.com/@gorhom/bottom-sheet/-/bottom-sheet-5.0.6.tgz#f20736502399c7bcf8c73ea09e6b571dc07fe0eb"
integrity sha512-SI/AhPvgRfnCWN6/+wbE6TXwRE4X8F2fLyE4L/0bRwgE34Zenq585qLT139uEcfCIyovC2swC3ICqQpkmWEcFA==
dependencies:
"@gorhom/portal" "1.0.14"
invariant "^2.2.4"
"@gorhom/portal@1.0.14":
version "1.0.14"
resolved "https://registry.yarnpkg.com/@gorhom/portal/-/portal-1.0.14.tgz#1953edb76aaba80fb24021dc774550194a18e111"
integrity sha512-MXyL4xvCjmgaORr/rtryDNFy3kU4qUbKlwtQqqsygd0xX3mhKjOLn6mQK8wfu0RkoE0pBE0nAasRoHua+/QZ7A==
dependencies:
nanoid "^3.3.1"
"@grpc/grpc-js@^1.0.0":
version "1.8.11"
resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.8.11.tgz#f113f7bc197e8d6f3d3f0c6b02925c7a5da1aec4"
@ -6264,7 +6279,7 @@ mz@^2.7.0:
object-assign "^4.0.1"
thenify-all "^1.0.0"
nanoid@3.3.8:
nanoid@3.3.8, nanoid@^3.3.1:
version "3.3.8"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.8.tgz#b1be3030bee36aaff18bacb375e5cce521684baf"
integrity sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==
@ -7100,6 +7115,11 @@ react-native-gesture-handler@~2.20.2:
invariant "^2.2.4"
prop-types "^15.7.2"
react-native-haptic-feedback@>=2.0.0:
version "2.3.3"
resolved "https://registry.yarnpkg.com/react-native-haptic-feedback/-/react-native-haptic-feedback-2.3.3.tgz#88b6876e91399a69bd1b551fe1681b2f3dc1214e"
integrity sha512-svS4D5PxfNv8o68m9ahWfwje5NqukM3qLS48+WTdhbDkNUkOhP9rDfDSRHzlhk4zq+ISjyw95EhLeh8NkKX5vQ==
react-native-iphone-x-helper@^1.0.3, react-native-iphone-x-helper@^1.3.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz#20c603e9a0e765fd6f97396638bdeb0e5a60b010"
@ -7213,6 +7233,13 @@ react-native-snap-carousel@^3.9.1:
prop-types "^15.6.1"
react-addons-shallow-compare "15.6.2"
react-native-sortables@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/react-native-sortables/-/react-native-sortables-1.1.0.tgz#d2fae9531d655a05792ff9d89f0ed6ca6edf8fc4"
integrity sha512-Z5VGrKcO2xnBKRAd1SFqm+1pJ7vnTbOfCIs3N76+imd6ucWTDjNEtfFZLvzfKciJ/caxnew56fxABG1sS8sHrg==
optionalDependencies:
react-native-haptic-feedback ">=2.0.0"
react-native-storage@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/react-native-storage/-/react-native-storage-1.0.1.tgz#2c493875ff76ec301987c951a8302f3a54381241"