Skip to content

Commit

Permalink
fixed NaN error
Browse files Browse the repository at this point in the history
  • Loading branch information
CD-Z committed Aug 15, 2023
1 parent 77a117f commit d13ad76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/screens/reader/ReaderScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,11 @@ const ChapterContent = ({ route, navigation }) => {
}
});
useEffect(() => {
webViewRef?.current?.injectJavaScript(
`${!readerPages} && document.querySelector('chapter').style.transform = 'translate(0%)';`,
);
if (!readerPages) {
webViewRef?.current?.injectJavaScript(
"document.querySelector('chapter').style.transform = 'translate(0%)';",
);
}
}, [readerPages]);
const scrollTo = useCallback(
offset => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ infoBox.classList.add("hidden");
id("spacer").style.height = infoBox.scrollHeight + 'px';
const pages = (Math.ceil(textWidth / clientWidth) - 1);
page = 0;
let page = 0;
navRight.addEventListener("click", () => {
page = select("chapter").getAttribute('data-page');
if (isNaN(page)) {
page = 0;
}
if (page < pages ) {
page++;
movePage();
Expand Down

0 comments on commit d13ad76

Please sign in to comment.