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

StationListコンポーネントUI修正 #3678

Merged
merged 1 commit into from
Aug 12, 2024
Merged
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
18 changes: 15 additions & 3 deletions src/components/StationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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 = () => <View style={styles.separator} />

const ListEmptyComponent = () => (
<Typography style={styles.emptyText}>
{translate('stationListEmpty')}
</Typography>
)

const ItemCell = ({
item,
onSelect,
Expand Down Expand Up @@ -93,7 +105,7 @@ export const StationList = ({
/>
)
},
[onSelect]
[onSelect, withoutTransfer]
)
const keyExtractor = useCallback((item: Station) => item.id.toString(), [])
const { bottom: safeAreaBottom } = useSafeAreaInsets()
Expand All @@ -114,7 +126,7 @@ export const StationList = ({
renderItem={renderItem}
keyExtractor={keyExtractor}
ItemSeparatorComponent={Separator}
ListFooterComponent={Separator}
ListEmptyComponent={ListEmptyComponent}
/>
)
}
Loading