From d8b5905ea6d7931e9b9cdc95491a40b35cdfba38 Mon Sep 17 00:00:00 2001 From: Tsubasa SEKIGUCHI Date: Tue, 13 Aug 2024 01:28:50 +0900 Subject: [PATCH] =?UTF-8?q?StationList=E3=82=B3=E3=83=B3=E3=83=9D=E3=83=BC?= =?UTF-8?q?=E3=83=8D=E3=83=B3=E3=83=88UI=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/StationList.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/StationList.tsx b/src/components/StationList.tsx index d4dbbdf10..cda0be0e4 100644 --- a/src/components/StationList.tsx +++ b/src/components/StationList.tsx @@ -5,7 +5,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context' import { Station } from '../../gen/proto/stationapi_pb' import { useThemeStore } from '../hooks/useThemeStore' import { APP_THEME } from '../models/Theme' -import { isJapanese } from '../translation' +import { isJapanese, translate } from '../translation' import Typography from './Typography' const styles = StyleSheet.create({ @@ -18,10 +18,22 @@ const styles = StyleSheet.create({ marginTop: 8, }, separator: { height: 1, width: '100%', backgroundColor: '#aaa' }, + emptyText: { + textAlign: 'center', + marginTop: 12, + fontSize: RFValue(14), + fontWeight: 'bold', + }, }) const Separator = () => +const ListEmptyComponent = () => ( + + {translate('stationListEmpty')} + +) + const ItemCell = ({ item, onSelect, @@ -93,7 +105,7 @@ export const StationList = ({ /> ) }, - [onSelect] + [onSelect, withoutTransfer] ) const keyExtractor = useCallback((item: Station) => item.id.toString(), []) const { bottom: safeAreaBottom } = useSafeAreaInsets() @@ -114,7 +126,7 @@ export const StationList = ({ renderItem={renderItem} keyExtractor={keyExtractor} ItemSeparatorComponent={Separator} - ListFooterComponent={Separator} + ListEmptyComponent={ListEmptyComponent} /> ) }