Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appearance.setColorScheme not workin in RN Web #2703

Open
1 task done
NewCoder2023 opened this issue Jul 29, 2024 · 2 comments
Open
1 task done

Appearance.setColorScheme not workin in RN Web #2703

NewCoder2023 opened this issue Jul 29, 2024 · 2 comments
Labels

Comments

@NewCoder2023
Copy link

NewCoder2023 commented Jul 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the issue

Appearance.setColorScheme("dark") works perfectly fine for iOS and Android but raises the following Error when used for RN web even thought its written in the documentation that it works for web.

_Appearance.default.setColorScheme is not a function. (In '_Appearance.default.setColorScheme("dark")',
'_Appearance.default.setColorScheme' is undefined)

Expected behavior

It should change the colorScheme.

Steps to reproduce

1.Create a Pressable
2. onPress={Appearance.setColorScheme("dark")}
3. Observe error in RN web

Test case

https://snack.expo.dev/@hadi_ea/setcolorscheme-error

Additional comments

Error:

Uncaught Error
_Appearance.default.setColorScheme is not a function. (In '_Appearance.default.setColorScheme("dark")', '_Appearance.default.setColorScheme' is undefined)
Call Stack

Source Map
This call stack is not symbolicated. Some features are unavailable such as viewing the function name or tapping to open files.
index
http://localhost:8081/node_modules/expo-router/entry.bundle:153573:52
renderWithHooks
http://localhost:8081/node_modules/expo-router/entry.bundle:25695:33
mountIndeterminateComponent
http://localhost:8081/node_modules/expo-router/entry.bundle:28984:34
beginWork$1
http://localhost:8081/node_modules/expo-router/entry.bundle:35239:29
performUnitOfWork
http://localhost:8081/node_modules/expo-router/entry.bundle:34509:29
workLoopSync
http://localhost:8081/node_modules/expo-router/entry.bundle:34432:28
renderRootSync
http://localhost:8081/node_modules/expo-router/entry.bundle:34405:25
recoverFromConcurrentError
http://localhost:8081/node_modules/expo-router/entry.bundle:33897:40
performConcurrentWorkOnRoot
http://localhost:8081/node_modules/expo-router/entry.bundle:33810:54
workLoop
http://localhost:8081/node_modules/expo-router/entry.bundle:37546:48
flushWork
http://localhost:8081/node_modules/expo-router/entry.bundle:37524:28
performWorkUntilDeadline
http://localhost:8081/node_modules/expo-router/entry.bundle:37761:48
Showing all frames
Component Stack

Source Map
This call stack is not symbolicated. Some features are unavailable such as viewing the function name or tapping to open files.
index
http://localhost:8081/node_modules/expo-router/entry.bundle:153566:43
Route
http://localhost:8081/node_modules/expo-router/entry.bundle:65953:44
Route
http://localhost:8081/node_modules/expo-router/entry.bundle:66319:41
StaticContainer
http://localhost:8081/node_modules/expo-router/entry.bundle:165743:17
EnsureSingleNavigator
http://localhost:8081/node_modules/expo-router/entry.bundle:163244:34
SceneView
http://localhost:8081/node_modules/expo-router/entry.bundle:165668:13
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
Background
http://localhost:8081/node_modules/expo-router/entry.bundle:167963:43
Screen
http://localhost:8081/node_modules/expo-router/entry.bundle:169069:73
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26

ResourceSavingScene@http://localhost:8081/node_modules/expo-router/entry.bundle:168879:43
MaybeScreen
http://localhost:8081/node_modules/expo-router/entry.bundle:194647:43
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
MaybeScreenContainer
http://localhost:8081/node_modules/expo-router/entry.bundle:194632:43
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
AnimatedComponent
http://localhost:8081/node_modules/expo-router/entry.bundle:137743:14
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
AnimatedComponent
http://localhost:8081/node_modules/expo-router/entry.bundle:137743:14
Dummy
http://localhost:8081/node_modules/expo-router/entry.bundle:194577:30
Drawer
http://localhost:8081/node_modules/expo-router/entry.bundle:195353:13
DrawerViewBase
http://localhost:8081/node_modules/expo-router/entry.bundle:193870:12
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
SafeAreaProviderCompat
http://localhost:8081/node_modules/expo-router/entry.bundle:168965:25
DrawerView
http://localhost:8081/node_modules/expo-router/entry.bundle:194056:43
PreventRemoveProvider
http://localhost:8081/node_modules/expo-router/entry.bundle:164734:14
NavigationContent
http://localhost:8081/node_modules/expo-router/entry.bundle:165449:18

http://localhost:8081/node_modules/expo-router/entry.bundle:165465:31
DrawerNavigator
http://localhost:8081/node_modules/expo-router/entry.bundle:193742:57

http://localhost:8081/node_modules/expo-router/entry.bundle:65839:41
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
GestureHandlerRootView
http://localhost:8081/node_modules/expo-router/entry.bundle:188967:43
Route
http://localhost:8081/node_modules/expo-router/entry.bundle:65953:44
Route
http://localhost:8081/node_modules/expo-router/entry.bundle:66319:41
StaticContainer
http://localhost:8081/node_modules/expo-router/entry.bundle:165743:17
EnsureSingleNavigator
http://localhost:8081/node_modules/expo-router/entry.bundle:163244:34
SceneView
http://localhost:8081/node_modules/expo-router/entry.bundle:165668:13
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
Background
http://localhost:8081/node_modules/expo-router/entry.bundle:167963:43
Screen
http://localhost:8081/node_modules/expo-router/entry.bundle:169069:73
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
SafeAreaProviderCompat
http://localhost:8081/node_modules/expo-router/entry.bundle:168965:25
NativeStackView
http://localhost:8081/node_modules/expo-router/entry.bundle:167645:13
PreventRemoveProvider
http://localhost:8081/node_modules/expo-router/entry.bundle:164734:14
NavigationContent
http://localhost:8081/node_modules/expo-router/entry.bundle:165449:18

http://localhost:8081/node_modules/expo-router/entry.bundle:165465:31
NativeStackNavigator
http://localhost:8081/node_modules/expo-router/entry.bundle:161280:43

http://localhost:8081/node_modules/expo-router/entry.bundle:65839:41
ThemeProvider
http://localhost:8081/node_modules/expo-router/entry.bundle:166733:30
RootLayout
http://localhost:8081/node_modules/expo-router/entry.bundle:159820:45
Route
http://localhost:8081/node_modules/expo-router/entry.bundle:65953:44
Route
http://localhost:8081/node_modules/expo-router/entry.bundle:66319:41
View
http://localhost:8081/node_modules/expo-router/entry.bundle:39052:26
NativeSafeAreaProvider
http://localhost:8081/node_modules/expo-router/entry.bundle:160992:19
SafeAreaProvider
http://localhost:8081/node_modules/expo-router/entry.bundle:160865:45
wrapper
http://localhost:8081/node_modules/expo-router/entry.bundle:73992:46
EnsureSingleNavigator
http://localhost:8081/node_modules/expo-router/entry.bundle:163244:34
BaseNavigationContainer
http://localhost:8081/node_modules/expo-router/entry.bundle:161911:13
ThemeProvider
http://localhost:8081/node_modules/expo-router/entry.bundle:166733:30
NavigationContainerInner
http://localhost:8081/node_modules/expo-router/entry.bundle:74246:25
ContextNavigator
http://localhost:8081/node_modules/expo-router/entry.bundle:74026:43
ExpoRoot
http://localhost:8081/node_modules/expo-router/entry.bundle:73981:41
_HelmetProvider
http://localhost:8081/node_modules/expo-router/entry.bundle:201567:12
AppContainer
http://localhost:8081/node_modules/expo-router/entry.bundle:51978:24
Showing all frames

@oussamabenkortbi
Copy link

Same here, any workaround ?

@NewCoder2023
Copy link
Author

I managed it by using a global state management (Zustand) and listen to changes and change color accordingly but it’s not that satisfying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants