Modifier (UI) set default web modifier



  • Hey!

    I was wondering: Is it possible to set the default modifier to “material” for components?
    Now, when viewing in browser the UI is flat design. Is it possible to set this default to “material”
    without specifically setting the modifier (so it doesn’t use material design on iOS).

    Regards,
    Maxim


  • Onsen UI

    @Maxim-Van-de-Wynckel Hello! Modifier material is set if platform is ‘android’. You can force the platform by calling ons.platform.select('android') at the beginning of the app. You can also use these methods to filter platforms. For example:

    if (!ons.platform.isIOS()) {
      ons.platform.select('android');
    }
    

    I think that should display flat design for iOS and material design for the rest.



  • @Fran-Diox thanks for the great response! Works like charm



  • @Fran-Diox

    I do not find any ons object when I using react. What’s the equivalent codes in react for ons.platform.select(‘android’) ?


  • Onsen UI

    @Marcnuth It’s not attached to window by default, you need to import it: import ons from 'onsenui';.


Log in to reply