Skip to content

Commit

Permalink
Merge pull request #3722 from TrainLCD/fix/route-search
Browse files Browse the repository at this point in the history
経路検索バグ修正
  • Loading branch information
TinyKitten authored Sep 1, 2024
2 parents e948efc + 9b4843c commit 64da9de
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
9 changes: 6 additions & 3 deletions src/components/RouteListModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Modal, StyleSheet, View } from 'react-native'
import { ActivityIndicator, Modal, StyleSheet, View } from 'react-native'
import { useSafeAreaInsets } from 'react-native-safe-area-context'
import { Route } from '../../gen/proto/stationapi_pb'
import { LED_THEME_BG_COLOR } from '../constants'
Expand Down Expand Up @@ -40,6 +40,7 @@ const styles = StyleSheet.create({
alignSelf: 'center',
marginTop: 12,
},
loading: { marginTop: 12 },
})

const SAFE_AREA_FALLBACK = 32
Expand Down Expand Up @@ -100,9 +101,11 @@ export const RouteListModal: React.FC<Props> = ({
>
<Heading>{translate('routeSearchTitle')}</Heading>
</View>
{routes.length ? (
{loading ? (
<ActivityIndicator style={styles.loading} />
) : (
<RouteList data={routes} onSelect={onSelect} />
) : null}
)}
</View>
</View>
<FAB onPress={onClose} icon="close" />
Expand Down
21 changes: 10 additions & 11 deletions src/screens/RouteSearchScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ const RouteSearchScreen = () => {
[
currentStation?.groupId,
navigation,
routesData,
selectedStation?.groupId,
setLineState,
setNavigationState,
setStationState,
withoutPassStationRoutes,
]
)

Expand Down Expand Up @@ -326,16 +326,15 @@ const RouteSearchScreen = () => {
</KeyboardAvoidingView>
</View>
<FAB onPress={onPressBack} icon="close" />
{routesData?.length ? (
<RouteListModal
visible={isRouteListModalVisible}
routes={withoutPassStationRoutes}
loading={isRoutesLoading}
error={fetchRoutesError}
onClose={() => setIsRouteListModalVisible(false)}
onSelect={handleSelect}
/>
) : null}

<RouteListModal
visible={isRouteListModalVisible}
routes={withoutPassStationRoutes}
loading={isRoutesLoading}
error={fetchRoutesError}
onClose={() => setIsRouteListModalVisible(false)}
onSelect={handleSelect}
/>
</>
)
}
Expand Down

0 comments on commit 64da9de

Please sign in to comment.