Ionic 4 lab uses incorrect platform
See original GitHub issueDescription:
When using the “device” view in Chrome, and selecting an iPhone device for example, the result of platform.platforms()
will give:
["iphone", "ios", "mobile", "mobileweb"]
And equivalent when selecting an Android device.
But when using ionic serve --lab
, the platform list is always ["desktop"]
for whichever device you select.
Steps to Reproduce: Use something like this in a page:
<ion-header>
<ion-toolbar>
<ion-title>Page</ion-title>
<ion-buttons *ngIf="platform.is('ios')" slot="end">
<ion-button>Add</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
where platform
comes from constructor(platform: Platform)
in the controller. If you open ionic serve --lab
, the button in the iOS device will not appear
My ionic info
:
Ionic:
Ionic CLI : 5.2.2 (/.nvm/versions/node/v10.1.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.6.1
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1
Utility:
cordova-res : 0.3.0 (update available: 0.6.0)
native-run : 0.2.5 (update available: 0.2.7)
System:
NodeJS : v10.1.0 (./.nvm/versions/node/v10.1.0/bin/node)
npm : 6.10.0
OS : macOS Mojave
Other Information:
I am using "@ionic/lab": "2.0.6"
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Ionic 4 lab uses incorrect platform · Issue #18785 - GitHub
I'm assuming the difference is that Chrome device view alters the user agent, whereas the iframe in Ionic Lab cannot.
Read more >Ionic platform.is("windows") returning false on windows
Hi, I just realised that Ionic platform is returning false for Windows in a windows uwp app running on desktop. When i check...
Read more >ionic serve --lab not showing different platform views
i think ionic serve -l doesn't work since ionic 2 using ionic-app-scripts. while, them using ionic view app, for live test.
Read more >Ionic API RegEx has improper bias to Action - GitLab.org
The false positives all took the form a line of code with a word ending in ion , an underscore, and 42 alphanumeric...
Read more >Getting Started with Ionic 4/5 | Learn IonicIonic Academy
With Ionic your app is built from one single code base, and the apps are often referred to as Cross Platform Apps or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@brandyscarney Can we mock the return value of
.platforms()
via a query parameter config option??ionic:mode=ios&ionic:platforms=iphone,ios,mobile,mobileweb
for exampleHi everyone,
We recently deprecated Ionic Lab in favor of using the mobile device emulation features provided by browser developer tooling. Please see https://ionicframework.com/docs/developing/previewing for instructions on how to get started with this tooling. I am going to close this, but let me know if there are any questions.