myxvisual / react-uwp

📱⌨ React Components that Implement Microsoft's UWP Design & Fluent Design.
https://react-uwp.com
MIT License
1.18k stars 78 forks source link

Uncaught TypeError: Cannot convert undefined or null to object - When trying to change theme using local state(Toggling between 'dark' and 'light' ). #81

Open sachinpardeshi01 opened 5 years ago

sachinpardeshi01 commented 5 years ago

Uncaught TypeError: Cannot convert undefined or null to object When trying to change theme using local state(Toggling between 'dark' and 'light' ) gives error and UI breaks when loading page with new theme.

To Reproduce Steps to reproduce the behavior:

  1. Create dropdown to choose between themes (values ['dark', 'light'])
  2. Add onchange handler which will toggle value between dark and light.
  3. pass this theme string in state to getTheme [ Imported from 'react-uwp/Theme'] to change theme dyanamically.
  4. On dropdown change this error fired.

Expected behavior It should allow to change theme dyanamically.

Additional context Toggle state between 'dark' and 'light' and passing it to getTheme for react-uwp/theme causes error breaking the UI.