Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android見切れ修正&Androidタブ全機種対応 #3798

Merged
merged 2 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/components/DevOverlay.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Application from 'expo-application'
import React, { useMemo } from 'react'
import { Dimensions, Platform, StyleSheet, View } from 'react-native'
import { Dimensions, StyleSheet, View } from 'react-native'
import { useLocationStore } from '../hooks/useLocationStore'
import { useThreshold } from '../hooks/useThreshold'
import Typography from './Typography'
Expand All @@ -19,13 +19,11 @@ const styles = StyleSheet.create({
text: {
color: 'white',
fontSize: 11,
lineHeight: Platform.OS === 'android' ? 16 : undefined,
},
textHeading: {
color: 'white',
fontWeight: 'bold',
fontSize: 11,
lineHeight: Platform.OS === 'android' ? 16 : undefined,
},
})

Expand Down
3 changes: 1 addition & 2 deletions src/components/LineBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useThemeStore } from '../hooks/useThemeStore'
import { APP_THEME } from '../models/Theme'
import navigationState from '../store/atoms/navigation'
import { isJapanese, translate } from '../translation'
import isFullSizedTablet from '../utils/isFullSizedTablet'
import isTablet from '../utils/isTablet'
import LineBoardEast from './LineBoardEast'
import LineBoardJO from './LineBoardJO'
Expand Down Expand Up @@ -107,7 +106,7 @@ const LineBoard: React.FC<Props> = ({ hasTerminus = false }: Props) => {
/>
)
case APP_THEME.YAMANOTE:
if (isFullSizedTablet) {
if (isTablet) {
return (
<LineBoardYamanotePad stations={slicedLeftStationsForYamanote} />
)
Expand Down
26 changes: 9 additions & 17 deletions src/components/LineBoardEast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ import lineState from '../store/atoms/line'
import stationState from '../store/atoms/station'
import { isEnSelector } from '../store/selectors/isEn'
import getStationNameR from '../utils/getStationNameR'
import isFullSizedTablet from '../utils/isFullSizedTablet'
import getIsPass from '../utils/isPass'
import isSmallTablet from '../utils/isSmallTablet'
import isTablet from '../utils/isTablet'
import { heightScale, widthScale } from '../utils/scale'
import BarTerminal from './BarTerminalEast'
Expand Down Expand Up @@ -72,7 +70,7 @@ const getStationNameEnExtraStyle = (): StyleProp<TextStyle> => {
}
return {
width: 250,
marginBottom: isSmallTablet ? 106 : 96,
marginBottom: 96,
}
}

Expand All @@ -84,30 +82,24 @@ const getBarTerminalRight = (): number => {
}

const barBottom = ((): number => {
if (isFullSizedTablet) {
if (isTablet) {
return -52
}
if (isSmallTablet) {
return 30
}
return 32
})()

const barTerminalBottom = ((): number => {
if (isFullSizedTablet) {
if (isTablet) {
return -54
}
if (isSmallTablet) {
return 28
}
return 32
})()

const styles = StyleSheet.create({
root: {
flex: 1,
height: screenHeight,
bottom: isFullSizedTablet ? screenHeight / 2.5 : undefined,
bottom: isTablet ? screenHeight / 2.5 : undefined,
},
bar: {
position: 'absolute',
Expand All @@ -123,7 +115,7 @@ const styles = StyleSheet.create({
},
stationNameWrapper: {
flexDirection: 'row',
justifyContent: isFullSizedTablet ? 'flex-start' : undefined,
justifyContent: isTablet ? 'flex-start' : undefined,
marginLeft: 32,
flex: 1,
},
Expand All @@ -132,7 +124,7 @@ const styles = StyleSheet.create({
flexWrap: 'wrap',
justifyContent: 'flex-end',
bottom: isTablet ? 84 : undefined,
paddingBottom: !isFullSizedTablet ? 84 : undefined,
paddingBottom: !isTablet ? 84 : undefined,
},
stationName: {
width: RFValue(21),
Expand All @@ -159,13 +151,13 @@ const styles = StyleSheet.create({
height: isTablet ? 36 : 24,
position: 'absolute',
zIndex: 9999,
bottom: isFullSizedTablet ? -46 : 32 + 4,
bottom: isTablet ? -46 : 32 + 4,
overflow: 'visible',
},
chevron: {
position: 'absolute',
zIndex: 9999,
bottom: isSmallTablet ? 115 : 32,
bottom: 32,
marginLeft: widthScale(14),
width: isTablet ? 48 : 32,
height: isTablet ? 48 : 32,
Expand All @@ -180,7 +172,7 @@ const styles = StyleSheet.create({
width: screenWidth / 9,
fontSize: RFValue(12),
fontWeight: 'bold',
bottom: isSmallTablet ? 16 : 0,
bottom: 0,
},
marksContainer: { marginTop: 8 },
})
Expand Down
24 changes: 8 additions & 16 deletions src/components/LineBoardSaikyo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ import lineState from '../store/atoms/line'
import stationState from '../store/atoms/station'
import { isEnSelector } from '../store/selectors/isEn'
import getStationNameR from '../utils/getStationNameR'
import isFullSizedTablet from '../utils/isFullSizedTablet'
import getIsPass from '../utils/isPass'
import isSmallTablet from '../utils/isSmallTablet'
import isTablet from '../utils/isTablet'
import { heightScale, widthScale } from '../utils/scale'
import BarTerminal from './BarTerminalSaikyo'
Expand Down Expand Up @@ -83,30 +81,24 @@ const getBarTerminalRight = (): number => {
}

const barBottom = ((): number => {
if (isFullSizedTablet) {
if (isTablet) {
return -52
}
if (isSmallTablet) {
return 30
}
return 32
})()

const barTerminalBottom = ((): number => {
if (isFullSizedTablet) {
if (isTablet) {
return -54
}
if (isSmallTablet) {
return 28
}
return 32
})()

const styles = StyleSheet.create({
root: {
flex: 1,
height: screenHeight,
bottom: isFullSizedTablet ? screenHeight / 2.5 : undefined,
bottom: isTablet ? screenHeight / 2.5 : undefined,
},
bar: {
position: 'absolute',
Expand All @@ -122,7 +114,7 @@ const styles = StyleSheet.create({
},
stationNameWrapper: {
flexDirection: 'row',
justifyContent: isFullSizedTablet ? 'flex-start' : undefined,
justifyContent: isTablet ? 'flex-start' : undefined,
marginLeft: 32,
flex: 1,
},
Expand All @@ -131,14 +123,14 @@ const styles = StyleSheet.create({
flexWrap: 'wrap',
justifyContent: 'flex-end',
bottom: isTablet ? 84 : undefined,
paddingBottom: !isFullSizedTablet ? 84 : undefined,
paddingBottom: !isTablet ? 84 : undefined,
},
stationName: {
textAlign: 'center',
fontSize: RFValue(18),
fontWeight: 'bold',
color: '#3a3a3a',
marginLeft: isFullSizedTablet ? 10 : 5,
marginLeft: isTablet ? 10 : 5,
marginBottom: Platform.select({
ios: 0,
android: isTablet ? 0 : -6,
Expand Down Expand Up @@ -166,13 +158,13 @@ const styles = StyleSheet.create({
height: isTablet ? 36 : 24,
position: 'absolute',
zIndex: 9999,
bottom: isFullSizedTablet ? -46 : 32 + 4,
bottom: isTablet ? -46 : 32 + 4,
overflow: 'visible',
},
chevron: {
position: 'absolute',
zIndex: 9999,
bottom: isSmallTablet ? 115 : 32,
bottom: 32,
marginLeft: widthScale(14),
width: isTablet ? 48 : 32,
height: isTablet ? 48 : 32,
Expand Down
42 changes: 14 additions & 28 deletions src/components/LineBoardToei.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LinearGradient } from 'expo-linear-gradient'
import React, { useCallback, useMemo, useState } from 'react'
import { Dimensions, Platform, StyleSheet, View } from 'react-native'
import { Dimensions, StyleSheet, View } from 'react-native'
import { RFValue } from 'react-native-responsive-fontsize'
import { useRecoilValue } from 'recoil'
import { Line, Station } from '../../gen/proto/stationapi_pb'
Expand All @@ -12,9 +12,7 @@ import lineState from '../store/atoms/line'
import stationState from '../store/atoms/station'
import { isEnSelector } from '../store/selectors/isEn'
import getStationNameR from '../utils/getStationNameR'
import isFullSizedTablet from '../utils/isFullSizedTablet'
import getIsPass from '../utils/isPass'
import isSmallTablet from '../utils/isSmallTablet'
import isTablet from '../utils/isTablet'
import { widthScale } from '../utils/scale'
import BarTerminal from './BarTerminalEast'
Expand Down Expand Up @@ -66,30 +64,24 @@ const getBarTerminalRight = (): number => {
}

const barBottom = ((): number => {
if (isFullSizedTablet) {
if (isTablet) {
return -52
}
if (isSmallTablet) {
return 30
}
return 32
})()

const barTerminalBottom = ((): number => {
if (isFullSizedTablet) {
if (isTablet) {
return -54
}
if (isSmallTablet) {
return 28
}
return 32
})()

const styles = StyleSheet.create({
root: {
flex: 1,
height: windowHeight,
bottom: isFullSizedTablet ? windowHeight / 2.5 : undefined,
bottom: isTablet ? windowHeight / 2.5 : undefined,
},
bar: {
position: 'absolute',
Expand All @@ -105,7 +97,7 @@ const styles = StyleSheet.create({
},
stationNameWrapper: {
flexDirection: 'row',
justifyContent: isFullSizedTablet ? 'flex-start' : undefined,
justifyContent: isTablet ? 'flex-start' : undefined,
marginLeft: 32,
flex: 1,
},
Expand All @@ -120,17 +112,14 @@ const styles = StyleSheet.create({
fontSize: RFValue(16),
fontWeight: 'bold',
marginLeft: isTablet ? 5 : 2.5,
marginBottom: Platform.select({
ios: 0,
android: isTablet ? 0 : -4,
}),
marginBottom: 0,
},
stationNameExtra: {
width: RFValue(10),
textAlign: 'center',
fontSize: RFValue(10),
fontWeight: 'bold',
marginBottom: Platform.select({ ios: 0, android: isTablet ? 0 : -4 }),
marginBottom: 0,
},
stationNameEn: {
fontSize: RFValue(16),
Expand All @@ -140,10 +129,7 @@ const styles = StyleSheet.create({
},
stationNameHorizontalContainer: {
position: 'relative',
bottom: Platform.select({
ios: 0,
android: isTablet ? -4 : 0,
}),
bottom: 0,
justifyContent: 'flex-start',
},
stationNameHorizontalWrapper: {
Expand Down Expand Up @@ -171,13 +157,13 @@ const styles = StyleSheet.create({
height: isTablet ? 36 : 24,
position: 'absolute',
zIndex: 9999,
bottom: isFullSizedTablet ? -46 : 32 + 4,
bottom: isTablet ? -46 : 32 + 4,
overflow: 'visible',
},
chevron: {
position: 'absolute',
zIndex: 9999,
bottom: isSmallTablet ? 115 : 32,
bottom: 32,
marginLeft: widthScale(14),
width: isTablet ? 48 : 32,
height: isTablet ? 48 : 32,
Expand All @@ -192,14 +178,14 @@ const styles = StyleSheet.create({
position: 'relative',
flexDirection: 'row',
alignItems: 'flex-end',
bottom: isSmallTablet ? 16 : 0,
bottom: 0,
},
stationNumber: {
width: isTablet ? 60 : 45,
marginLeft: -5,
fontSize: RFValue(12),
fontWeight: 'bold',
bottom: isSmallTablet ? 16 : 0,
bottom: 0,
textAlign: 'center',
},
marksContainer: { marginTop: 8 },
Expand Down Expand Up @@ -462,7 +448,7 @@ const StationNameCell: React.FC<StationNameCellProps> = ({
)

const getStationNumberIndex = useStationNumberIndexFunc()
const stationNumberIndex = getStationNumberIndex(currentStation ?? undefined)
const stationNumberIndex = getStationNumberIndex(currentStation)

return (
<>
Expand All @@ -471,7 +457,7 @@ const StationNameCell: React.FC<StationNameCellProps> = ({
style={[
styles.stationNameContainer,
{
paddingBottom: !isFullSizedTablet ? 64 : undefined,
paddingBottom: !isTablet ? 64 : undefined,
},
]}
>
Expand Down
Loading
Loading