Quantcast
Channel: Ionic Forum - Latest posts
Viewing all 228535 articles
Browse latest View live

Search bar in header is not vertically centered on iOS

$
0
0

Using Ionic version 6.17.0, with this template code:

<ion-header>
    <ion-toolbar>
        <ion-buttons slot="start">
            <ion-menu-button></ion-menu-button>
        </ion-buttons>
        <ion-searchbar type="text" color="light"
                       placeholder="Search for titles or users ..." clearInput>
        </ion-searchbar>
    </ion-toolbar>
</ion-header>

it looks just perfect on Android - the search bar and the menu button are perfectly vertically aligned at the center of the header’s toolbar.

But on iOS, both the menu button and the ion-searchbar are not vertically centered in the header but instead appear flush against the top of the screen, is this a bug?

Regardless, has anyone found a workaround for this by any chance?

Thanks!


beforeRouteUpdate and beforeRouteLeave never called

$
0
0

Good catch! This dev build should fix that:

npm install @ionic/vue@5.7.0-dev.202108252303.c93c4cd @ionic/vue-router@5.7.0-dev.202108252303.c93c4cd

I would not recommend using the development build in production, but feel free to keep working with it in your local environment. This fix will be in an upcoming release of Ionic Framework, and we release roughly every 2 weeks.

beforeRouteUpdate and beforeRouteLeave never called

@ionic-native/clipboard constructor breaks app

$
0
0

The most frequent cause of “app unresponsive” is uncaught exceptions bringing down the main rendering and reacting thread. Attach a debugger and look for messages in the JavaScript console.

Search bar in header is not vertically centered on iOS

@ionic-native/clipboard constructor breaks app

$
0
0

I ended up changing the clipboard type. I think the docs I was pulling up were for Cordova. I ended up changing to the following code and it fixed my problem.

import { Component } from '@angular/core';
import { Clipboard } from '@capacitor/clipboard';

async copyText() {
    Clipboard.write({
      string: document.getElementById('text').textContent
    });
}

Search bar in header is not vertically centered on iOS

$
0
0

Please accept the apologies for my mistake! I did an ionic --version but that was the CLI version… my library version from package.json is indeed 5.6.14 - will edit to reflect that now.

[ should also add that I see this behavior when running in a browser, not on a real phone, and have the dev-tools open - any of the iPhone models of the dev-tools seem to have this issue. I have not tested on an apk app or with a real phone, I just see this behavior in dev-tools of a desktop browser and assumed that this would show up on any cell phone that targets the same web page in a cell phone browser. ]

How do you use Gestures API in a Vue Component?

$
0
0

I don’t understand how to integrate the Vue Gestures double press API example in the Ionic documentation into a Vue component. The example seems to be lacking any Component context and my attempts to integrate either inline after the tag or in a setup() or created() method all produce an event registration error.

Uncaught (in promise) TypeError: Cannot read property '__zone_symbol__addEventListener' of null

Here is an example that produces the error:

DoublePressDemo.vue

<template>
  <ion-content class="ion-padding-top">
    <div class="rectangle">
      Double click me to change the color
    </div>
  </ion-content>
</template>

<script>
import {IonContent} from '@ionic/vue';
import {createGesture} from '@ionic/vue';
export default {
  name: "DoublePressDemo",
  components: {IonContent},
  created() {
    const backgrounds = ['rgba(0, 0, 255, 0.5)', 'rgba(0, 255, 0.5)', 'rgba(255, 0, 0, 0.5)', 'rgba(255, 255, 0, 0.5)', 'rgba(255, 0, 255, 0.5)', 'rgba(0, 255, 255, 0.5)'];
    const DOUBLE_CLICK_THRESHOLD = 500;
    const rectangle = document.querySelector('.rectangle');
    const gesture = createGesture({
      el: rectangle,
      threshold: 0,
      onStart: () => {
        onStart();
      }
    });

    gesture.enable(true);

    let lastOnStart = 0;
    let currentColor = 'rgba(0, 0, 255, 0.5)';

    const onStart = () => {
      const now = Date.now();
      if (Math.abs(now - lastOnStart) <= DOUBLE_CLICK_THRESHOLD) {
        rectangle.style.setProperty('background', getRandomBackground());
        lastOnStart = 0;
      } else {
        lastOnStart = now;
      }
    }

    const getRandomBackground = () => {
      const options = backgrounds.filter(bg => bg !== currentColor);
      currentColor = options[Math.floor(Math.random() * options.length)];

      return currentColor;
    }
  }
}
</script>

<style scoped>
.rectangle {
  width: 100%;
  max-width: 500px;
  height: 100px;
  background-color: rgba(0, 0, 255, 0.5);
  text-align: center;
  line-height: 100px;
  user-select: none;
}
</style>

NG0302: The pipe 'translate' could not be found!

Angular ngFor not iterating through array on Android

$
0
0

Alright so I went back to httpClient, and sure enough I just needed to fix some settings with CORS on my backend. Thank you for the insight and opinion! Appreciate the help mate!

Ionic React: Going back IonTabs to another IonTabs error

$
0
0

I do not know if this is a bug or not. So I have router with switch. Each switch has different IonTabs inside it.

Here is my router:

<IonPage id="main">
  <Switch>
    <Route path="/store/">
      <IonTabs>
        <IonRouterOutlet id="main">
          <Switch>
            <Route path="/store/reports" exact component={Reports} />
          </Switch>
        </IonRouterOutlet>
        <IonTabBar slot="bottom">
          <IonTabButton tab="reports" href="/store/reports">
            <IonIcon icon={newspaperOutline} />
            <IonLabel>Reports</IonLabel>
          </IonTabButton>
        </IonTabBar>
      </IonTabs>
    </Route>
    <Route path="/purchasing/">
      <IonTabs>
        <IonRouterOutlet id="main">
          <Switch>
            <Route path="/purchasing/due" exact component={SupplierDue} />
          </Switch>
        </IonRouterOutlet>
        <IonTabBar slot="bottom">
          <IonTabButton tab="purchasingDue" href="/purchasing/due">
            <IonIcon icon={calendarNumberOutline} />
            <IonLabel>Due</IonLabel>
          </IonTabButton>
        </IonTabBar>
      </IonTabs>
    </Route>
 </Switch>
....

So I am redirecting from /store/reports with useHistory().push('/purchasing/due'). When I press back button (back using browser back button), the /store/reports is empty. It seems that the component is destroyed. No code from the component was being triggered. It is just empty screen.

Same thing happens when I redirect from the other way around.

How can I fix this?

NG0302: The pipe 'translate' could not be found!

$
0
0

Hello,

Kindly import TranslateModule in your page.module.ts file as shown below

import { TanslateModule } from ‘@ngx-translate/core’;

imports : [ …,
TranslateModule]

NG0302: The pipe 'translate' could not be found!

$
0
0

Already imported. ClubPage in my Main Page.

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    ClubPageRoutingModule,
    HeaderComponentModule,
    ClubSettingsMenuComponentModule,
    TranslateModule.forChild()
  ],
  declarations: [ClubPage]
})
export class ClubPageModule {}

Not works

Unrelated view is mounted

$
0
0

Yes, both components have IonPage component, here’s what they look like:

  <ion-page>
    <ion-header :translucent="true" class="ion-no-border">
      <ion-toolbar>
        <ion-buttons slot="start">
          <ion-back-button default-href="/dashboard"></ion-back-button>
        </ion-buttons>
        <ion-title>Account</ion-title>
      </ion-toolbar>
      <ion-progress-bar v-if="status !== 'ready'" type="indeterminate"></ion-progress-bar>
    </ion-header>
    <ion-content>
      <!-- my content here -->
    </ion-content>
  </ion-page>
</template>

<script>
import { /* whole bunch of imports */ } from "@ionic/vue";
import { computed, onMounted, ref, inject } from "vue";
import { useRouter, useRoute } from "vue-router";
import { auth, db } from "@/main";
import { useMainStore } from "@/stores/main";
import { until } from '@vueuse/core'

export default {
  name: "Account",
  components: { /* ... */ },
  setup() {
    const mainStore = useMainStore();
    const router = useRouter();
    
    onMounted(async () => {
      console.log('Account mounted');
      try {
        await until(account).toBeTruthy({ timeout: 5000, throwOnTimeout: true })
        return await fetchJournals();
      } catch(e) {
        console.error(e);
      } 
    });

    return { /* ... */ };
  },
};
</script>```

Ionic 5 class .split-pane-visible

$
0
0

I’ve been trying to do the same, tried to add a transition on the .split-pane-visible or the ion-menu display property, nothing worked


Maxi Cabs Cranbourne

$
0
0

Maxi Cabs is one of the standard cab service in cranbourne which offer excellent and Trustable Cab Services. We are the local taxi service provider in all Melbourne suburbs. Easy to Book Maxi Cab in Melbourne Call at - 0415040756

Ionic 3 app taking huge time to run and build

$
0
0

Hi,

I’m using ionic 3 and i’m using lazy loading ,My app contains more than 200 pages.
My problem is while running,building app taking huge time.It’s been frustrating to develop.Can anyone help me out with this issue.

Thanks.

Ionic Angular monorepos with NX

$
0
0

how to add tailwindcss in nx mono repo?

Announcing Ionic Storage v3

$
0
0

Hello,

Do you know what is the max size when using indexedDb ?

i’m using @ionic/storage-angular and when checking under Application in Chrome DevTools, i’m under the QuotaExceededError. So, i’m happy :wink:

Nevertheless, something strange happened. The indexedDb never decrease, even if the size of properties decrease.

The only way is to “clear site data”.

Thanks,

IOS build failed for IOS 14 - Property 'userAgent' not found on object of type 'CDVViewController *'

$
0
0

Hello,

With Ionic 3 and cordova-plugin-ionic-webview@5.0.0, ipad is neither recognize as tablet neither ios , see on Platform not recognizing ios, and under ios14, the solution above doesn’t worked. Do you ave any idea to correct it without changing ionic 3 to latest v4 or v5 ?

Viewing all 228535 articles
Browse latest View live


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