Explorar o código

scrollLeft fun

asmer hai 3 meses
pai
achega
7997c60a7b
Modificáronse 4 ficheiros con 31052 adicións e 36519 borrados
  1. 19483 28960
      example/package-lock.json
  2. 1 1
      example/package.json
  3. 11567 7556
      package-lock.json
  4. 1 2
      src/SliderImage.js

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 19483 - 28960
example/package-lock.json


+ 1 - 1
example/package.json

@@ -4,7 +4,7 @@
   "version": "0.0.0",
   "private": true,
   "scripts": {
-    "start": "node ../node_modules/react-scripts/bin/react-scripts.js start",
+    "start": "node ../node_modules/react-scripts/bin/react-scripts.js --openssl-legacy-provider start ",
     "build": "node ../node_modules/react-scripts/bin/react-scripts.js build",
     "test": "node ../node_modules/react-scripts/bin/react-scripts.js test",
     "eject": "node ../node_modules/react-scripts/bin/react-scripts.js eject"

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 11567 - 7556
package-lock.json


+ 1 - 2
src/SliderImage.js

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