Hi everyone, we just started to develop our project on Ionic and I would like to know how to solve this problem. We’re using Ionic with TailwindCSS for our content, so Ionic will only be used for navigation, routing, transitions and everything related on rendering correctly on every mobile device (handling notch, safe areas and so on).
So here’s how we would like to setup our layout for App.tsx
<IonApp>
<IonHeader className="ion-no-border">
<IonToolbar>
<CustomHeader />
</IonToolbar>
</IonHeader>
<IonReactRouter>
<IonRouterOutlet>
<Route path={Path.Home}>
{({history}) => <Home history={history} /> }
</Route>
<Route path={Path.Detail}>
<Detail />
</Route>
</IonRouterOutlet>
<IonFooter className="ion-no-border">
<IonToolbar>
<CustomFooter />
</IonToolbar>
</IonFooter>
</IonReactRouter>
</IonApp>
Inside CustomHeader
and CustomFooter
have only custom html+css
Now, every page will have a custom layout wrapped by theIonPage
andIonContent
like this:
<IonPage>
<IonContent >{children}</IonContent>
</IonPage>
Here’s the list of my problem (and unfortunately I think that I’m just scratching the surface…)
- I have to use
IonHeader
andIonFooter
with aIonToolbar
to wrap myCustomHeader
andCustomFooter
because otherwise the app will not respect the device safe area. The problem is thatIonToolbar
seems to be adding an additional top, bottom, left and right padding on myCustomHeader
andCustomFooter
. How can I remove that padding?
- All of my custom HTML page content inside the
<IonContent>
is displayed under theIonHeader
andIonFooter
. What should I do in order to add the correct padding to the top and bottom of the<IonContent>
in order to avoid that?