Quantcast
Channel: Ionic Forum - Latest topics
Viewing all 71531 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

1 post - 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?

1 post - 1 participant

Read full topic

Fetching phone contacts not working in IOS works in android

$
0
0

Hi Team,

I am using the below plugins for to fetch phone contacts

ionic cordova plugin add cordova-plugin-contacts
npm install @ionic-native/contacts

Android working very cool, but the same time when i click “Import phone contacts” the app will crashes in IOS. How to resolve this.

Kindly reply me

Thanks in Advance.

1 post - 1 participant

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.


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

Hi friends

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


Which is the best PHP training Centre in Calicut?

$
0
0

Can someone please help me to know the best PHP training institute in Calicut?

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

Capacitor CMotion/Keycloak IOS not redirecting back to APP

$
0
0

I have a weird problem and no error message

i start app on IOS emulator
enter email address and InAppBrowser opens keycloak
after login successfull in keycloak nothing happens i dont get redirected back to the app

android runs perfectly

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

Viewing all 71531 articles
Browse latest View live


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