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

Best Approach to Variety of Error Text Responses

$
0
0

I have an input I would like to add errorText to. I would like to provide different error messages based on what is wrong with the input. Currently I have a getter on the [errorText] binding that checks the error and responds with the appropriate string. This seems like a super expensive operation since the method gets called repeatedly, even when there is no error on the input. What’s the intended way of adding specific error messages?

    <ion-input type="email" id="email" formControlName="email" required
      label="Email" labelPlacement="floating" [errorText]="emailErrorText"
    ></ion-input>
  get emailErrorText() {
    if (this.email.hasError('required')) {
      return 'Email is required.';
    } else if (this.email.hasError('sytnax')) {
      return 'Email is invalid.';
    } else if (this.email.hasError('duplicate')) {
      return 'Email is already in use.';
    }

    return null;
}

1 post - 1 participant

Read full topic


Ion-icon not working unless ion-item is imported

$
0
0

I’m using ionic-svelte and I made a svelte component where I used ion-icons and ion-buttons mostly. But all the ion-icons were not showing for this element. Even though ion-icons work in many other components that I made.

So after - I don’t know how many - hours of trying to fix it, I finally got it to work by importing ionic-svelte/components/ion-item. Even though I’m not even using the ion-item tag anywhere for this component.

I find it very peculiar that I need to import an element type that I don’t use, to get another element type to work.

Is this intended behaviour or is this a bug? Or is this problem perhaps not due to the ionic framework, but rather an ionic-svelte issue?

1 post - 1 participant

Read full topic

Error: Constructor for "ion-app#undefined" was not found after upgrade to Angular 18.1 and Ionic 8

$
0
0

Hi, I have just upgraded my Ionic v7 / Angular 16 app to Ionic v8, Angular v18, and now I get runtime errors where it looks like it can’t load any of the Ionic components.

If I look into my .angular\cache\18.1.1\vite\deps folder, I do not see anything starting with Ion…

I did go through all the Angular and Ionic upgrade instructions, and it compiles fine, but I get these runtime errors.

I am not sure if this is relevant, but there are also updates to the Angular build…

Would any one have any ideas what is missing here (or how I can further diagnose)?

Thanks in advance

1 post - 1 participant

Read full topic

Phaser and ionic button

$
0
0

I have a phaser application set up but now I want to start using ionic controls to control whats happening in phaser. On my home.page.ts I have extended Phaser.scene but when I try to access any object that I defined in the class I get an error. Here is the whole home.page.ts code:

import { Component, OnInit } from ‘@angular/core’;
import Phaser from ‘phaser’;
import {Square} from ‘…/classes/square’;
import {HandTable} from ‘…/classes/handTable’;
import {Platform} from ‘@ionic/angular’;

export class GameScene extends Phaser.Scene {
handTable: HandTable;
constructor(config) {
super(config);
}

preload() {
}

create() {
  
  //Phaser.Device.FullScreen.request()
  //platform = new Platform(null, new Zone({}));
  //game.scale.scaleMode = Phaser.Scale.SHOW_ALL;
  let width= this.sys.game.canvas.width;
  let height= this.sys.game.canvas.height;
  
  /*var viewport = this.scale.getViewPort();
  let width=  viewport.width;
  let height = viewport.height;*/

  let squaresize= width/13;
  this.handTable = new HandTable(this,0,0,squaresize);
  this.add.text(0, height-30 , 'this.sys.game.canvas.height:'+height, { color: '#ffffff', align: 'left' });
  this.add.text(0, height-50 , 'this.sys.game.canvas.width:'+width, { color: '#ffffff', align: 'left' });
  
  this.add.text(width-10,height-100,'X',{color:'#ffff00',align:'left'});
  //this.add.text(0,height-70,'Platform:'+this.platform.platforms()[2]);
}

override update() {
}

}

@Component({
selector: ‘app-home’,
templateUrl: ‘home.page.html’,
styleUrls: [‘home.page.scss’],
})
export class HomePage implements OnInit {
phaserGame: Phaser.Game;
config: Phaser.Types.Core.GameConfig;

constructor(public platform: Platform) {

console.log (platform.platforms()[0]);
this.config = {
type: Phaser.AUTO,
scale: {
mode: Phaser.Scale.FIT,
autoCenter: Phaser.Scale.CENTER_BOTH,
width:800,
height:800
},

        backgroundColor: "0xcccccc",
  	physics: {
            default: 'arcade'
        },
        parent: 'ranger',
        scene: GameScene
    };

}
ngOnInit(): void {
this.phaserGame = new Phaser.Game(this.config);
}
test (){
this.phaserGame.scene.getScene(“GameScene”).handTable.squares[0][0].hand.set_handstr (“XX”);
}
}

The problem is in the test function. Thank you for your answers!

1 post - 1 participant

Read full topic

How can I programmatically select specific Ionic tab?

$
0
0

How can I programmatically select specific Ionic tab (in typescript file)? For example if I have in template…

  • I’m using Ionic 8 and Angular 18
<ion-tabs>
  <ion-tab-bar slot="bottom" >
    <ion-tab-button tab="home">
      <ion-icon name="home"></ion-icon> Home
    </ion-tab-button>

    <ion-tab-button tab="favorites">
      <ion-icon name="heart"></ion-icon> Favorites
    </ion-tab-button>
  </ion-tab-bar>
</ion-tabs>

How can I programmatically select home tab?

I have tried with @ViewChild buth without success:

@ViewChild('tabs', {static: true}) tabs:IonTabs | undefined;

and than

this.tabs?.select('home')

but it is not working. The error I get is…

TypeError: Cannot read properties of undefined (reading ‘getActiveStackId’)

1 post - 1 participant

Read full topic

3D Touch Peek Pop Contextmenu

Urgent - INSTALL_FAILED_INVALID_APK with Android 14

$
0
0

Hello,

I encounter an issue that I don’t understand exactly what is wrong.
In fact, the build is ok and validated by Apple and Android.

It works fine on IOS and Android excepted for the version 14.

When I try to open my app on an Android device with Android 14, The app opens and close directly.
I can see an error message with this INSTALL_FAILED_INVALID_APK.

What should I have to do to fix this?

Many thanks for your help,
Loïc

7 posts - 2 participants

Read full topic

Unable to install ionic 7.5 or 8 using npm install -g @ionic/cli@latest

$
0
0

I have been trying for 3 increasingly frustrating days now to install ionic/cli 7.5 or 8 for a new angular/standalone project. I have tried this on my primary Debian linux development machine AND a fresh debian install on an old gaming laptop I had sitting around. In both cases I see:

andy@Andy-Game:~$ node -v
v22.5.1
andy@Andy-Game:~$ npm -v
10.8.2
andy@Andy-Game:~$ ionic -v
-bash: /home/andy/.nvm/versions/node/v22.5.1/bin/ionic: No such file or directory
andy@Andy-Game:~$ npm install -g @ionic/cli@latest
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated superagent@8.1.2: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See Update formidable by tomstrong64 · Pull Request #1800 · ladjs/superagent · GitHub for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net

added 204 packages in 6s

andy@Andy-Game:~$ ionic -v
7.2.0

I also tried forcing it to install 7.5 or 8 with “npm install -g @ionic/cli@8” and get “No matching version found for @ionic/cli@8”

I assume I am doing something really “stupid nube” that prevents me from fetching the latest versions, but I can’t figure out what.

And If I go ahead and do ionic/angular/standalone app development with 7.2.0, I run into all sorts of issues because versions < 7.5.0 don’t fully support standalone apps.

Please someone show me where I am messing this up.

Thank you.

1 post - 1 participant

Read full topic


Prevent phaser from receiveing events through ion-select that opens on top of it

$
0
0

I have a working ion-select and also a working phaser scene but sometimes the ion-select opens on top of the phaser scene and when I select something the click goes through to phaser and a phaser sprite fires an event, which I don’t want to. I have tried both event.stopPropagation and event.preventDefault to alter this.

4 posts - 2 participants

Read full topic

Can opentelemetry.js be added to an ionic/capacitor project?

$
0
0

Looking for a solution to track analytics of our mobile app such as app flow, screens viewed, buttons pressed etc.

Does anyone know if its possible to add something like this to a project ? OpenTelemetry

I also looked at firebase analytics but my company isn’t keen on google collecting our analytic data.

1 post - 1 participant

Read full topic

Ion-tabs didn't cover full height of the screen

$
0
0

I am creating a ionic+ application. My problem is I have using ion-tabs . That tabs didn’t occupy full height of my mobile screen what I want to do for that . I would add below that comparison images other apps between my app.

How to make full width of my tabs bottom and top
Like another apps

3 posts - 2 participants

Read full topic

CORS for ionic?

$
0
0

In my Ionic app, I’m trapping errors that come back from the server, but most of them come back as {“isTrusted”:true} and I don’t get the actual error back.

I think this has to do with the way Ionic works with CORS, but I’m not quite sure what to add in my CORS to get the actual error back.

All of my other http calls work fine. It’s just exceptions that have the problem.

Any help here?

2 posts - 2 participants

Read full topic

Disable Dynamic Font Scaling on Specific Components

$
0
0

While adding support for Dynamic Font Scaling (Ionic v8) to my existing app, I’m struggling to override some scaling issues in UI elements where re-sizing is not helpful/desired or where it’s just too much.

For example, the primary menu button doesn’t really need to be resized to be huge. When it gets too big it takes up excessive vertical space, making the app content feel really messy and cramped. To fix this, I’ve just added some CSS to set min and max sizes.

ion-menu-button{
  font-size: clamp(20px, 1.5rem, 36px) !important;
  width:clamp(36px, 3rem, 48px) !important;
  height:clamp(36px, 3rem, 48px) !important;
}

For whatever reason, this same approach doesn’t work as expected with the ion-back-button component. The screenshot below depicts unmodified scaling, which crowds out the title and other components in addition to having excessive padding.

It seems like every UI component is it’s own kind of puzzle in terms of figuring out why it scales poorly and how I can reduce unwanted side effects. (e.g. by setting min/max sizes, etc). This is in part because so many of the components use REMs for things like margins and padding, which is not always going to scale well when the base font is enormous.

Is there a standard way to override scaling on specific components? For example:

ion-back-button{
  --ion-dynamic-font: initial; // tl;dr this does not work
}

2 posts - 1 participant

Read full topic

Custom font ignored in iOS ion-tab-bar

$
0
0

For some reason, I’m able to change the font for every single area of my app except for the main ion-tab-bar labels, which appear as the Apple system default in the Simulator.

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: normal;
  src: url("../assets/fonts/Barlow_Condensed/BarlowCondensed-Regular.ttf");
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: bold;
  src: url("../assets/fonts/Barlow_Condensed/BarlowCondensed-Bold.ttf");
}

@font-face {
  font-family: "Barlow Condensed";
  font-style: italic;
  font-weight: normal;
  src: url("../assets/fonts/Barlow_Condensed/BarlowCondensed-Italic.ttf");
}

@font-face {
  font-family: "Barlow Condensed";
  font-style: italic;
  font-weight: bold;
  src: url("../assets/fonts/Barlow_Condensed/BarlowCondensed-BoldItalic.ttf");
}

:root{
  /* ROOT FONTS */
  --ion-default-font: "Barlow Condensed", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Roboto", sans-serif !important;
  --ion-font-family: "Barlow Condensed", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Roboto", sans-serif !important;
}

html,
html.ios,
html.android{
  --ion-dynamic-font: "Barlow Condensed", -apple-system, BlinkMacSystemFont,
  "Helvetica Neue", "Roboto", sans-serif !important;
  --ion-default-font: "Barlow Condensed", -apple-system, BlinkMacSystemFont,
  "Helvetica Neue", "Roboto", sans-serif !important;
  --ion-font-family: "Barlow Condensed", -apple-system, BlinkMacSystemFont,
  "Helvetica Neue", "Roboto", sans-serif !important;
}

What am I missing?

1 post - 1 participant

Read full topic

No default code in variables.scss file?

$
0
0

Hello, I am running the below:

Virtual Studio Code 1.91/ Ionic 7.2.0/Angular:Angular CLI: 18.1.1Node: 20.15.1Package Manager: npm 10.7.0/ OS: win32 x64/ OS: Windows 10.

Could be just me. but does the “variables.scss” come with default setting styles. When I view the file in VS the file is blank. Well, technically, this is what is available, but that’s it.

// For information on how to create your own theme, please see:
// Theming | Ionic Apps: Color and Theming Basics Definition

Is there a file I can download somewhere to update variables.scss or a place I can copy and paste the default settings?

I do see a global.scss file available. I’m new to ionic, wasn’t sure if or how I can use the global.scss file to update the variables.scss file with the default code settings if at all.

2 posts - 2 participants

Read full topic


Best analytics apps for ionic?

$
0
0

Hey guys

wondering what the best analytics app is for ionic capacitor project? I saw people mention firebase analytics as being good but my company doesnt want a 3rd party getting our data (dont ask lol). We are mostly interested in what buttons are being clicked or screens being visited.

Thanks :slight_smile:

1 post - 1 participant

Read full topic

Heic images support for android

$
0
0

Hello Ionic community,

I am facing a problem in my Ionic React Capacitor v5 app where I can upload a HEIC image using iOS. The upload process works perfectly, and I can see these images on my iOS devices without any issues. However, I am unable to view these images on my Android devices.

I am using multer-s3 for uploading the images.

Any suggestions or solutions to this problem would be greatly appreciated.

Thank you!

4 posts - 2 participants

Read full topic

How do I export my Ionic + Angular app to Android 7.1? I have a custom Cap Plugin too!

$
0
0

I was searching far and wide for this, and I hope that the only problem here are my googling skills.

I have 2 physical devices:

  1. A Redmi Note 8 with the latest (so far) Android Version,
  2. A Device that has Android 7.1.1 with WebView 52 inside it.

I also developed a custom Capacitor plugin in Java.

I ran my app through the Android Studio runner onto my Redmi Note 8 device (connected by a USB to Type-C cable), and both the app and the plugin ran well.

I tried the same with my 2nd device (connected by a USB to Micro USB cable), and I got the white screen. Why didn’t the code compile properly to accomodate for the lesser version?

I suspect that my ES6 modules weren’t compiled for the ES5 somewhere along the way, but I wasn’t able to find anything!

I am at the point where I’m considering switching to NativeScript because a close associate of my showed me that he was able to use NativeScript both on his Android (w/ latest version) and a second Android device that has Android 6.1.

I hope that someone helps me with this, or just points me at the right direction… Thanks!

My hope is that I don’t need to rewrite my app from scratch in an older version, but rather that the compiler somehow does it for me…

1 post - 1 participant

Read full topic

Ionic Redirect is not working, getting blanks instead of tabs layout app

$
0
0

Hi, Im new to Ionic framework development, going through the tutorials to learn same, Im facing the issue when redirecting the page, my Tabs Layout app is working fine but when i add code for redirect im getting blank screen app after reloading, below is the code please help on this, thanks.

i have added singe-item page in tabs page and trying to redirect to single-item page from tab1 page

1. tab1.page.html

<ion-header [translucent]=“true”>


Tab 1


<ion-content [fullscreen]=“true”>


Tab 1


REDIRECT TO SINGLE ITEM PAGE

2. app-routing.moduels.ts

import { NgModule } from ‘@angular/core’;
import { PreloadAllModules, RouterModule, Routes } from ‘@angular/router’;

// documentation for Angular Routing : Angular Navigation: How Routing & Redirects Work in Angular Apps

const routes: Routes = [
{ path: ‘’, redirectTo: ‘tabs’, pathMatch: ‘full’ },
{
path: ‘’,
loadChildren: () => import(‘./tabs/tabs.module’).then(m => m.TabsPageModule)
}
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule {}

3. tabs-routing.module.ts

import { NgModule } from ‘@angular/core’;
import { RouterModule, Routes } from ‘@angular/router’;
import { TabsPage } from ‘./tabs.page’;

const routes: Routes = [
{
path: ‘tabs’,
component: TabsPage,
children: [
{
path: ‘tab1’,
loadChildren: () => import(‘…/tab1/tab1.module’).then(m => m.Tab1PageModule)
},
{
path: ‘tab2’,
loadChildren: () => import(‘…/tab2/tab2.module’).then(m => m.Tab2PageModule)
},
{
path: ‘tab3’,
loadChildren: () => import(‘…/tab3/tab3.module’).then(m => m.Tab3PageModule)
},
{
path: ‘’,
redirectTo: ‘/tabs/tab1’,
pathMatch: ‘full’
}
]
},
{
path: ‘’,
redirectTo: ‘/tabs/tab1’,
pathMatch: ‘full’
},
{
path: ‘single-item’,
loadChildren: () => import(‘./single-item/single-item.module’).then( m => m.SingleItemPageModule)
}
];

@NgModule({
imports: [RouterModule.forChild(routes)],
})
export class TabsPageRoutingModule {}

1 post - 1 participant

Read full topic

Problem with update Ionic V8

$
0
0

I can’t update my version of ionic from 7.2 to 8.2.6 on my macbook or on Windows, I always stay up to that version, I can’t update until version 7.2, what can I do?

1 post - 1 participant

Read full topic

Viewing all 49339 articles
Browse latest View live


Latest Images