Skip to content
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

bug: Ionicon does not properly switch icons based on the mode in React & Vue #26207

Closed
4 of 7 tasks
brandyscarney opened this issue Nov 1, 2022 · 1 comment · Fixed by #26924
Closed
4 of 7 tasks
Labels
package: react @ionic/react package package: vue @ionic/vue package type: bug a confirmed bug report

Comments

@brandyscarney
Copy link
Member

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

Setting the ios and md properties on <ion-icon> in Vue and React is not switching between them properly when setting the mode in the global config.

Expected Behavior

The ion-icon should respect the global config and switch the icon based on the mode.

Steps to Reproduce

Using the following markup:

Vue

<ion-icon slot="icon-only" :ios="star" :md="heart"></ion-icon>

and setting the config globally:

createApp(App).use(IonicVue, {
  mode: 'ios'
}).mount('#app');

React:

<IonIcon slot="icon-only" ios={star} md={heart}></IonIcon>

and setting the config globally:

setupIonicReact({
  mode: 'ios',
});

Results

If you switch the mode above in either example from ios to md you'll see the icon being displayed is always the heart.

It seems that the icon switches based on the platform as emulating ios does work to change the icon.

Code Reproduction URL

https://stackblitz.com/edit/angular-rduzd8?file=src%2Fcomponents%2FExample.vue,src%2Fmain.ts

Ionic Info

Ionic:

   Ionic CLI       : 6.20.3 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/vue 6.3.3

Capacitor:

   Capacitor CLI      : 4.4.0
   @capacitor/android : not installed
   @capacitor/core    : 4.4.0
   @capacitor/ios     : not installed

Utility:

   cordova-res : not installed globally
   native-run  : 1.7.1

System:

   NodeJS : v16.17.0 (/usr/local/bin/node)
   npm    : 8.15.0
   OS     : macOS Monterey

Additional Information

No response

@ionitron-bot
Copy link

ionitron-bot bot commented Apr 13, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: react @ionic/react package package: vue @ionic/vue package type: bug a confirmed bug report
Projects
None yet
2 participants