Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/expo-example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './global.css'
import React from 'react'
import { Image, ScrollView, Text, TextInput, TouchableOpacity, View } from 'react-native'
import { ScrollView, Text, TextInput, TouchableOpacity, View } from 'react-native'

const TailwindTestPage = () => {
return (
Expand Down
3 changes: 0 additions & 3 deletions apps/expo-router/utils/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ export const useStoredTheme = () => {
// Set the theme
Uniwind.setTheme(t)

// Set the native color scheme
Appearance.setColorScheme(getNativeColorScheme(t))

// Store the theme
setStoredTheme(t)
},
Expand Down
5 changes: 5 additions & 0 deletions packages/uniwind/src/core/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class UniwindConfigBuilder {
setTheme(theme: ThemeName | typeof SYSTEM_THEME) {
const prevTheme = this.#currentTheme
const prevHasAdaptiveThemes = this.#hasAdaptiveThemes
const isAdaptiveTheme = ['light', 'dark'].includes(theme)

if (theme === SYSTEM_THEME) {
this.#hasAdaptiveThemes = true
Expand All @@ -58,6 +59,8 @@ class UniwindConfigBuilder {
this.emitThemeChange()
}

Appearance.setColorScheme(isAdaptiveTheme ? this.#currentTheme as ColorScheme : undefined)

return
}

Expand All @@ -71,6 +74,8 @@ class UniwindConfigBuilder {
if (prevTheme !== this.#currentTheme || prevHasAdaptiveThemes !== this.#hasAdaptiveThemes) {
this.emitThemeChange()
}

Appearance.setColorScheme(isAdaptiveTheme ? this.#currentTheme as ColorScheme : undefined)
}

private emitThemeChange() {
Expand Down