|
@@ -17,7 +17,6 @@ export default ({images = [], className, onChange, onClick, ref, current:propCur
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
if (containerRef.current){
|
|
if (containerRef.current){
|
|
const scrollTo = imgs.slice(0,propCurrent).reduce(widthSum, 0)
|
|
const scrollTo = imgs.slice(0,propCurrent).reduce(widthSum, 0)
|
|
- console.log('SCROLL TO ON PROP CURRRENT', scrollTo)
|
|
|
|
containerRef.current.scrollTo(scrollTo, 0)
|
|
containerRef.current.scrollTo(scrollTo, 0)
|
|
currentScrollPosition.current = scrollTo
|
|
currentScrollPosition.current = scrollTo
|
|
setCurrent(propCurrent)
|
|
setCurrent(propCurrent)
|
|
@@ -36,7 +35,6 @@ export default ({images = [], className, onChange, onClick, ref, current:propCur
|
|
}, [divRef, imgs])
|
|
}, [divRef, imgs])
|
|
|
|
|
|
|
|
|
|
- console.log('CURRENT', current)
|
|
|
|
|
|
|
|
const scrollToCurrent = () => {
|
|
const scrollToCurrent = () => {
|
|
|
|
|
|
@@ -61,6 +59,7 @@ export default ({images = [], className, onChange, onClick, ref, current:propCur
|
|
}
|
|
}
|
|
|
|
|
|
const onTouchEnd = () => {
|
|
const onTouchEnd = () => {
|
|
|
|
+ if (!containerRef.current) return
|
|
if (inTouch.current){
|
|
if (inTouch.current){
|
|
if (timeout.current) clearInterval(timeout.current)
|
|
if (timeout.current) clearInterval(timeout.current)
|
|
|
|
|