Hi! Aurora theme should be the default for web (and electron). How to do this in React?
It is default for Electron if theme: 'auto'
. If you need to make it default for desktop web, pass the following to the theme:
theme: this.$device.desktop ? 'aurora' : 'auto'
Hi,
I get : Cannot read property ‘desktop’ of undefined
If I try it on Framework7 init.
Regards
It depends on where do you call it. Can you show the full code of the file where you initialize it?
const app = new Framework7({
root: '#app',
theme: this.$device.desktop ? 'aurora' : 'auto',
})
The device information is not yet available when passing params to initialize Framework7
It is available and not depends on F7 init because it is a class static property. So if you do it outside of React component context, like @guillaumebiton, you can use like so:
const app = new Framework7({
root: '#app',
theme: Framework7.desktop ? 'aurora' : 'auto',
})
and anywhere else:
import Framework7 from 'framework7';
if (Framework7.device.desktop) {
// do something
}
Framework7.device.desktop in the first example too. Thanks!
I still like the idea that the default theme on the web should have button hover. Maybe it is a breaking change for people? In that case need to wait until 5. No matter though, I have it working well now. Thanks again!