Merge pull request #1147 from omnivore-app/fix/ios-theme-updater

Fix issues with theme not being properly updated in iOS when the system dark/light mode changes
This commit is contained in:
Jackson Harper 2022-08-29 12:28:09 +08:00 committed by GitHub
commit 014bfd0f32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 6 deletions

View file

@ -300,7 +300,7 @@ public enum WebViewDispatchEvent {
case let .updateFontSize(size: size):
return "event.fontSize = '\(size)';"
case let .updateColorMode(isDark: isDark):
return "event.isDarkMode = '\(isDark)';"
return "event.isDark = '\(isDark)';"
case let .updateFontFamily(family: family):
return "event.fontFamily = '\(family)';"
case let .saveAnnotation(annotation: annotation):

File diff suppressed because one or more lines are too long

View file

@ -3,7 +3,8 @@
"version": "1.0.0",
"private": true,
"scripts": {
"build": "webpack --mode production"
"build": "webpack --mode production",
"build-and-update": "yarn build && cp build/bundle.js ../../apple/OmnivoreKit/Sources/Views/Resources/bundle.js"
},
"dependencies": {
"@omnivore/web": "1.0.0"

View file

@ -125,12 +125,12 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element {
}
interface UpdateColorModeEvent extends Event {
isDark?: boolean
isDark?: string
}
const updateColorMode = (event: UpdateColorModeEvent) => {
const isDark = event.isDark ?? false
updateThemeLocally(isDark ? ThemeId.Dark : ThemeId.Light)
const isDark = event.isDark ?? "false"
updateThemeLocally(isDark === "true" ? ThemeId.Dark : ThemeId.Light)
}
const share = () => {