5-stones / react-native-readium

📚 📖 React Native ebook reader for iOS, Android, & Web via Readium
MIT License
83 stars 25 forks source link

[Bug] Reader view brightness does not match system #26

Closed AmrithVengalath closed 1 month ago

AmrithVengalath commented 1 year ago

I'm having issues with brightness on the page I implemented Readium. The brightness is the same as the system brightness on other pages in the app, but the brightness changes when I navigate to the page with Readium. Also I would like to know if there is any way to control the brightness as in the kotlin-readium?

mickael-menu commented 1 year ago

Note that brightness is not an official preference in the Readium toolkit and is out-of-scope. The test app used to have an example brightness control but I removed it in the last version. It was using Android's screenBrightness property on LayoutParams.

jspizziri commented 1 year ago

@mickael-menu do you know why the brightness of the toolkit view would not be the same as the system brightness? Or really why there would appear to be a change between the two? Thanks for your help!

mickael-menu commented 1 year ago

Yeah, here you are setting the brightness for the reading activity window. If you leave this activity, it reverts to the system brightness.

https://github.com/5-stones/react-native-readium/blob/5671a7035895fad130669a087e664817311df534/android/src/main/java/com/reactnativereadium/epub/UserSettings.kt#L65-L69

If you used this, maybe this would apply system-wide. But I never tried it: https://developer.android.com/reference/android/provider/Settings.System#SCREEN_BRIGHTNESS

But IMO brightness should be the responsibility of the app and not the Readium toolkit. So I would just remove this brightness preference from your package.

jspizziri commented 1 month ago

@AmrithVengalath this is fixed in https://github.com/5-stones/react-native-readium/commit/8af916b86a3c42a9abc02a63aa239fa6e8c4e8a5.

this package will simply inherit the brightness of your device.