My onClick IonItem used to work on both web and android but now, it works only on web but not on android anymore and I don’t know why.
Here is a part of my code (the rest is a list of IonItem)
import {
IonContent,
IonPage,
IonIcon,
IonText,
useIonViewWillEnter,
IonItem,
IonLabel,
} from "@ionic/react";
import { useHistory } from "react-router-dom";
import "./Langue.css";
import "/node_modules/flag-icons/css/flag-icons.min.css";
import React from "react";
import { arrowBackOutline, checkmarkOutline } from "ionicons/icons";
import "../../i18n";
import { useTranslation } from "react-i18next";
const Langue: React.FC = () => {
const history = useHistory();
const [t, i18n] = useTranslation();
useIonViewWillEnter(async () => {
let language = i18n.language.split("-")[0];
document.getElementById(language)!.style.display = "block";
});
const changeLanguage = async (language: string) => {
document.getElementById(i18n.language)!.style.display = "none";
document.getElementById(language)!.style.display = "block";
i18n.changeLanguage(language);
};
return (
<IonPage>
<IonContent fullscreen={true}>
<div className="language-header">
<IonIcon
icon={arrowBackOutline}
size="large"
onClick={() => history.goBack()}
className="back-icon"
></IonIcon>
<IonText>
<h1>
<b>{t("language").toUpperCase()}</b>
</h1>
</IonText>
</div>
{/*
*
* Français (default settings)
*
*/}
<IonItem className="language-item" onClick={() => changeLanguage("fr")}>
<IonLabel className="language-name">
<span className="fi fi-fr"></span>
<b> {t("fr")}</b>
</IonLabel>
<IonIcon
icon={checkmarkOutline}
size="large"
color="success"
id="fr"
className="language-checkmark"
></IonIcon>
</IonItem>
The onClick() in the IonIcon works on android
Hope you can help me Thanks !