Skip to content

Commit

Permalink
Fix forget to use the ref parameter (#1383)
Browse files Browse the repository at this point in the history
  • Loading branch information
takurinton authored Aug 22, 2023
1 parent a17cfec commit e69e7c9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilly-rabbits-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ingred-ui": patch
---

fix forget to use the ref parameter
26 changes: 16 additions & 10 deletions src/components/NewDateRangePicker/NewDateRangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
ClickState,
ClickStateType,
} from "../Calendar/CalendarRange/constants";
import { useMergeRefs } from "../../hooks/useMergeRefs";

export type DateRange = {
startDate: Dayjs;
Expand Down Expand Up @@ -63,23 +64,28 @@ export type NewDateRangePickerProps = {
export const DateRangePicker = forwardRef<
HTMLDivElement,
NewDateRangePickerProps
>(function DateRangePicker({
startDate,
endDate,
errorText,
disabled = false,
isOutsideRange = () => false,
actions,
onDatesChange,
}) {
>(function DateRangePicker(
{
startDate,
endDate,
errorText,
disabled = false,
isOutsideRange = () => false,
actions,
onDatesChange,
},
propRef,
) {
const [open, setOpen] = useState(false);
const { context, refs, strategy, x, y } = useFloating({
placement: "right-start",
open,
onOpenChange: setOpen,
middleware: [offset(10), flip()],
});
const ref = useRef<HTMLDivElement>(null);
const innerRef = useRef<HTMLDivElement>(null);
const ref = useMergeRefs(propRef, innerRef);

const dismiss = useDismiss(context);
const role = useRole(context);

Expand Down

0 comments on commit e69e7c9

Please sign in to comment.