react-modern-calendar-datepicker icon indicating copy to clipboard operation
react-modern-calendar-datepicker copied to clipboard

problem with zIndex

Open shahabt24 opened this issue 4 years ago • 8 comments

hello thank you for this beautiful package the problem is when i use more than one datepicker in a page, the calendar will goes under another datepicker input as attached image. i will be thankful if give me a solution Screenshot (233)

shahabt24 avatar Jul 28 '20 09:07 shahabt24

any idea or solution??

shahabt24 avatar Aug 05 '20 06:08 shahabt24

I also have this problem.Did you solve it?

alireza9382 avatar Oct 05 '20 22:10 alireza9382

not completely I added some classes to wrapperClassName and inputClassName

shahabt24 avatar Oct 06 '20 05:10 shahabt24

Just do this: .DatePicker{ z-index: unset!important; }

.DatePicker__calendarContainer{ z-index: 10!important; }

vahidimani avatar Dec 09 '20 12:12 vahidimani

Just do this: .DatePicker{ z-index: unset!important; }

.DatePicker__calendarContainer{ z-index: 10!important; }

You can load the library css before your stylesheet and do whitout !important Thanks @vahidimani for the snippet

lorenzocorallo avatar Dec 30 '20 22:12 lorenzocorallo

This is my solution, maybe not the best, but at least I have been running well in my project for a while . solution

me82852578 avatar Jan 06 '21 03:01 me82852578

I did something like this and works, the only details is you need to use renderInput prop...

import { useState } from "react";
import InputDate from "../inputDate/inputDate";
import DatePicker from "react-modern-calendar-datepicker";
import styles from "./datePickerWrapper.module.scss";

import { formatDatePicker } from "../../utils/format";

const DatePickerWrapper = ({name, prompt}) => {
    const [depth, setDepth] = useState(false);
    const [value, setValue] = useState(null) ;

   //---------------> SET FOCUS AND BLUR METHODS TO UPDATE DEPTH STATE <---------------//
    const inputDate = ({ref}) => (<InputDate reference={ref} name={name} date={value ? formatDatePicker(value) : ""} prompt={prompt} onFocus={() => setDepth(true)} onBlur={() => setDepth(!depth)} />);

    return (
        <DatePicker
            value={value}
            onChange={setValue}
            renderInput={inputDate}
            calendarClassName={styles["date-picker_calendar"]}
            calendarTodayClassName={styles["date-picker_today"]}
            //---------------> HERE YOU CONTROLS THE DEPTH <---------------//
            wrapperClassName={[styles["date-picker"], depth ? styles["date-picker_depth"] : ""].join(" ")}
            colorPrimary="#FF4e4b"
            colorPrimeryLight="#FF8377"
            shouldHighlightWeekends
        />
    )
};

export default DatePickerWrapper;

joeleduardo avatar Jan 14 '21 10:01 joeleduardo

Just do this: .DatePicker{ z-index: unset!important; }

.DatePicker__calendarContainer{ z-index: 10!important;} i did this and my problem was solved,Tnk :)

mohadese-zarrin avatar Mar 12 '22 10:03 mohadese-zarrin