Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all 49526 articles
Browse latest View live

Glitchy transitions

$
0
0

I’m having a problem with my latest Ionic app, that is not happening on the other apps I have. When navigating from one page to another, some elements of the current page are not getting animated and remain on sight while the second page is displayed. Only when the page is fully displayed, they disappear. Check this video:

ezgif-6-4bf069b543b1 (1)

(pay attention to the buttons on the footer).

I tested moving out the buttons from ion-footer to ion-content but the problem remains. This is happening both on browser and on the device, and the only apparent solution so far is to disable animations.

Any ideas on why is this happening ?

Regards

Victor Espina

2 posts - 1 participant

Read full topic


Get user data in ngOnInit

$
0
0

I have this code (cleaned) in my app.component.ts

import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { Platform, ToastController, NavController, MenuController, IonRouterOutlet } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import {
    Plugins,
    LocalNotificationScheduleResult } from '@capacitor/core';
import { AuthService } from './Services/auth.service';
import { Router } from '@angular/router';
import { User } from './Services/user.service';
const { Network, Toast, PushNotifications, LocalNotifications } = Plugins;
import { Socket } from 'ngx-socket-io';

@Component({
    selector: 'app-root',
    templateUrl: 'app.component.html',
    styleUrls: ['app.component.scss']
})

export class AppComponent implements OnInit, OnDestroy {

    @ViewChild(IonRouterOutlet, {static: false}) routerOutlet: IonRouterOutlet;

    public user: User;

    constructor(
        private platform: Platform,
        private splashScreen: SplashScreen,
        private statusBar: StatusBar,
        private authService: AuthService,
        private socket: Socket,
    ) {
        this.initializeApp();
        this.hardwareBackButton();
    }

    async ngOnInit() {
        this.socket.connect();

        // local notifications
        await LocalNotifications.requestPermissions();
        try {
        LocalNotifications.addListener('localNotificationReceived', (notification) => {
            console.log('Notification: ', notification);
        });
        LocalNotifications.addListener('localNotificationActionPerformed', (notification) => {
            console.log('Notification action performed', notification);
        });
        } catch (e) {
        console.log('Notification errors: ', e);
        }

        // chat notif
        this.socket.fromEvent('oneononemessage').subscribe(async (message: any) => {
        console.log('chat message: ', message);
        // if (message.msg.message.user.username !== this.user.username) { // if message receiver with auth user is same, show notif
            const notifs = LocalNotifications.schedule({
            notifications: [
                {
                title: message.msg.message.user.username,
                body: message.msg.message.note,
                id: Math.floor(Math.random() * 10),
                schedule: { at: new Date(Date.now() + 1000 * 2) },
                sound: 'beep.wav',
                attachments: null,
                actionTypeId: 'OPEN_CHAT',
                extra: null
                }
            ]
            });
            console.log('scheduled notifications', notifs);
        // }
        });
        // chat notif
    }

  // ionViewWillLeave() {
  //   this.socket.disconnect();
  // }

    initializeApp() {
        this.platform.ready().then(() => {
            this.statusBar.styleDefault();
            this.splashScreen.hide();
            this.authService.getToken();
        });
    }

    async ionViewDidEnter() {
        (await this.authService.user()).subscribe(user => {
        this.user = user;
        });
    }
}

As you see in my code in ngOnInit I have this line for notifications

if (message.msg.message.user.username !== this.user.username) {

Which currently I commented it as it was returning error.

Issue

As of Ionic life cycle ionViewDidEnter comes after ngOnInit so I cannot have access to this.user data.

Question

How can I have access to this.user data in ngOnInit?

6 posts - 2 participants

Read full topic

Problema al cargar imagen

$
0
0

Paso a explicar, tengo un botón que llama una función – abrirGaleria() == Puedo abrir la galeria, selecciono las fotos que necesito. Luego pongo OK y me las carga en mi home.html, pero… las carga “rotas”
(home.ts)
imageResponse: any;
options: any;

abrirGaleria() {

    this.options = { maximumImagesCount: 4 } ;
    this.imageResponse = [];
    this.imagePicker.getPictures(this.options).then((results) => {
               for (var i = 0; i < results.length; i++) {
                  this.imageResponse.push('data:image/jpeg;base64,' + results[i]);
            }
      }, (err) => {
        alert(err);
      });
  }

—(Home.html)–

<img src=“data:image/jpeg;base64,{{img}}” alt="" srcset="" *ngFor=“let img of imageResponse”>

1 post - 1 participant

Read full topic

Add IonIcon in types/components.d.ts

$
0
0

Could you add please the IonIcon interface in the file types/components.d.ts?

interface IonIcon {
  ariaLabel?: string;
  color?: string;
  flipRtl?: boolean;
  icon?: string;
  ios?: string;
  lazy?: boolean;
  md?: string;
  mode?: 'ios' | 'md';
  name?: string;
  size?: string;
  src?: string;
}

I want to use this interface. For example, I have used IonInput and IonButto, but I did not found IonIcon.

1 post - 1 participant

Read full topic

Notification icons colored

$
0
0

Hi everyone,
I’d like to set colored notification icons but I don’t understand how create compatible icons with android platform.

I added to my config.xml file the list of notification icons:

<resource-file src="resources/android/notification-icons/mipmap-mdpi/ic_launcher.png" target="app/src/main/res/drawable-mdpi/ic_stat_onesignal_default.png" />
<resource-file src="resources/android/notification-icons/mipmap-hdpi/ic_launcher.png" target="app/src/main/res/drawable-hdpi/ic_stat_onesignal_default.png" />
<resource-file src="resources/android/notification-icons/mipmap-xhdpi/ic_launcher.png" target="app/src/main/res/drawable-xhdpi/ic_stat_onesignal_default.png" />
<resource-file src="resources/android/notification-icons/mipmap-xxhdpi/ic_launcher.png" target="app/src/main/res/drawable-xxhdpi/ic_stat_onesignal_default.png" />
<resource-file src="resources/android/notification-icons/mipmap-xxxhdpi/ic_launcher.png" target="app/src/main/res/drawable-xxxhdpi/ic_stat_onesignal_default.png" />

I generated the icons with Android tool: http://romannurik.github.io/AndroidAssetStudio/icons-notification.html

But my icons are trasparent and white color.

The icons are correctly showed into my notification area but I’d like to create blue icons, not white. If I create custom icon using other tool (example photoshop), the icon not showen (only grey box)

Thanks in advance for your support

Luca

1 post - 1 participant

Read full topic

Open 3rd party whitelisted URLs in app, without in-app-browser plugin

$
0
0

We’re currently using the web authentication auf auth0. Since the login screen is served from auth0’s domain, currently login screen opens in the phone’s browser, not within the ionic app itself.

Is there a way to whitelist auth0’s login URLs so that those pages are loaded inside the app, without the overhead of using an in-app-browser plugin (which comes with its own complexity)?

1 post - 1 participant

Read full topic

Horizontal scroll to specific element

$
0
0

HTML

<ion-grid class="cal_bg" *ngIf="list.length > 0">

        <ion-row nowrap class="forecast_container">

            <ion-col col-4 *ngFor="let li of list; let i = index;" [id]="li.id">

                <div class="bold"><span class="b"> {{li.name}} </span> </div>

                <div class="hvy"> <b>{{li.Month}}, {{li.Year}}</b></div>

                <div class="blk">

                    <h2> {{li.Day}}</h2>

                </div>

                <div class="sembld">

                    <h4>{{li.Hours}} : {{li.Min}} {{li.AmPmSwitch}}</h4>

                </div>

            </ion-col>

        </ion-row>

    </ion-grid>

My horizontal scroll is perfectly working but I want to auto scroll horizontally specific to a list ID using angular. So, i can put focus on a particular item after view will load. And there are multiple in the page only this is horizontally scroll able.


initially 3 tiles will be visible on mobile screen rest will be in horizontal scroll

If any other details are required. kindly let me know.
Thanks

1 post - 1 participant

Read full topic

Override ion-back-button logic to show confirm message before leaving a page

$
0
0

Hi guys! Is there an easy way to prevent page popping when pressing ion back button? I’d like to show a confirmation dialog to user before leaving page. I’m using Ionic 5.2.2 and trying this, but not working:

component.html
<ion-back-button *ngIf=“canGoBack” (click)=“this.backButtonClicked($event)”>

component.ts
public backButtonClicked(event) {

event.preventDefault();

event.stopPropagation();

event.stopImmediatePropagation(); 

}

1 post - 1 participant

Read full topic


Creating new app

$
0
0

Hi,
anyone had this problem, i created new app: ’ ionic start testapp sidemenu’, all went ok, but when i try: ‘ionic cordova platform add android’, it says:

[WARN] About to integrate your app with Cordova.

       We now recommend Capacitor (https://ion.link/capacitor) as the official native runtime for Ionic. To learn about the differences between Capacitor and Cordova, see these docs[1]. For a getting started guide, see these docs[2].

       [1]: https://ion.link/capacitor-differences-with-cordova-docs
       [2]: https://ion.link/capacitor-using-with-ionic-docs

--no-confirm: Are you sure you want to continue? No

and i cant do anything with cordova. Is this slowly dawn of cordova?

1 post - 1 participant

Read full topic

How to create progress bar in ionic5

$
0
0

I am trying to show progress bar on http post method.
How to do that?Thanks for your help.

1 post - 1 participant

Read full topic

[Ionic5] Ion2-calendar "defaultScrollTo" not working first time after a cold-boot on android

$
0
0

I am using ion2-calender to create a datepicker.

I have:

const options: CalendarModalOptions = {
.
.
.
defaultScrollTo: moment().subtract(1, ‘months’).toDate()
}

This option makes my calendar scroll to an intended date when opening it.
This works well on iOS, but on android it doesn’t work before I have opened the calendar atleast once.
The first time I open the calender after a cold boot on android I see the first date, and not my intended date.
Anybody know a solution to this?

1 post - 1 participant

Read full topic

Ionic cordova build removes /www directory and implicitly my .db file

$
0
0

Hello,
I am using ionic+cordova+angular for an app. I have a database.db file in /www and by using ionic sqlite copy plugin, i managed to copy the .db file and after that using it with ionic sqlite plugin. All works well when debugging with ionic cordova build android -l --debug.
But when i try just ionic cordova build android for building my apk, it deletes the whole /www file and i loose the .db file. The bad part is that the copy method from ionic sqlite copy plugin only wants that .db file to be in /www, i cannot give a custom reference to the file.
So, is there any way to not have the www/database.db deleted? Or do you have another idea for this issue?

Thanks!

1 post - 1 participant

Read full topic

Styling segment on ios ionic/react

$
0
0

Styling background color of segment button is not working on ios style. Styling on ios is not working

<IonSegment className="segment-btn" color="dark" onIonChange={e => console.log('Segment selected', e.detail.value)} value="chapter">
          <IonSegmentButton value="term">
            <IonLabel>Term</IonLabel>
          </IonSegmentButton>
          <IonSegmentButton value="chapter">
            <IonLabel>Chapter</IonLabel>
          </IonSegmentButton>
        </IonSegment>

And the css

.segment-btn{
  --background: #FCB589;
}

1 post - 1 participant

Read full topic

Geofencing app software version requirement

$
0
0

Hi,

presently i want to develop geofencing app, i am unable build apk ,so please suggest which version of node,npm,ionic,cordova i have to install and generate apk.

Thanking You,
K.venkateswara rao.

1 post - 1 participant

Read full topic

Ionic5 App runs painfully slow on Android device

$
0
0

I am creating an Ionic5 app for a customer, to be deploy to a CloverFlex2 Android device. Currently the app have only 3 screens with no remote data access, just navigation between the available screens. The app is so small that the whole APK weights < 10mb. But the customer was complaining of “UI glitches” and finally sent me a video today:

ezgif-6-ce130896d6c1

As you can see, all the problem is caused because the app runs so painfully slow that the UI takes forever to respond. The version you see on the video was built using --prod --release options, and them signed from Android Studio using V1 protocol (required by Clover).

Also the app runs on https (again, Clover requeriments).

Any ideas on why the app runs so slowly? I tested the same app on my test Android device (that has worst specs than the Clover Device) and it runs smoothly.

1 post - 1 participant

Read full topic


Select value (not text) of dropdown in Ionic 4

$
0
0

This should be simple & straightforward, but I can’t get it right. I just want to select the VALUE of a dropdown (not the text).

Here’s the dropdown (part of a formControl form)

        <ion-select id="country" [selectedText]="country" cancelText="Cancel" okText="Choose" 
          (ionChange)="setCountry($evt)" formControlName="country">
          <ion-select-option [value]="USA">United States</ion-select-option>
          <ion-select-option [value]="NG">Nigeria</ion-select-option>
        </ion-select>

and here’s the .ts code

constructor(public formBuilder:FormBuilder, private tools:ToolboxService
    , private userSrv: UserService,private authService: AuthenticateService ) 
  {
    this.tools.getLoggedInUser().then((u:UserModel)=>{
      console.log(u);
      this.userAccount=u;
      this.userId=u.id;
      this.mycountry=u.country;
      this.userForm = this.formBuilder.group({
        userId:[u.id],
        name: [u.name, Validators.compose([Validators.required])],
        city: [u.city],
        state: [u.state],
        zip: [u.zip],
        country: [u.country, Validators.compose([Validators.required])],
        email: [u.email, Validators.compose([Validators.required])]
      });
    this.authService.userDetails().getIdToken()
        .then((t)=>{this.userAccount.deviceToken=t; //console.log("usertoken:", t);
      });
    })
   }

//....blah blah blah

  setCountry(evt)
  {
    console.log(evt.target.value); // shows the text (like United States), not the value (USA)
  }

1 post - 1 participant

Read full topic

BlinkID Error - Native: tried calling BlinkId.BarcodeRecognizer, but the BlinkId plugin is not installed

$
0
0

I have an Ionic 4 project which I want to integrate the BlinkID plugin to scan PDF417 barcodes. I installed the BlinkID plugin following instructions from the Ionic website and added the snippet to scan barcodes. However I get an error on the line where we call the BarcodeRecognizer function.

const barcodeRecognizer = new this.blinkId.BarcodeRecognizer();
barcodeRecognizer.scanPdf417 = true;

The error from XCode console is;
WARN: Native: tried calling BlinkId.BarcodeRecognizer, but the BlinkId plugin is not installed.
WARN: Install the BlinkId plugin: 'ionic cordova plugin add blinkid-cordova’

Can you please assist.

1 post - 1 participant

Read full topic

Ion-col and button position

$
0
0

Hey,

I am trying to position a ion-button to the right, but all I am getting is the button is right-ish.

I´ve got the following code:

<ion-footer>
            <ion-row >
                <ion-col center text-center >
                    <button item-start (click)="favorite(thumbs.get(item))">
                        <ion-icon *ngIf="!thumbs.get(item).favorite" name="star-outline"></ion-icon>
                        <ion-icon *ngIf="thumbs.get(item).favorite" name="star"></ion-icon>
                    </button>
                </ion-col>

                <ion-col center text-center >
                    <button  (click)="presentPopover($event,thumbs.get(item))">
                        <ion-icon name="ellipsis-vertical"></ion-icon>
                        <div>Add to Story</div>
                    </button>
                </ion-col>

            </ion-row>
        </ion-footer>

Driving me nuts.

2 posts - 2 participants

Read full topic

Change PreviewAnyFile default file opening app

$
0
0

Hello.

When using PreviewAnyFile for the first time from my app, before opening the file, the system ask to use an application to open it (once or every time).

Depending of the file mime, several applications can be used. And some application doesn’t support some mime type.

My issue is when an application is set to be the default application that open file, this defaults application will be used to display all type of files.
If the file isn’t compatible for the app, once the app is opened, the app will enter in error.

I would like to know if their is a way to change this default applications once it’s set.

Regards.

1 post - 1 participant

Read full topic

Mulitple video tags slows app drastically

$
0
0

Hi,
I’m writing an multimédia ebook reader on Ionic 5 / Angular 8. I have this simple video component with custom controls :

<div class="video-player">
  <video #video [src]="content.src" controls controlslist="nodownload" disablePictureInPicture playsinline preload="none">
  </video>
  <div class="video-actions">
    <div class="video-actions-left">
      <ion-icon name="logo-closed-captioning" (click)="captions()"></ion-icon>
    </div>
    <div class="video-actions-center">
      <ion-icon [name]="playing ? 'pause':'play'" (click)="play()"></ion-icon>
    </div>
    <div class="video-actions-right">
      <ion-icon name="expand" (click)="fullscreen()"></ion-icon>
    </div>
  </div>
</div>
import {Component, ElementRef, Input, OnInit, ViewChild} from '@angular/core';
import {Video} from '../../../classes/contents/video';

@Component({
    selector: 'video-player',
    templateUrl: './video.component.html',
    styleUrls: ['./video.component.scss'],
})
export class VideoComponent implements OnInit {

    @ViewChild('video', {static: true}) videoRef: ElementRef;

    @Input() content: Video;

    video: HTMLVideoElement;
    videoSrc: string;
    playing = false;

    constructor(
        public toastController: ToastController
    ) {}

    ngOnInit() {
        this.video = this.videoRef.nativeElement;
        this.video.addEventListener('play', (event) => {
            this.playing = true;
        });
        this.video.addEventListener('pause', (event) => {
            this.playing = false;
        });
    }

    play() {
        if (this.video.paused) {
            this.video.play();
        } else {
            this.video.pause();
        }
    }
}

This takes forever to load and the app kind of freezes for a moment (~10s) :

If i remove the [src] attribute it’s much quicker (~1s) :

Any ideas why and how to fix ?

The videos (4 of them) are locally stored (/assets) and I set preload=none to prevent fetching data for each videos.

1 post - 1 participant

Read full topic

Viewing all 49526 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>