diff --git a/src/screens/reader/ReaderScreen.js b/src/screens/reader/ReaderScreen.js index 792b11e0..ebf23e73 100644 --- a/src/screens/reader/ReaderScreen.js +++ b/src/screens/reader/ReaderScreen.js @@ -158,7 +158,7 @@ const ChapterContent = ({ route, navigation }) => { if (!(id && (result = await getChapterFromDb(id)))) { result = await fetchChapter(sourceId, novelUrl, chapterUrl); } - setChapter(result); + setChapter({ ...result, bookmark }); } catch (e) { setError(e.message); showToast(e.message); @@ -331,6 +331,9 @@ const ChapterContent = ({ route, navigation }) => { return ; } + const bookmarkChapter = () => + setChapter(prevVal => ({ ...prevVal, bookmark: !prevVal?.bookmark })); + return ( <> { {!hidden && ( <> { const dispatch = useAppDispatch(); const { goBack } = useNavigation(); - const [bookmarked, setBookmarked] = useState(bookmark); return ( { dispatch(bookmarkChapterAction([{ bookmark, chapterId }])); - setBookmarked(!bookmarked); + bookmarkChapter(); }} iconColor={theme.onSurface} theme={theme}