rn-range-slider
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -26,2 +26,3 @@ import React, { useCallback, useState, useRef, useMemo } from 'react'; | ||
const { low: lowState, high: highState } = inPropsRef.current; | ||
const inPropsRefPrev = { lowPrev: lowState, highPrev: highState }; | ||
@@ -38,3 +39,3 @@ // Props have higher priority. | ||
const setHigh = value => inPropsRef.current.high = value; | ||
return { inPropsRef, setLow, setHigh }; | ||
return { inPropsRef, inPropsRefPrev, setLow, setHigh }; | ||
}; | ||
@@ -41,0 +42,0 @@ |
@@ -32,3 +32,3 @@ import React, { memo, useState, useEffect, useCallback, useMemo, useRef } from 'react'; | ||
) => { | ||
const { inPropsRef, setLow, setHigh } = useLowHigh(lowProp, disableRange ? max : highProp, min, max, step); | ||
const { inPropsRef, inPropsRefPrev, setLow, setHigh } = useLowHigh(lowProp, disableRange ? max : highProp, min, max, step); | ||
const lowThumbXRef = useRef(new Animated.Value(0)); | ||
@@ -67,7 +67,7 @@ const highThumbXRef = useRef(new Animated.Value(0)); | ||
useEffect(() => { | ||
const { low, high } = inPropsRef.current; | ||
if ((lowProp !== undefined && lowProp !== low) || (highProp !== undefined && highProp !== high)) { | ||
const { lowPrev, highPrev } = inPropsRefPrev; | ||
if ((lowProp !== undefined && lowProp !== lowPrev) || (highProp !== undefined && highProp !== highPrev)) { | ||
updateThumbs(); | ||
} | ||
}, [highProp, inPropsRef, lowProp]); | ||
}, [highProp, inPropsRefPrev.lowPrev, inPropsRefPrev.highPrev, lowProp]); | ||
@@ -74,0 +74,0 @@ useEffect(() => { |
{ | ||
"name": "rn-range-slider", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"author": "Tigran Sahakyan <mail.of.tigran@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "A highly optimized pure JS implementation of Range Slider for React Native", |
22246
395