Uh oh!
There was an error while loading. Please reload this page.
feat(config): expose getMode() and deprecate Config - #19104
Conversation
Uh oh!
There was an error while loading. Please reload this page.
| }; | ||
| export const getMode = (): Mode => { | ||
| const win = window as any; |
There was a problem hiding this comment.
should this be IonicWindow as well?
Co-Authored-By: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
masimplo
commented
Oct 3, 2019
Hi, any info on why I am using md config irrespective of platform but want to set rippleEffect to false when the platform is iOS - which I am currently doing using config.set. this._config.set('rippleEffect',this._platform.is('android')); |
liamdebeasi
commented
Oct 3, 2019
You can still set the config in |
masimplo
commented
Oct 4, 2019
Yes, but from what I understand a value has to be hard-coded (either true or false for both platforms) as you don't have access to the platform service then. Unless there is a different way to differentiate between platforms that I am unaware of. |
You can probably just test the user agent directly in there to get the same result using a regex: (this is the same regex we use in the platform service) |
chriswep
commented
Oct 4, 2019
I also have this question. I currently change |
JesperBalslev
commented
Oct 24, 2019
I would like to know the best practice for this use case also. @liamdebeasi |
liamdebeasi
commented
Oct 24, 2019
@chriswep How are you using it currently? You should be able to set it in |
chriswep
commented
Oct 24, 2019
@liamdebeasi It’s a use case in my app to change the language at runtime. |
liamdebeasi
commented
Oct 24, 2019
Right, my question was more of how you are currently doing it code-wise. |
chriswep
commented
Oct 24, 2019
after the user has changed the language and after the new language data is ready i do with |
liamdebeasi
commented
Oct 24, 2019
Chatting about this with the team. Will get back to you! |
JesperBalslev
commented
Oct 24, 2019
The exact same here, using it like this:
|
swbradsh
commented
Nov 7, 2019
I'm also using config.set to do custom animations between certain pages - not all pages. I didn't see any other way to do this.
|
liamdebeasi
commented
Nov 13, 2019
Hi everyone, After discussing more with the team we have decided on two changes:
For the use cases that were described here, the relevant Ionic components provide properties that allow you to customize different behaviors in your app (ex. It is recommended that you update your applications to make use of these properties, rather than rely on the I hope this clears things up. Please let me know if there are any questions. Thanks! |
JesperBalslev
commented
Nov 14, 2019
Thanks for the reply.
Correct me if i am wrong, so whenever i have a back button:
i will now need to write it like this everywhere:
|
That's correct. It might make sense to create some kind of service to make that all easier to maintain. (I.e. if you decide to change We realize this is a bit of a departure from how your apps are currently set up, which is why we decided to remove |
swbradsh
commented
Nov 14, 2019
What is the recommended way for a child page component to get a reference to the ion-router-outlet in order to change the animation? |
liamdebeasi
commented
Nov 14, 2019
You can do the following: import{IonRouterOutlet}from'@ionic/angular';constructor(privaterouterOutlet: IonRouterOutlet){}ngOnInit(){this.routerOutlet.nativeEl.animation=this.someAnimationFunction;} |
JesperBalslev
commented
Nov 14, 2019
Thanks @liamdebeasi and the rest of the team. Keep up the good work. |
swbradsh
commented
Nov 22, 2019
@liamdebeasi I'm going back and refactoring my app to not use Config. I tried your example and it doesn't work.
I'm using @ionic/angular 4.11.2. |
liamdebeasi
commented
Nov 22, 2019
Oddly enough I just ran into that issue myself. I plan on making As a workaround for now you should be able to do: |
I also use config.set to put the IOS mode only on the web version: if(this.platform.is('desktop')){this.config.set('mode','ios')}Is there an opportunity to do the same thing with Ionic4? |
The future-proof way would be to set that config option in |
Pull request checklist
Please check if your PR fulfills the following requirements:
npm run build) was run locally and any changes were pushednpm run lint) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this introduce a breaking change?
Other information