Minor fixes
This commit is contained in:
@@ -150,9 +150,7 @@ const Chapter = ({ route, navigation }) => {
|
||||
<Appbar.Action
|
||||
icon="dots-vertical"
|
||||
size={26}
|
||||
onPress={() =>
|
||||
readerSheetRef.current.show({ velocity: -1.5 })
|
||||
}
|
||||
onPress={() => readerSheetRef.current.show()}
|
||||
color="#FFFFFF"
|
||||
/>
|
||||
</Appbar.Header>
|
||||
|
||||
+17
-94
@@ -1,7 +1,7 @@
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { StyleSheet, View, FlatList, RefreshControl } from "react-native";
|
||||
|
||||
import { Provider, Portal, IconButton } from "react-native-paper";
|
||||
import { Provider, Portal } from "react-native-paper";
|
||||
import { useDispatch } from "react-redux";
|
||||
|
||||
import {
|
||||
@@ -9,8 +9,6 @@ import {
|
||||
getNovelAction,
|
||||
markChapterReadAction,
|
||||
markChapterUnreadAction,
|
||||
markPreviousChaptersReadAction,
|
||||
markPreviousChaptersUnreadAction,
|
||||
sortAndFilterChapters,
|
||||
updateNovelAction,
|
||||
} from "../../redux/novel/novel.actions";
|
||||
@@ -27,7 +25,6 @@ import NovelInfoHeader from "./components/NovelHeader";
|
||||
import ChaptersSettingsSheet from "./components/ChaptersSettingsSheet";
|
||||
import TrackSheet from "./components/Tracker/TrackSheet";
|
||||
import ChapterActionsSheet from "./components/ChapterActionsSheet";
|
||||
import { SwipeListView } from "react-native-swipe-list-view";
|
||||
|
||||
const Novel = ({ route, navigation }) => {
|
||||
const item = route.params;
|
||||
@@ -69,22 +66,6 @@ const Novel = ({ route, navigation }) => {
|
||||
/>
|
||||
);
|
||||
|
||||
const ListHeaderComponent = () => (
|
||||
<NovelInfoHeader
|
||||
item={item}
|
||||
novel={novel}
|
||||
theme={theme}
|
||||
filter={filter}
|
||||
loading={loading}
|
||||
lastRead={lastRead}
|
||||
dispatch={dispatch}
|
||||
chapters={chapters}
|
||||
navigation={navigation}
|
||||
trackerSheetRef={trackerSheetRef}
|
||||
chaptersSettingsSheetRef={chaptersSettingsSheetRef}
|
||||
/>
|
||||
);
|
||||
|
||||
const renderItem = ({ item }) => (
|
||||
<ChapterItem
|
||||
theme={theme}
|
||||
@@ -100,73 +81,6 @@ const Novel = ({ route, navigation }) => {
|
||||
/>
|
||||
);
|
||||
|
||||
const closeRow = (rowMap, rowKey) => {
|
||||
if (rowMap[rowKey]) {
|
||||
rowMap[rowKey].closeRow();
|
||||
}
|
||||
};
|
||||
|
||||
const renderHiddenItem = (data, rowMap) => (
|
||||
<View style={styles.rowBack}>
|
||||
<View
|
||||
style={{
|
||||
flex: 1 / 2,
|
||||
height: "100%",
|
||||
backgroundColor: theme.colorAccent,
|
||||
paddingLeft: 12,
|
||||
alignItems: "flex-start",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<IconButton
|
||||
icon={data.item.bookmark ? "bookmark-off" : "bookmark"}
|
||||
color="white"
|
||||
size={23}
|
||||
onPress={() => {
|
||||
closeRow(rowMap, data.item.chapterId.toString());
|
||||
dispatch(
|
||||
bookmarkChapterAction(
|
||||
data.item.bookmark,
|
||||
data.item.chapterId
|
||||
)
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
<View
|
||||
style={{
|
||||
flex: 1 / 2,
|
||||
alignItems: "flex-end",
|
||||
justifyContent: "center",
|
||||
height: "100%",
|
||||
backgroundColor: "#2E7D32",
|
||||
paddingRight: 12,
|
||||
}}
|
||||
>
|
||||
<IconButton
|
||||
onPress={() => {
|
||||
closeRow(rowMap, data.item.chapterId.toString());
|
||||
if (data.item.read) {
|
||||
dispatch(
|
||||
markChapterUnreadAction(data.item.chapterId)
|
||||
);
|
||||
} else {
|
||||
dispatch(
|
||||
markChapterReadAction(
|
||||
data.item.chapterId,
|
||||
novel.novelId
|
||||
)
|
||||
);
|
||||
}
|
||||
}}
|
||||
icon={data.item.read ? "eye-off" : "eye"}
|
||||
color="white"
|
||||
size={23}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
||||
return (
|
||||
<Provider>
|
||||
<View
|
||||
@@ -175,21 +89,30 @@ const Novel = ({ route, navigation }) => {
|
||||
{ backgroundColor: theme.colorPrimaryDark },
|
||||
]}
|
||||
>
|
||||
<SwipeListView
|
||||
<FlatList
|
||||
data={!loading && chapters}
|
||||
keyExtractor={(item) => item.chapterId.toString()}
|
||||
removeClippedSubviews={true}
|
||||
maxToRenderPerBatch={5}
|
||||
windowSize={15}
|
||||
initialNumToRender={7}
|
||||
renderHiddenItem={renderHiddenItem}
|
||||
renderItem={renderItem}
|
||||
ListHeaderComponent={ListHeaderComponent}
|
||||
ListHeaderComponent={
|
||||
<NovelInfoHeader
|
||||
item={item}
|
||||
novel={novel}
|
||||
theme={theme}
|
||||
filter={filter}
|
||||
loading={loading}
|
||||
lastRead={lastRead}
|
||||
dispatch={dispatch}
|
||||
chapters={chapters}
|
||||
navigation={navigation}
|
||||
trackerSheetRef={trackerSheetRef}
|
||||
chaptersSettingsSheetRef={chaptersSettingsSheetRef}
|
||||
/>
|
||||
}
|
||||
refreshControl={refreshControl()}
|
||||
leftOpenValue={75}
|
||||
stopLeftSwipe={75}
|
||||
rightOpenValue={-75}
|
||||
stopRightSwipe={-75}
|
||||
/>
|
||||
{!loading && (
|
||||
<Portal>
|
||||
|
||||
@@ -18,6 +18,7 @@ const ChapterActionsSheet = ({
|
||||
markChapterUnreadAction,
|
||||
dispatch,
|
||||
bookmarkChapterAction,
|
||||
setSelected,
|
||||
}) => {
|
||||
const [animatedValue] = useState(new Animated.Value(0));
|
||||
|
||||
@@ -62,7 +63,7 @@ const ChapterActionsSheet = ({
|
||||
selected?.novelId
|
||||
)
|
||||
);
|
||||
bottomSheetRef.current.hide();
|
||||
// bottomSheetRef.current.hide();
|
||||
}}
|
||||
rippleColor={theme.rippleColor}
|
||||
/>
|
||||
@@ -83,7 +84,7 @@ const ChapterActionsSheet = ({
|
||||
selected?.novelId
|
||||
)
|
||||
);
|
||||
bottomSheetRef.current.hide();
|
||||
// bottomSheetRef.current.hide();
|
||||
}}
|
||||
rippleColor={theme.rippleColor}
|
||||
/>
|
||||
@@ -106,6 +107,10 @@ const ChapterActionsSheet = ({
|
||||
dispatch(
|
||||
markChapterUnreadAction(selected?.chapterId)
|
||||
);
|
||||
setSelected((selected) => ({
|
||||
...selected,
|
||||
read: 0,
|
||||
}));
|
||||
} else {
|
||||
dispatch(
|
||||
markChapterReadAction(
|
||||
@@ -113,8 +118,12 @@ const ChapterActionsSheet = ({
|
||||
selected?.novelId
|
||||
)
|
||||
);
|
||||
setSelected((selected) => ({
|
||||
...selected,
|
||||
read: 1,
|
||||
}));
|
||||
}
|
||||
bottomSheetRef.current.hide();
|
||||
// bottomSheetRef.current.hide();
|
||||
}}
|
||||
rippleColor={theme.rippleColor}
|
||||
/>
|
||||
@@ -141,7 +150,12 @@ const ChapterActionsSheet = ({
|
||||
selected?.chapterId
|
||||
)
|
||||
);
|
||||
bottomSheetRef.current.hide();
|
||||
setSelected((selected) => ({
|
||||
...selected,
|
||||
bookmark: !selected.bookmark,
|
||||
}));
|
||||
|
||||
// bottomSheetRef.current.hide();
|
||||
}}
|
||||
rippleColor={theme.rippleColor}
|
||||
/>
|
||||
|
||||
@@ -208,11 +208,7 @@ const NovelInfoHeader = ({
|
||||
/>
|
||||
<TouchableRipple
|
||||
style={styles.bottomsheet}
|
||||
onPress={() =>
|
||||
chaptersSettingsSheetRef.current.show({
|
||||
velocity: -1.5,
|
||||
})
|
||||
}
|
||||
onPress={() => chaptersSettingsSheetRef.current.show()}
|
||||
rippleColor={theme.rippleColor}
|
||||
>
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user