1

I'm working on a React Ionic Project, running on Android and iOS and I'm using the latest versions of React, Ionic and Capacitor packages.

Ionic CLI       : 6.13.1 
Ionic Framework : @ionic/react 5.6.0

Capacitor:

   Capacitor CLI   : 3.0.0
   @capacitor/core : 3.0.0

I would like to add an image in the following page:

import React from "react";
import {
  IonHeader,
  IonTitle,
  IonToolbar,
  IonIcon,
  IonMenuToggle,
  IonButton,
  IonButtons,
  IonImg,
} from "@ionic/react";
import { menuOutline } from "ionicons/icons";

const Header: React.FC = () => {
  return (
    <IonHeader>
      <IonToolbar className="menu-header">
        <IonButtons slot="start">
          <IonMenuToggle>
            <IonButton>
              <IonIcon slot="icon-only" icon={menuOutline}></IonIcon>
            </IonButton>
          </IonMenuToggle>
        </IonButtons>
        <IonTitle>
          {/**insert the image here />*/}
         <img src="img1.png" alt="">
        </IonTitle>
      </IonToolbar>
    </IonHeader>
  );
};

export default Header;

I'm new to Ionic and I don't know in which folder to put the image, in order to be shown correctly after building the app and testing it on Android/iOS emulator. If someone would explain to me the process of inserting an image in the app, I would be really thankful. Thank you!

Assets folder structure: enter image description here

Ani
  • 788
  • 3
  • 7
  • 21

0 Answers0