NativeScript / theme

@nativescript/theme
https://v7.docs.nativescript.org/ui/theme
Apache License 2.0
127 stars 44 forks source link

appCommon is not defined when resetting to auto mode. #280

Closed jamescodesthings closed 3 years ago

jamescodesthings commented 3 years ago

Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

├── nativescript@7.0.10
├── @nativescript/android@7.0.0
├── @nativescript/angular@10.1.7
├── @nativescript/ios@7.0.3
├── @nativescript/theme@3.0.0

Describe the bug When calling Theme.setMode(Theme.Auto) I receive the following error in both Android and iOS:

JS: Stacktrace: ReferenceError: appCommon is not defined
JS:     at Function.setMode (file: node_modules/@nativescript/theme/index.js:55:0)
...

I think the issue is:

// Reset to Auto system theme
setTimeout(appCommon.systemAppearanceChanged.bind(this, Theme.rootView, Application.systemAppearance()));

// Should be
setTimeout(Application.systemAppearanceChanged.bind(this, Theme.rootView, Application.systemAppearance()));

Will open PR.

To Reproduce Call Theme.setMode(Theme.Auto);. Have checked in @nativescript/theme@3.0.0 and @nativescript/theme@2.5.0.

Expected behavior Theme.setMode(Theme.Auto) Resets theme to system default.

Additional context N/A