react-best-gradient-color-picker
Advanced tools
Comparing version 1.4.12 to 1.4.13
import React, { useRef, useState, useEffect } from "react"; | ||
import { useScrollPosition } from 'react-use-scroll-position'; | ||
import PickerContextWrapper from './context'; | ||
@@ -17,6 +16,2 @@ import Picker from "./Picker"; | ||
const [bounds, setBounds] = useState({}); | ||
const { | ||
x, | ||
y | ||
} = useScrollPosition(); | ||
const boundingRect = contRef?.current?.getBoundingClientRect() || {}; | ||
@@ -26,10 +21,9 @@ const { | ||
height, | ||
left, | ||
right, | ||
top | ||
x, | ||
y | ||
} = boundingRect; | ||
useEffect(() => { | ||
setBounds(contRef?.current?.getBoundingClientRect()); | ||
setTimeout(() => setBounds(contRef?.current?.getBoundingClientRect()), 150); | ||
}, [bottom, height, left, right, top]); | ||
}, [bottom, height, right, x, y]); | ||
return /*#__PURE__*/React.createElement("div", { | ||
@@ -36,0 +30,0 @@ ref: contRef |
{ | ||
"name": "react-best-gradient-color-picker", | ||
"version": "1.4.12", | ||
"version": "1.4.13", | ||
"description": "An easy to use color/gradient picker for React.js", | ||
@@ -47,5 +47,4 @@ "main": "lib/index.js", | ||
"lodash.throttle": "^4.1.1", | ||
"tinycolor2": "^1.4.2", | ||
"react-use-scroll-position": "^2.0.0" | ||
"tinycolor2": "^1.4.2" | ||
} | ||
} |
import React, { useRef, useState, useEffect } from "react" | ||
import { useScrollPosition } from 'react-use-scroll-position'; | ||
import PickerContextWrapper from './context'; | ||
@@ -11,10 +10,8 @@ import Picker from "./Picker"; | ||
const [bounds, setBounds] = useState({}); | ||
const { x, y } = useScrollPosition(); | ||
const boundingRect = contRef?.current?.getBoundingClientRect() || {}; | ||
const { bottom, height, left, right, top } = boundingRect | ||
const { bottom, height, right, x, y } = boundingRect | ||
useEffect(() => { | ||
setBounds(contRef?.current?.getBoundingClientRect()) | ||
setTimeout(() => setBounds(contRef?.current?.getBoundingClientRect()), 150) | ||
}, [bottom, height, left, right, top]) | ||
}, [bottom, height, right, x, y]) | ||
@@ -21,0 +18,0 @@ return ( |
5
68707
2025
- Removedreact-use-scroll-position@^2.0.0
- Removedreact-use-scroll-position@2.0.0(transitive)