Skip to content

Commit

Permalink
fix: date in chapter drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
nyagami committed Jan 22, 2024
1 parent b0473b3 commit 16b93b5
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions src/screens/reader/components/ChapterDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { getString } from '@strings/translations';
import { ChapterScreenProps } from '@navigators/types';
import { ChapterInfo } from '@database/types';
import { ThemeColors } from '@theme/types';
import dayjs from 'dayjs';

const ChapterDrawer = ({ route, navigation }: ChapterScreenProps) => {
const theme = useTheme();
Expand Down Expand Up @@ -60,29 +61,32 @@ const ChapterDrawer = ({ route, navigation }: ChapterScreenProps) => {
chapter: item,
});
};
const renderItem: FlashListProps<ChapterInfo>['renderItem'] = ({ item }) => (
<View
style={[
styles.drawerElementContainer,
item.id === chapter.id && {
backgroundColor: color(theme.primary).alpha(0.12).string(),
},
]}
>
<Pressable
android_ripple={{ color: theme.rippleColor }}
onPress={() => changeChapter(item)}
style={styles.chapterCtn}
const renderItem: FlashListProps<ChapterInfo>['renderItem'] = ({ item }) => {
const parsedTime = dayjs(item.releaseTime);
return (
<View
style={[
styles.drawerElementContainer,
item.id === chapter.id && {
backgroundColor: color(theme.primary).alpha(0.12).string(),
},
]}
>
<Text numberOfLines={1} style={styles.chapterNameCtn}>
{item.name}
</Text>
{item.readTime ? (
<Text style={styles.releaseDateCtn}>{item.releaseTime}</Text>
) : null}
</Pressable>
</View>
);
<Pressable
android_ripple={{ color: theme.rippleColor }}
onPress={() => changeChapter(item)}
style={styles.chapterCtn}
>
<Text numberOfLines={1} style={styles.chapterNameCtn}>
{item.name}
</Text>
<Text style={styles.releaseDateCtn}>
{parsedTime.isValid() ? parsedTime.format('LL') : item.readTime}
</Text>
</Pressable>
</View>
);
};

const ListFooter = () => {
return (
Expand Down

0 comments on commit 16b93b5

Please sign in to comment.