ionic4

My Hardware 'Back Button Action' is not working in Ionic 4

两盒软妹~` 提交于 2020-05-25 15:53:54
问题 I am working in my Ionic 4 app and When the user clicks 2 times on the mobile back button, then it should close the app but this is not happening. This is my app.component.ts : lastTimeBackPress = 0; timePeriodToExit = 2000; @ViewChildren(IonRouterOutlet) routerOutlets: QueryList<IonRouterOutlet>; constructor(){ this.backButtonEvent(); } backButtonEvent() { document.addEventListener("backbutton", () => { this.routerOutlets.forEach((outlet: IonRouterOutlet) => { if (outlet && outlet.canGoBack(

My Hardware 'Back Button Action' is not working in Ionic 4

淺唱寂寞╮ 提交于 2020-05-25 15:53:40
问题 I am working in my Ionic 4 app and When the user clicks 2 times on the mobile back button, then it should close the app but this is not happening. This is my app.component.ts : lastTimeBackPress = 0; timePeriodToExit = 2000; @ViewChildren(IonRouterOutlet) routerOutlets: QueryList<IonRouterOutlet>; constructor(){ this.backButtonEvent(); } backButtonEvent() { document.addEventListener("backbutton", () => { this.routerOutlets.forEach((outlet: IonRouterOutlet) => { if (outlet && outlet.canGoBack(

How we can hide splash screen in ionic app?

别来无恙 提交于 2020-05-15 08:44:04
问题 There is anyway to hide or don't display splash screen in ionic app, and splash screen time in capacitor is fewer or in cordova is fewer, and How to reduce the time of splash screen in ionic app. Thanks (-: 回答1: Here is a tweak for disabling the splash screen. In config.xml file: <preference name="SplashScreenDelay" value="0" /> You can further change its behavior with the following settings in config.xml file: <preference name="FadeSplashScreenDuration" value="100" /> <preference name=

Capacitor - Trying to catch the cancel on camera

↘锁芯ラ 提交于 2020-05-15 08:08:52
问题 I am using Capacitor with Ionic 4 and I would like to catch when the user taps on cancel when on the camera. public async takePicture(): Promise<string> { const image: CameraPhoto = await Camera.getPhoto({ quality: 90, allowEditing: true, correctOrientation: true, resultType: CameraResultType.Uri, source: CameraSource.Camera }).catch((e) => { throw new Error(e); }); return this._IMAGE = image.webPath; } I am simply try to catch and error but clicking on cancel does not throw an error anymore

Capacitor - Trying to catch the cancel on camera

人走茶凉 提交于 2020-05-15 08:08:51
问题 I am using Capacitor with Ionic 4 and I would like to catch when the user taps on cancel when on the camera. public async takePicture(): Promise<string> { const image: CameraPhoto = await Camera.getPhoto({ quality: 90, allowEditing: true, correctOrientation: true, resultType: CameraResultType.Uri, source: CameraSource.Camera }).catch((e) => { throw new Error(e); }); return this._IMAGE = image.webPath; } I am simply try to catch and error but clicking on cancel does not throw an error anymore

Payments to this merchant are not allowed (invalid clientId) - Ionic iOS

痴心易碎 提交于 2020-05-15 07:58:04
问题 Im using the paypal plugin for ionic and is not working on iOS I already have running this plugin on android and it is working perfect, and also have the clientid generated on https://developer.paypal.com/developer/applications/ doPayment() { const total: any = 10; const currency: any = 'USD'; const envProduct: any = ''; const envSandbox: any = '{Client ID from developer.paypal.com/developer/applications/}'; this.payPal.init({ PayPalEnvironmentProduction: envProduct, PayPalEnvironmentSandbox:

Error: “TypeError: Cannot read property 'seconds' of undefined” when trying to format a date field

不问归期 提交于 2020-05-14 03:48:20
问题 I'm trying to format a date field in my ionic project. THis date field is being read in from Firebase and I try to format it in the html page but I'm getting the following error: TypeError: Cannot read property 'seconds' of undefined The strange thing is that it displays as I would expect on screen but I'm not sure why the console error is displayed Attaching the .html, related .ts and .service.ts Here is the html code: (note that removing the format section I do not get the error) <ion-item>

How to hide header on scroll in ionic 4?

Deadly 提交于 2020-05-13 14:49:45
问题 I wanted to know how I can hide a header in Ionic 4 by scrolling down the page, and re-show it when scrolling up. I found many solutions on how to do that, but they all turned out to not working or being out-of-date. So I collected all piece of information I could find to provide this answer. 回答1: Thanks to this video I got it to work. First of all call ionic g directive directives/hide-header . You can of course replace directive/hide-header with your own path and name. hide-header.directive

How to disable ion-button shadow in ionic 4?

蓝咒 提交于 2020-05-12 20:34:20
问题 I can't set the box-shadow property of ion-button to none in ionic 4, so how can I do that for a single button and for all the buttons at once ? 回答1: <ion-button class="main-button" >Get Started</ion-button> .main-button{ --box-shadow:none; } CSS Custom Properties --box-shadow --background --color There is whole list of CSS Custom Properties in this link https://ionicframework.com/docs/api/button 回答2: I found a way that worked for me, the below code disables the ion-button shadow: ion-button{

How to disable ion-button shadow in ionic 4?

喜欢而已 提交于 2020-05-12 20:33:09
问题 I can't set the box-shadow property of ion-button to none in ionic 4, so how can I do that for a single button and for all the buttons at once ? 回答1: <ion-button class="main-button" >Get Started</ion-button> .main-button{ --box-shadow:none; } CSS Custom Properties --box-shadow --background --color There is whole list of CSS Custom Properties in this link https://ionicframework.com/docs/api/button 回答2: I found a way that worked for me, the below code disables the ion-button shadow: ion-button{