Merge pull request #1260 from bluesky-social/eric/fix-window

fix bad reference on native
zio/stable
Eric Bailey 2023-08-23 14:34:41 -05:00 committed by GitHub
commit acad8cb455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import {ImageModel} from '../media/image'
import {ListModel} from '../content/list'
import {GalleryModel} from '../media/gallery'
import {StyleProp, ViewStyle} from 'react-native'
import {isWeb} from 'platform/detection'
export type ColorMode = 'system' | 'light' | 'dark'
@ -275,7 +276,7 @@ export class ShellUiModel {
setColorMode(mode: ColorMode) {
this.colorMode = mode
if (typeof window !== 'undefined') {
if (isWeb && typeof window !== 'undefined') {
const html = window.document.documentElement
// remove any other color mode classes
html.className = html.className.replace(/colorMode--\w+/g, '')