How to change Ionic Back button dynamically in Ionic 5 - ionic-framework

I'd like to change back button dynamically in app having localization feature in Ionic 5.
Of course, I can do it config.set function in Ionic 3 but it is deprecated in Ionic 5.
I want the same function I can use that in a page like profile setting page.

This is my current solution.
<ion-back-button [text]="backButtonText"></ion-back-button>
This works well in the page but I don't like to add the same code [text]="backButtonText" in other pages too.

Related

Does Ionic 5 has swipe events?

I have an Ionic page on which I'd like to be redirected to a custom page when swiping left. Just redirecting me back isn't good enough, since I can have that page open from a deep link, meaning I have no back on my window's history.
I saw that there's a gesture API, but it's a bit too much for such a common cause. Also, I saw that on previous versions there where swipe left/right events, but no reference for it on Ionic 4/5.
Doesn't Ionic 5 has an on-swipe-left event?
Another solution, if you didn't want to add a hammerjs dependency and just use Ionic would be to use the official ion-slides component to manage your pages as slides.
I've implemented this on a couple of apps and it works really well.
In your example, you would want to setup an <ion-slides> container and then your 'pages' would exist inside as <ion-slide> components.
You can then easily tap into the (ionSlideDidChange) event as follows:
<ion-slides
*ngIf="!isLoading && pages"
[options]="slideOptions"
(ionSlideDidChange)="onSlideChange()"
class="em-height-full"
#pages
>
Then in your .js or .ts file just create a method like:
async onSlideChange() {
this.pageIndex = await this.slides.getActiveIndex();
}
Then you could track the page with pageIndex. So in your case, you'd open the page from the deepLink (maybe have it route to 'page 2') and then when you swipe left on the slide component you could go to page 1.
You are looking for this: https://ionicframework.com/docs/utilities/gestures
Adding HammerJS is not a great idea since you might encounter buggy scenarios.

Ion-color-secondary/primary class not applied

I've created a stencil.js application (app starter) where I would like to use ionic components.
I included Ionic using the cdn following this tutorial (https://ionicframework.com/docs/installation/cdn). I have a problem with the style of some of the components like buttons, toggle etc. The problem is that the primary/secondary/x style is not applied also if I use
color="primary"
I've searched a lot to solve this problem and I saw that the property .ion-color-primary isn't apply to the button like it should, so none of the colors are applied to the button that remains white.
If I use Ionic from cdn in a html page (with no stencil.js) the problem don't happen so I think that the problem it's stencil.
I've the latest stencil version, 4.11.7.

Is there any way to change android:windowSoftInputMode value from ionic typescript

In my Ionic application,
I am using android:windowSoftInputMode ="adjustPan" in the config file.
But I want to change android:windowSoftInputMode to "adjustResize" only for one of the screens in the app.
In short I want to set SoftInputMode programmatically on page load to "adjustResize" and change it back to "adjustPan" while leaving from the page.
Can someone help me out!

TabView after Login not updating view in IONIC 2

I am using IONIC 2 + Angular 2.
I am using Tabview for my dashboard. The issue is when I try to redirect page with this.nav.push(TabPage), A constructor of TabPage is getting called but View is not updating.
When I Minimise and Maximise app again, then I can see TabPage with all the Tabs but not without.
A problem is Tabs layout I guess as Its working if I redirect it to normal page instead of Tabs page.
You probably ran into one of the many navigation/tabs issues which a present in the current version of ionic. You can try downgrading to ionic-angular version 3.5.3 which was the version before most of these issues were introduced by refactoring the way the NavController generates URLs.

Rename in Ionic select button cancel and ok

I am working with the Ionic Framework.
In all of my forms i am using the ionic select do display some options.
It works perfectly. But its showing 2 buttons in english: cancel and okay.
I would like to rename this buttons in another names due to the language.
Where can i do this? I looked and searched the whole directory but could not find anything. It looks like the ionic is building them somehow. Or do i need some more js to rename this?
From the manual at https://ionicframework.com/docs/api/components/select/Select/
By default, the two buttons read Cancel and OK. Each button's text can be customized using the cancelText and okText attributes:
<ion-select okText="Okay" cancelText="Dismiss">
...
</ion-select>
okText actually didn't work with my Ionic 5.4.4 version. I used doneText instead and worked just fine.