import React, { useRef } from "react"; import { StyleSheet, View, StatusBar, ImageBackground, Text, TouchableOpacity, Animated, PanResponder, } from "react-native"; import EntypoIcon from "react-native-vector-icons/Entypo"; import Svg, { G, Polyline, Line, Circle, Rect, Text as SvgText } from 'react-native-svg'; let AnimatedCircle = Animated.createAnimatedComponent(Circle); let AnimatedG = Animated.createAnimatedComponent(G); function SliderDraftView(props) { const pan = useRef(new Animated.ValueXY()).current; /* const panResponder = useRef( PanResponder.create({ onPanResponderTerminationRequest: () => { console.log("p1"); return false; }, onStartShouldSetPanResponder: () => { console.log("p2"); return true; }, onMoveShouldSetPanResponder: () => { console.log("p3"); return true; }, //onPanResponderMove: Animated.event([ // null, // { dx: pan.x, dy: pan.y } //]), onPanResponderMove: (e, gesture) => { console.log(gesture); }, onPanResponderRelease: () => { console.log("release"); Animated.spring(pan, { toValue: { x: 0, y: 0 } }).start(); } }) );//.current; */ const panResponder = useRef(PanResponder.create({ onStartShouldSetPanResponder: () => true, onMoveShouldSetPanResponderCapture: () => true, onPanResponderMove: (_, { dx, dy }) => { console.log("bla", dx, dy); cx.setValue(dx); cy.setValue(dy); setCurrentPoint({ x: dx, y: dy }); }, onPanResponderRelease: (e, { dx, dy }) => { console.log("release", dx, dy); cx.extractOffset(); cy.extractOffset(); offsetX = offsetX + dx; offsetY = offsetY + dy; } })).current; console.log({ ...panResponder.panHandlers }); return ( {props.backButton && props.navigation.goBack()}> } Slider Draft 42 ) } const setupViewStyles = StyleSheet.create({ container: { flex: 1, justifyContent: "space-between", width: "80%", marginLeft: 40, marginTop: 60, }, headerText: { color: "rgba(255,255,255,1)", fontSize: 25, }, subtext: { color: "rgba(255,255,255,1)", textAlign: "left", fontSize: 18, lineHeight: 25, width: "80%", marginBottom: 50, }, backButton: { color: "rgba(255,255,255,1)", fontSize: 40 }, }); export default SliderDraftView;