Skip to content

Commit 79e4d40

Browse files
authored
fix: fix useLayoutEffect warning (#1045)
1 parent 7853d7f commit 79e4d40

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Slider.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import cls from 'classnames';
2-
import { useEvent } from 'rc-util';
2+
import useEvent from 'rc-util/lib/hooks/useEvent';
33
import useMergedState from 'rc-util/lib/hooks/useMergedState';
44
import isEqual from 'rc-util/lib/isEqual';
55
import warning from 'rc-util/lib/warning';

src/hooks/useDrag.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { useEvent } from 'rc-util';
21
import * as React from 'react';
2+
import useEvent from 'rc-util/lib/hooks/useEvent';
3+
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
34
import { UnstableContext } from '../context';
45
import type { Direction, OnStartMove } from '../interface';
56
import type { OffsetValues } from './useOffset';
@@ -44,7 +45,7 @@ function useDrag(
4445

4546
const { onDragStart, onDragChange } = React.useContext(UnstableContext);
4647

47-
React.useLayoutEffect(() => {
48+
useLayoutEffect(() => {
4849
if (draggingIndex === -1) {
4950
setCacheValues(rawValues);
5051
}

0 commit comments

Comments
 (0)