Prevent theme adaptation

  • Hi all,

    Is it possible to prevent the onsen ui theme from adapting depending on which device is running the app? My goal is to have the UI look the same across all devices…


  • @maxmumford Absolutely! Utilize the utility function of Onsen which are documented here:

    The following code may be overkill and the Onsen team can clarify, but this has always worked when I am forcing everything to be iOS on Android.

      'ios'); // probably not necessary, but hey, why not.

  • Onsen UI

    @munsterlander Actually the one that is not necessary is ons.forcePlatformStyling because it’s just for testing and changing the style while the app is running :sweat_smile:

  • @Fran-Diox I need to go back and test because without the last one, I had difficulties getting the flat style for everything.

  • Onsen UI

    @munsterlander Because the other two should not be called on ons.ready. You need to call them right after importing onsenui. After it’s ready it doesn’t change anymore :sweat_smile:

  • @Fran-Diox Doh! :scream_cat: Ok, that would make sense. I thought I had an issue with ons object not being available but I bet that was due to something else and I never went back to check this, because if it works and you don’t understand why, well move on to the next problem! lol.


    Edit: For the record, VI is better than emacs! :bowtie:

    Edit Edit: Since @Fran-Diox upvoted my post, I take this as confirmation that he believes VI is better!

Log in to reply