New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(config): expose getMode() and deprecate Config #19104
Conversation
@@ -199,3 +199,16 @@ export const setupConfig = (config: IonicConfig) => { | |||
}; | |||
return win.Ionic.config; | |||
}; | |||
|
|||
export const getMode = (): Mode => { | |||
const win = window as any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be IonicWindow
as well?
Co-Authored-By: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
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')); |
You can still set the config in |
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) |
I also have this question. I currently change |
I would like to know the best practice for this use case also. @liamdebeasi |
@chriswep How are you using it currently? You should be able to set it in |
@liamdebeasi It’s a use case in my app to change the language at runtime. |
Right, my question was more of how you are currently doing it code-wise. |
after the user has changed the language and after the new language data is ready i do
with |
Chatting about this with the team. Will get back to you! |
The exact same here, using it like this:
|
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.
|
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! |
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 |
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? |
You can do the following: import { IonRouterOutlet } from '@ionic/angular';
constructor(private routerOutlet: IonRouterOutlet) {}
ngOnInit() {
this.routerOutlet.nativeEl.animation = this.someAnimationFunction;
} |
Thanks @liamdebeasi and the rest of the team. Keep up the good work. |
@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. |
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