react-best-gradient-color-picker
Advanced tools
Comparing version 1.4.7 to 1.4.8
import React, { useRef, useState, useEffect } from "react"; | ||
import { useScrollPosition } from 'react-use-scroll-position'; | ||
import { useWindowSizes } from 'react-use-window-sizes'; | ||
import PickerContextWrapper from './context'; | ||
@@ -18,6 +17,2 @@ import Picker from "./Picker"; | ||
const contRef = useRef(null); | ||
const { | ||
width, | ||
height | ||
} = useWindowSizes(); | ||
const [bounds, setBounds] = useState(passedBounds || {}); | ||
@@ -28,8 +23,9 @@ const { | ||
} = useScrollPosition(); | ||
const boundingRect = contRef?.current?.getBoundingClientRect(); | ||
useEffect(() => { | ||
if (!passedBounds) { | ||
setBounds(contRef?.current?.getBoundingClientRect()); | ||
setTimeout(() => setBounds(contRef?.current?.getBoundingClientRect()), 150); | ||
setBounds(boundingRect); | ||
setTimeout(() => setBounds(boundingRect), 150); | ||
} | ||
}, [width, height, x, y]); | ||
}, [boundingRect, x, y]); | ||
return /*#__PURE__*/React.createElement("div", { | ||
@@ -36,0 +32,0 @@ ref: contRef |
{ | ||
"name": "react-best-gradient-color-picker", | ||
"version": "1.4.7", | ||
"version": "1.4.8", | ||
"description": "An easy to use color/gradient picker for React.js", | ||
@@ -48,5 +48,4 @@ "main": "lib/index.js", | ||
"tinycolor2": "^1.4.2", | ||
"react-use-scroll-position": "^2.0.0", | ||
"react-use-window-sizes": "^1.0.3" | ||
"react-use-scroll-position": "^2.0.0" | ||
} | ||
} |
import React, { useRef, useState, useEffect } from "react" | ||
import { useScrollPosition } from 'react-use-scroll-position'; | ||
import { useWindowSizes } from 'react-use-window-sizes'; | ||
import PickerContextWrapper from './context'; | ||
@@ -11,12 +10,12 @@ import Picker from "./Picker"; | ||
const contRef = useRef(null); | ||
const { width, height } = useWindowSizes(); | ||
const [bounds, setBounds] = useState(passedBounds || {}); | ||
const { x, y } = useScrollPosition(); | ||
const boundingRect = contRef?.current?.getBoundingClientRect(); | ||
useEffect(() => { | ||
if (!passedBounds) { | ||
setBounds(contRef?.current?.getBoundingClientRect()) | ||
setTimeout(() => setBounds(contRef?.current?.getBoundingClientRect()), 150) | ||
setBounds(boundingRect) | ||
setTimeout(() => setBounds(boundingRect), 150) | ||
} | ||
}, [width, height, x, y]) | ||
}, [boundingRect, x, y]) | ||
@@ -23,0 +22,0 @@ return ( |
6
68979
2031
- Removedreact-use-window-sizes@^1.0.3
- Removedreact-dom@18.3.1(transitive)
- Removedreact-use-window-sizes@1.0.3(transitive)
- Removedscheduler@0.23.2(transitive)