Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

331
Views
Dynamic content in Ionic React modal/bottom-sheet causes modals to render on top of eachother

When passing dynamic content to an ion modal bottom sheet, instead of updating the content in the bottom sheet a new bottom sheet is rendered on top of the previous one, eventually leading to a load of modals on top of each other.

I think this is an ion modal issue and not specifically bottom sheet.

The content is updated when a user navigates to a new url path so it may be a navigation issue or to do with the content updating. Either way you can continue to add modals seemingly infinitely even though the ModalDrawer component below is only called once which isn't the expected behaviour.

Here is the code:

import React from 'react';
import { IonModal } from '@ionic/react';
import DrawerContent from '../DrawerContent';
import { useLocation } from 'react-router';

interface PageProps {
  isOpen: boolean;
  isMobile: boolean;
  selectedLocation: any;
  emissionsData: {id: string, name: string, emissions: string[]}[];
  entitiesByBusinessType: object[];
}

const MobileDrawer: React.FC<PageProps> = (props) => {

  const location = useLocation()

  const modalSubject = props.entitiesByBusinessType  || location.pathname === props.emissionsData[0].id ? (
    <DrawerContent 
      entitiesByBusinessType={props.entitiesByBusinessType}
      emissionsData={props.emissionsData}
      isOpen={props.isOpen}
      isMobile={props.isMobile}
    />
  ) : null

  return (
    <div>
      <IonModal 
        isOpen={true}
        swipeToClose={true}
        breakpoints={[ 0.05, 0.4, 0.95 ]}
        initialBreakpoint={0.4}
        backdropBreakpoint={0.4}
        className="bottom-sheet"
        showBackdrop={true}
        backdropDismiss={false}
        children={modalSubject}
      />
    </div>
  );
};

export default MobileDrawer;

Here are some images to further explain my point:

How the app should act (1 bottom sheet): Normal app behaviour

App with multiple bottom sheets/modals on top of each other: App with 2 stacked modals App with 3 stacked modals

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!