テキストのサイズ調整

This commit is contained in:
harukin-expo-dev-env
2025-09-14 10:02:06 +00:00
parent 64de920dc6
commit 3531a128ab
2 changed files with 30 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { Platform, UIManager } from "react-native"; import { Platform, UIManager, Text } from "react-native";
import { GestureHandlerRootView } from "react-native-gesture-handler"; import { GestureHandlerRootView } from "react-native-gesture-handler";
import { AppContainer } from "./Apps"; import { AppContainer } from "./Apps";
import { UpdateAsync } from "./UpdateAsync"; import { UpdateAsync } from "./UpdateAsync";
@@ -35,7 +35,10 @@ export default function App() {
useEffect(() => { useEffect(() => {
UpdateAsync(); UpdateAsync();
}, []); }, []);
if (Text.defaultProps == null) {
Text.defaultProps = {};
Text.defaultProps.allowFontScaling = false;
}
const ProviderTree = buildProvidersTree([ const ProviderTree = buildProvidersTree([
AllTrainDiagramProvider, AllTrainDiagramProvider,
NotificationProvider, NotificationProvider,

View File

@@ -16,11 +16,14 @@ import { useAreaInfo } from "@/stateBox/useAreaInfo";
import { useCurrentTrain } from "@/stateBox/useCurrentTrain"; import { useCurrentTrain } from "@/stateBox/useCurrentTrain";
import { useStationList } from "@/stateBox/useStationList"; import { useStationList } from "@/stateBox/useStationList";
import dayjs from "dayjs"; import { FC, useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { Text, TouchableOpacity, View } from "react-native"; import { Text, TouchableOpacity, View } from "react-native";
export const FixedStation = ({ stationID }) => { type props = {
stationID: string;
};
export const FixedStation: FC<props> = ({ stationID }) => {
const { currentTrain, setFixedPosition } = useCurrentTrain(); const { currentTrain, setFixedPosition } = useCurrentTrain();
const { getStationDataFromId } = useStationList(); const { getStationDataFromId } = useStationList();
const [station, setStation] = useState<StationProps[]>([]); const [station, setStation] = useState<StationProps[]>([]);
@@ -108,6 +111,9 @@ export const FixedStation = ({ stationID }) => {
width: "100%", width: "100%",
alignContent: "center", alignContent: "center",
alignItems: "center", alignItems: "center",
height: 22,
overflow: "hidden",
paddingLeft: 5,
}} }}
> >
<StationNumberMaker <StationNumberMaker
@@ -117,10 +123,11 @@ export const FixedStation = ({ stationID }) => {
/> />
<Text <Text
style={{ style={{
fontSize: 18, fontSize: 14,
textAlignVertical: "center", textAlignVertical: "center",
margin: 0, margin: 0,
padding: 0, padding: 0,
paddingLeft: 5,
flex: 1, flex: 1,
color: "white", color: "white",
}} }}
@@ -130,15 +137,16 @@ export const FixedStation = ({ stationID }) => {
<View <View
style={{ style={{
backgroundColor: "white", backgroundColor: "white",
width: 10, width: 6,
borderLeftColor: lineColor, borderLeftColor: lineColor,
borderTopColor: lineColor, borderTopColor: lineColor,
borderBottomColor: "white", borderBottomColor: "white",
borderBottomWidth: 16, borderRightColor: "white",
borderLeftWidth: 8, borderBottomWidth: 18,
borderLeftWidth: 10,
borderRightWidth: 0, borderRightWidth: 0,
borderTopWidth: 5, borderTopWidth: 5,
height: "100%", height: 20,
}} }}
/> />
</View> </View>
@@ -173,7 +181,7 @@ export const FixedStation = ({ stationID }) => {
)) ))
) : ( ) : (
<View style={{ backgroundColor: "white", flex: 1 }}> <View style={{ backgroundColor: "white", flex: 1 }}>
<Text style={{ fontSize: 20 }}> <Text style={{ fontSize: parseInt("11%") }}>
</Text> </Text>
</View> </View>
@@ -212,10 +220,14 @@ const FixedStationBoxEachTrain = ({ d, station }) => {
overflow: "visible", overflow: "visible",
}} }}
> >
<Text style={{ fontSize: 14, flex: 3 }}>{d.time}</Text> <Text style={{ fontSize: parseInt("11%"), flex: 3 }}>{d.time}</Text>
<Text style={{ fontSize: 14, flex: 4, color }}>{name}</Text> <Text style={{ fontSize: parseInt("11%"), flex: 4, color }}>{name}</Text>
<Text style={{ fontSize: 14, flex: 4 }}>{d.lastStation}</Text> <Text style={{ fontSize: parseInt("11%"), flex: 4 }}>
<Text style={{ fontSize: 14, flex: 3 }}>{trainDelayStatus}</Text> {d.lastStation}
</Text>
<Text style={{ fontSize: parseInt("11%"), flex: 3 }}>
{trainDelayStatus}
</Text>
</View> </View>
); );
}; };