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

PIN loop after authentication in app on some android devices

$
0
0

We encountered issue on some android devices with versions 6.xx and even 7.xx.

Situation:

  • user installs app;
  • proceeds with authentication and it’s successful;
  • the device shows phone PIN code screen and keeps asking to enter PIN so user can’t go further;

The workaround is to remove all security locks on phone (PIN, fingerprint etc.) and create new ones.
In this case for some time it works without this strange device PIN loop.

Still trying to figure out how to resolve it on app side.

1 post - 1 participant

Read full topic


Ionic Lifecycle Un-/Subscribe Firebase Databasestreams (using async pipe)

$
0
0

I am using Ionic 5 with Firebase Realtime Database and Firestore (angularfire) and Angular Routing. On most pages I am streaming databasecontent. Because of the Ionic-lifecycle the pages are not destroyed when leaving the view. As I would do in Angular, I declare my Observables in ngOnInit.

public data$: Observable<Data[]>;

  ngOnInit() {
      this.data$ = this.dataService.retrieveData();

In my template I am using async pipe.

The async pipe would automaticly unsubscribe when the component is destroyed. But because of the Ionic lifecycle this does not happen, when leaving the view.

Question 1: Is it good practice to keep the databasestreaming open when leaving views (and only unsubscribe when onNgDestroy is called)?

Question 2: If it is preferred to use the lifecycle hooks (i.e. ionViewWillEnter, ionViewWillLeave) it would not be possible to use the async pipe, so I have to do subscribing an unsubscribing on my own. Not using async pipes sounds unreasonable. In which usecases does that make sense? the question in detail and share your code, configuration, and other relevant info.

1 post - 1 participant

Read full topic

Correct ionic layout structure

$
0
0

Hi everyone, we just started to develop our project on Ionic and I would like to know how to solve this problem. We’re using Ionic with TailwindCSS for our content, so Ionic will only be used for navigation, routing, transitions and everything related on rendering correctly on every mobile device (handling notch, safe areas and so on).

So here’s how we would like to setup our layout for App.tsx

  <IonApp>
    <IonHeader className="ion-no-border">
      <IonToolbar>
        <CustomHeader />
      </IonToolbar>
    </IonHeader>
    <IonReactRouter>
      <IonRouterOutlet>
        <Route path={Path.Home}>
          {({history}) => <Home history={history} /> }
        </Route>
        <Route path={Path.Detail}>
          <Detail />
        </Route>
      </IonRouterOutlet>
      <IonFooter className="ion-no-border">
        <IonToolbar>
          <CustomFooter />
        </IonToolbar>
      </IonFooter>
    </IonReactRouter>
  </IonApp>

Inside CustomHeader and CustomFooter have only custom html+css

Now, every page will have a custom layout wrapped by theIonPage andIonContent like this:

    <IonPage>
      <IonContent >{children}</IonContent>
    </IonPage>

Here’s the list of my problem (and unfortunately I think that I’m just scratching the surface…)

  1. I have to use IonHeader and IonFooter with a IonToolbar to wrap my CustomHeader and CustomFooter because otherwise the app will not respect the device safe area. The problem is that IonToolbar seems to be adding an additional top, bottom, left and right padding on my CustomHeader and CustomFooter. How can I remove that padding?

  1. All of my custom HTML page content inside the <IonContent> is displayed under the IonHeader and IonFooter. What should I do in order to add the correct padding to the top and bottom of the <IonContent> in order to avoid that?

1 post - 1 participant

Read full topic

Howler.js how to play HTML5 file with preload of metadata

$
0
0

Hi to All

I’m searching a solution to play an audio file via Howler.js in a Ionic Project with HTML5 flag true. The problem is in update a seek bar that I’ve created. Reading the documentation I’ve founded that exist an option “preload” setting that to ‘metadata’ allows to download file metadata (even duration of the file), i’ve tried to use this option but without result, this is the sample code of the use of howler:

ngOnInit() {
this.idTrack = this.player = new Howl({
src: [‘https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3’],
html5: true,
format: [‘mp3’],
preload: ‘metadata’,
onplay: () => {
this.updateProgress();
},
onend: () => {
this.buttonIcon = “play”;
}
});
}

There is any Suggestion to make this solution working?

Thanks in advance

1 post - 1 participant

Read full topic

HTTP POST Request key

$
0
0

Hi all,

The question is not really related to the Ionic Framework, however…

I have one might be very simple question. I have to do a POST Request to check voucher validity. The post request uses URL Params only (without value with key only) and I am confused how to manage it from the app?
If someone of you have any idea or solution it will be highly appreciated!!!
Here is what I am trying to achieve:

This is the API endpoint which I have to call ( passing application_module and voucher values)

https://xyz/api/check_voucher/application_module/voucher

What I have tried so far:

 let urlSearchParams = new URLSearchParams ();
 urlSearchParams.append('', 'myapplicationmodule/');
 urlSearchParams.append('', "myvouchercode");

return this.httpClient.post(environment.url, urlSearchParams );

Second attempt:

 let application_module = 'xyz/';
 let voucher = 'xyz'
 return this.httpClient.post(environment.url, application_module + voucher );

None of above mentioned methods have success. :confused:

I am so confused how to achieve this POST call without key… Is there any way to do that?

Thanks in advance guys!!

1 post - 1 participant

Read full topic

Ion-menu : Cannot read property 'classList' of undefined

$
0
0

I have a base layout template that I use for most of the pages of my app

<template>

	<ion-page :data-simulating="(isGameSimulating) ? 'yes' : 'no'" id="main-content">
		<ion-header>
			
		</ion-header>
		<ion-content>
			<slot />
		</ion-content>

		<ion-segment slot="bottom" id="FooterMenu" :value="pageId">
			<ion-segment-button @click="gotoPage('athletes')" :dataselected="(pageId == 'athletes') ? true : false" value="athletes">
				<ion-icon :icon="people"></ion-icon>
				<ion-label>Athletes</ion-label>
			</ion-segment-button>
			<ion-segment-button @click="gotoPage('training')" :dataselected="(pageId == 'training') ? true : false" value="training">
				<ion-icon :icon="podium"></ion-icon>
				<ion-label>Training</ion-label>
			</ion-segment-button>
			<ion-segment-button @click="gotoPage('lobby')" :dataselected="(pageId == 'lobby') ? true : false" value="lobby">
				<ion-icon :icon="home"></ion-icon>
				<ion-label>Lobby</ion-label>
			</ion-segment-button>
			<ion-segment-button @click="gotoPage('scouting')" :dataselected="(pageId == 'scouting') ? true : false" value="scouting">
				<ion-icon :icon="eye">
					<ion-badge>6</ion-badge>
				</ion-icon>
				<ion-label>Scouting</ion-label>
			</ion-segment-button>
			<ion-segment-button @click="gotoPage('calendar')" :dataselected="(pageId == 'calendar') ? true : false" value="calendar">
				<ion-icon :icon="calendar"></ion-icon>
				<ion-label>Calendar</ion-label>
			</ion-segment-button>
		</ion-segment>

	</ion-page>
</template>

I use a ion-segment to navigate through pages, it works perfectly.

But if I add a ion-menu component at the top of my template (even an empty ion-menu)

<ion-menu side="start" menu-id="first" content-id="main-content"></ion-menu>

I get the following error every time I try to navigate to a page I have previously visited :

Uncaught TypeError: Cannot read property 'classList' of undefined
    at eval (index.esm.js?d867:1088)

The error comes from ionic/vue on this line of code

requestAnimationFrame(() => enteringEl.classList.remove('ion-page-invisible'));

2 posts - 2 participants

Read full topic

Access multiple form control values from the same formgroup from a customValidator

$
0
0

Hi!

I’m trying to implement a reactive form with a formgroup of 2 elements and a validator to access the 2 elements simultaneously. How can this be achieved?

eg:
this.formBuilder.group({
var1: [’’, [Validators.required, customValidator]],
var2: [’’, [Validators.required, customValidator]]
});

The use case scenario is var1 must never be greater than var2 and var2 must never be less than var1.

Thank you.

2 posts - 2 participants

Read full topic

No inline-template and inline-stylesheets in ng generate component schema

$
0
0

Using the Angular CLI, the component schema provided by ionic doesn’t have the option to generate inline templates and inline stylesheets. Is this intentional?

1 post - 1 participant

Read full topic


Tab 1.page.ts file errors

$
0
0

Hello all,
I am a newbie in Ionic.
I am taking course Ionic 4 Ess Training in LinkedIn Learning. I am using Ionic 5 and Visual Studio Code . I am stuck with in tab1.page.ts file where I received 3 errors. As far as I see I have all code as per the video. The errors are in the attached files. Probably I miss something but I don’t know what is it. I will be very glad and thankful for any support.
Thank you in advance.Error 1

Error 2

Error 3

5 posts - 3 participants

Read full topic

App loads indefinitely and it was unresponsive

$
0
0

I’m try apply distribution my app for iOS to App Store Connect, but, received the message below:

Guideline 2.1 - Performance - App Completeness

We discovered one or more bugs in your app.

Specifically, after launch, the app loads indefinitely and it was unresponsive.

Please review the details below and complete the next steps.

Review device details:

  • Device type: iPhone
  • OS version: iOS 14.5.1

Next Steps

Please run your app on a device to reproduce the issues, then revise and submit your app for review.

If at first you’re unable to reproduce the issue, try the following:

  • For new apps, uninstall all previous versions of your app from a device, then install and follow the steps to reproduce.
  • For app updates, install the new version as an update to the previous version, then follow the steps to reproduce.

If we misunderstood the intended behavior of your app, please reply to this message in Resolution Center to provide information on how these features were intended to work.

Resources

I’m tried change package.json and tsconfig.json, but don’t work.

In package.json i changed:

app-scripts in “^3.2.4” for “^3.2.3”.
typescript in “^2.9.2” for “^2.6.2”

In tsconfig.json i changes:

compilerOptions >> types: [“cordova”] to types: [ ]

How resolve this?

1 post - 1 participant

Read full topic

How can I line up 2 buttons side-by-side in the center in an ion-card?

$
0
0

Hello, I am trying to make 2 buttons side-by-side at the bottom of my ion-card: a Yes and a No button. However, I cannot figure out how to properly style these two buttons to use up 100% of the width (with margins, of course) while still each taking up equal space in terms of width. I’ve tried to get there in various different configurations, with my most effective being:

questions.page.scss:

.yes {
    display: inline-block;
    width: 48%;
    margin-left: 1.35%;
    font-weight: bold;
}

.no {
    display: inline-block;
    width: 48%;
    font-weight: bold;

}

with .yes being my Yes button styling and .no being my No button styling.

For reference, her is also my questions.page.html:

<ion-header>
  <ion-toolbar>
    <ion-title>Questionnaire</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
  <ion-card id="card">
    <ion-card-header>
      <ion-card-title>Do you recognize any of these names?</ion-card-title>
    </ion-card-header>

    <ion-card-content>
      <ul>
        <li>Drivers: Michael Schumacher, Lewis Hamilton, Max Verstappen, Sebastian Vettel</li>
        <li>Team Principals: Jean Todt, Toto Wolff, Christian Horner, Maurizio Arrivabene</li>
      </ul>
    </ion-card-content>

    <ion-button  class="yes" id="yes" (click)="red()">YES</ion-button><ion-button class="no" id="no" (click)="green()">NO
    </ion-button>
  </ion-card>
</ion-content>

Also, here is how my questions page looks like in the Responsive view (just to show you how the right margin is slightly larger than the left margin):

Any help would be greatly appreciated! Thank you!

1 post - 1 participant

Read full topic

How to change the font size globally in React v5?

$
0
0

What’s a good way to add a font size select display option to the app? I found a CSS solution for v4, but v5 uses CSS variables and there doesn’t appear to be one for font size.

I’ve tried setting the body font size in variables.css, but this doesn’t affect IonButton or IonCard text, so I was wondering if there is a more general solution?

1 post - 1 participant

Read full topic

How to get rid of white ion tab bar?

$
0
0

Hi guys, I encounter a bug when changing my ion bar using scss.

As shown above, there is a white box behind my customize floating ion bar. I can’t seem to remove it and I want to remove that white rectangle box. Here’s my code:

tabs.page.html:

> <ion-tabs #tabs (ionTabsDidChange)="setCurrentTab()">
> <ion-tab-bar slot="bottom" >
> <ion-tab-button tab="tab1">
>       <ion-icon name="document-text-outline"></ion-icon>
>       <ion-label>Notes</ion-label>
>     </ion-tab-button>
> 
>     <ion-tab-button tab="tab2">
>       <ion-icon name="help"></ion-icon>
>       <ion-label>What's Next?</ion-label>
>     </ion-tab-button>
> 
>     <ion-tab-button></ion-tab-button>
> 
> 
>     <ion-tab-button tab="tab4">
>       <ion-icon name="book"></ion-icon>
>       <ion-label>E-books</ion-label>
>     </ion-tab-button>
> 
>     <ion-tab-button tab="tab3">
>       <ion-icon name="information-circle-outline"></ion-icon>
>       <ion-label>Info</ion-label>
>     </ion-tab-button>
>   </ion-tab-bar>
> 
> </ion-tabs>
> 
> <ion-fab vertical="bottom" horizontal="center" slot="fixed">
>   <ion-fab-button>
>     <ion-icon name="add-outline"></ion-icon>
>   </ion-fab-button>
>   <ion-fab-list side="top">
>     <ion-fab-button href="https://www.facebook.com/groups/320930668903105/"><ion-icon name="logo-facebook"></ion-icon></ion-fab-button>
>     <ion-fab-button href="http://m.me/jomstudyapp"><ion-icon name="call" ></ion-icon></ion-fab-button>
>     <ion-fab-button href="https://instagram.com/jomstudyapp"><ion-icon name="logo-instagram"></ion-icon></ion-fab-button>
>   </ion-fab-list>
> </ion-fab>

Blockquote

tabs.page.scss

ion-fab > ion-fab-button{
–box-shadow:none !important;
bottom: 13px;
position: relative;
–background: white;
–color: black;

ion-icon {
font-size: 30px;
}

}

ion-fab-list{
display:grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-rows: 1fr;
gap: 20px;
left: -115%;
padding-bottom: 20px;

ion-fab-button{
–background: transparent;
–color:black;
width: 48px;
height: 48px;

  ion-icon{
  	font-size: 24px;
  }

}
}

ion-tab-bar {
–background:#ffffff;
box-shadow: 0px 1px 12px rgba(0, 0, 0, 0.4);
border-radius: 16px !important;

height: 50px;
width: 90%;
padding-top: 5px;
padding-bottom: 5px;

bottom: 20px;
position: relative;
margin: 0 auto !important;
border-top: none;

}

ion-tab-button {
border-radius: 16px !important;

&::before {
  background-color: transparent;
  display: block;
  content: "";
  margin: 0 auto;
  width: 20px;
  height: 2px;
}

&.tab-selected::before {
  background-color: white;
}

}

Appreciate any help I can get, thanks!

1 post - 1 participant

Read full topic

How to authenticate using Firebase Authentication in the Ionic-4?

$
0
0

Hello,

I am looking for a tutorial on how to include Firebase Authentication Ionic-4? I have been searching the same on this forum but dont seem to find an answer?

It seems like since the Ionic team has started enterprise support they kind of have given up on the community?

thanks
jackyjoy

3 posts - 3 participants

Read full topic

How to add scrolling to an ion-slides component (so I can scroll U/D and page L/R)

$
0
0

I am new to ionic programming. I am trying to figure out to get my ion-slides component to scroll up and down (as well as page left and right – working)

Below is the UI (notice how the bottom is cut off)

This my html code:

<ion-header>
  <app-toolbar-header [toolbarMeta]="toolbarMeta"></app-toolbar-header>
</ion-header>

<ion-content class="ion-padding" scrollbar="true">
  <app-connectivity-status></app-connectivity-status>

  <ion-slides pager="true">
    <ion-slide *ngFor="let e of evacNotice">
      <ion-list *ngIf="e.hideOrShow">
        <img [src]="e.icon" alt="" class="page-image">
        <ion-item class="ion-text-wrap text-import">
          <div style="overflow-y: auto;" [innerHTML]="sanitizeAndUnescapeHtml(e.body)"></div>
        </ion-item>
      </ion-list>
    </ion-slide>
  </ion-slides>
</ion-content>

This is my .css

 ion-slides {
    height: 95% !important;
  }

Note: I haven’t included the .ts file as its nut programming logic, not relevant to the UI layout.

I have looked at various site for help (Scroll to top in ionic), but nothing seems to work.

Any ideas

7 posts - 2 participants

Read full topic


Got some Questions

$
0
0
  1. How does ionic work with websites like grids and flexbox?
  2. Am I forced to use firebase or can I use node and express with it?
  3. How does CSS work can I use a framework like tailwinds?
  4. From my understanding, you code it once and it works for everything? like pc,Linux,mac os, ios,andriod, and web ?
  5. Can I use SEO with my web app?
    7.Will I Need to know typescript and angular in 2021?

Sorry for all the questions I just wanted to ask, before I invest time reading the docs.

7 posts - 3 participants

Read full topic

Ionic content scroll position strange behaviour on firefox and safari

$
0
0

I’m building an infinite scroll app. It may have 2k+ elements to load and I’am appending elements with ion-infinite-scroll element and listening to ionInfinite.

As I append new items, I am removing earlier items from content, so the app stays smooth. The scroll behaviour downwards is correct. As new items are appended the scrollbar jumps up.

The problem starts when I need to append items on the opposite direction, upwards. To do so I am listening to scroll events and appending items accordingly with the following function:

['ionScroll', 'ionScrollEnd'].forEach(function(evt) {
        document.getElementById('product_content').addEventListener(evt, function() {
          document.getElementById('product_content').getScrollElement().then(ok => {
            var offsetTop = 600
            if (evt == 'ionScrollEnd') offsetTop = 200
            if (ok.scrollTop <= offsetTop && removedElementHtml.length > 0) {
              var qtyToAppend = lastAppendedQty
              if (evt == 'ionScrollEnd') qtyToAppend = removedElementHtml.length
              for (let index = 0; index < qtyToAppend; index++) {
                if (removedElementHtml[removedElementHtml.length - 1]) {
                  list.insertBefore(removedElementHtml[removedElementHtml.length - 1], list.firstChild);
                  removedElementHtml.splice(-1, 1)
                  list.lastChild.remove()
                  length--
                }
              }
              infiniteScroll.disabled = false;
            }
          })
        }, false);
      });

The problem that these event does not fire a scrollbar position recalculation on safari and firefox.
So lets say the user scrollposition is lower than 600, iex: 570, and the code appends 10 items upwards. The scrollTop value is not recalculated and stays on the same value, 570. This does not happen on chrome. On chrome the scrollbar position is recalculated and jumps down, the scrolltop on chrome will then become 570+ appended items height.

My guess is that the ion infinite scroll is calling an event for the browser to recalculate content height. As I am listening to scrollTop position to append items upwards, this same event is not fired when scrolling upwards.
Which events are being called with infinite scroll? How can I force the browser to recalculate content height and position the scrollbar accordingly?

Thanks

1 post - 1 participant

Read full topic

We developed one product in ionic6 & bootstrap. What is best boostrap or ionic material?

$
0
0

We develop on product using ionic6 and bootstrap.

We want to know what is the best bootstrap or ionic material?

which technology need to use for improve app speed.

1 post - 1 participant

Read full topic

Ionic cordova app says plugin not installed even after installed

$
0
0

I am using onesignal-cordova-plugin in my ionic project. I have followed the documentation and added the plugin.

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

But once I build , the app log says

Native: tried calling OneSignal.startInit, but the OneSignal plugin is not installed.

I have tried removing android and readding but doesnt work. plugin list do show onesignal.

Ionic:

   Ionic CLI                     : 6.13.1 (/home/raj/.nvm/versions/node/v12.2.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.6.6
   @angular-devkit/build-angular : 0.1102.12
   @angular-devkit/schematics    : 11.2.12
   @angular/cli                  : 11.2.12
   @ionic/angular-toolkit        : 3.1.1

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : android 9.1.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 7 other plugins)

Utility:

   cordova-res : 0.15.3
   native-run  : 1.3.0

System:

   Android SDK Tools : 26.1.1 (/home/raj/android/android-sdk-linux/)
   NodeJS            : v12.2.0 (/home/raj/.nvm/versions/node/v12.2.0/bin/node)
   npm               : 6.14.9
   OS                : Linux 4.4

1 post - 1 participant

Read full topic

Audio auto not working in iOS app

$
0
0

I am building a religious app which has functionality of local notification and auto play sound. Its runing perfect on android phone. But not working on the iOS . Am using the javascript to play the sound. My code is below:

let audio = new Audio(src);
audio.load();
audio.play();

This worked when I press button like start prayer. But not work when prayer time come and local notification fire.

Please help to overcame this problem it causing me to rewrite the whole app in swift.

Kind regards
Mukesh

1 post - 1 participant

Read full topic

Viewing all 49303 articles
Browse latest View live


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