Skip to content

Commit

Permalink
fix(@clayui/slider): avoid async rendering to render synchronous chan…
Browse files Browse the repository at this point in the history
…ges before repaint
  • Loading branch information
matuzalemsteles committed Sep 25, 2019
1 parent eb2ad89 commit 9069169
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/clay-slider/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import classNames from 'classnames';
import React, {useEffect, useRef, useState} from 'react';
import React, {useLayoutEffect, useRef, useState} from 'react';

interface IProps extends React.InputHTMLAttributes<HTMLInputElement> {
/**
Expand Down Expand Up @@ -92,7 +92,7 @@ const ClaySlider: React.FunctionComponent<IProps> = ({
const sliderRef = useRef<HTMLInputElement | null>(null);
const thumbRef = useRef<HTMLDivElement | null>(null);

useEffect(() => {
useLayoutEffect(() => {
if (sliderRef.current && thumbRef.current) {
const thumbWidth = thumbRef.current.clientWidth;

Expand Down

0 comments on commit 9069169

Please sign in to comment.