Page Reader
Added an improved version of my Page Reader PR in the main branch. #733
Improvements:
- pages instead of percent
- working scrollbars
- Chapter switch at the end or beginning of a chapter like a normal page
- autoscroll to last position
Additional changes:
- added change padding setting to reader
- fixed scroll to top button in reader
btw I recommend updating pageReader setting without re-rendering by using Reader.updateGengeralSettings (if possilbe)
Any changes in settings are listened by this code (WebviewReader.tsx), then it triggers to Webview without update state in React
const mmkvListener = MMKVStorage.addOnValueChangedListener(key => {
switch (key) {
case CHAPTER_READER_SETTINGS:
webViewRef.current?.injectJavaScript(
`reader.updateReaderSettings(${MMKVStorage.getString(
CHAPTER_READER_SETTINGS,
)})`,
);
break;
case CHAPTER_GENERAL_SETTINGS:
webViewRef.current?.injectJavaScript(
`reader.updateGeneralSettings(${MMKVStorage.getString(
CHAPTER_GENERAL_SETTINGS,
)})`,
);
break;
}
btw I recommend updating pageReader setting without re-rendering by using Reader.updateGengeralSettings (if possilbe)
Any changes in settings are listened by this code (WebviewReader.tsx), then it triggers to Webview without update state in React
const mmkvListener = MMKVStorage.addOnValueChangedListener(key => { switch (key) { case CHAPTER_READER_SETTINGS: webViewRef.current?.injectJavaScript( `reader.updateReaderSettings(${MMKVStorage.getString( CHAPTER_READER_SETTINGS, )})`, ); break; case CHAPTER_GENERAL_SETTINGS: webViewRef.current?.injectJavaScript( `reader.updateGeneralSettings(${MMKVStorage.getString( CHAPTER_GENERAL_SETTINGS, )})`, ); break; }
I took a look at it and if I understand you correctly you suggest to not rerender the page when changing from the normal view to the page view.
If this is correct then I don't really see the reason, since it is not easy to change the behavior and would introduce issues that would have to be dealt with. For example the scroll position.
@nyagami could you please take another look at this, I don't want to always solve the merge conflicts. It gets annoying
Okay