UX: Update header background color in mobile app webview
Sends the updated value when switching color schemes.
This commit is contained in:
parent
89209985c8
commit
31e9e0c41b
|
@ -8,13 +8,19 @@ export default {
|
|||
|
||||
initialize() {
|
||||
if (isAppWebview()) {
|
||||
later(() => {
|
||||
const header = document.querySelectorAll(".d-header")[0];
|
||||
if (header) {
|
||||
const styles = window.getComputedStyle(header);
|
||||
postRNWebviewMessage("headerBg", styles.backgroundColor);
|
||||
}
|
||||
}, 500);
|
||||
window
|
||||
.matchMedia("(prefers-color-scheme: dark)")
|
||||
.addListener(this.updateAppBackground);
|
||||
this.updateAppBackground();
|
||||
}
|
||||
},
|
||||
updateAppBackground() {
|
||||
later(() => {
|
||||
const header = document.querySelectorAll(".d-header")[0];
|
||||
if (header) {
|
||||
const styles = window.getComputedStyle(header);
|
||||
postRNWebviewMessage("headerBg", styles.backgroundColor);
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue