2

I just updated @ionic/cli to v6.3.0 and noticed that running ionic serve displays the app with the iOS version of default component styles. In prior versions, the Android styles were applied. Is there a way to specify which platform preview is served?

Maybe something like ionic serve --platform android? I don't see anything like that in the documentation.

Related, but not what I'm looking for:

  • I realize you can run ionic serve --lab to see side-by-side iOS/Android versions of the app. This method is sometimes useful, but also some drawbacks (mainly that you cannot resize the device to test different screen sizes).
  • Changing IonicModule.forRoot() to IonicModule.forRoot( { mode: 'md' } ) in /src/app/app.module.ts forces the Android platform styles, but this also forces the Android platform styles when you build/compile for iOS.
Chris Voth
  • 853
  • 5
  • 13
  • 22

1 Answers1

3

Well there's no way you can achieve this with ionic.

You can achieve this with Google Chrome. In google chrome inspector tools (F12), You can click Toggle device toolbar (Ctrl+Shift+M) and then select any device from the menu. You will need to refresh after selecting the device to see the behavior.

Muhammad Umair
  • 631
  • 1
  • 8
  • 19
  • That works great! I was thinking the platform was predetermined during the transpilation process. Apparently it's determined on page load by the user agent string? Also, the Ionic upgrade didn't have anything to do with this. – Chris Voth Mar 26 '20 at 13:38
  • Yes, exactly Ionic determines it on page load and attach md or ios class. – Muhammad Umair Mar 26 '20 at 18:34