react-native-circular-progress icon indicating copy to clipboard operation
react-native-circular-progress copied to clipboard

Touch event

Open voulgarakis opened this issue 4 years ago • 5 comments

Hello,

Is it possible to change the progress fill by touching and moving the circle in the renderCap?

voulgarakis avatar Jan 27 '21 08:01 voulgarakis

Are you planning to add this functionality in the future?

sturmenta avatar Mar 08 '21 16:03 sturmenta

I did a custom implementation using PanResponder

voulgarakis avatar Mar 09 '21 07:03 voulgarakis

I did a custom implementation using PanResponder

can you share it with me ? I need change progress on touch

mohamad-1994 avatar Mar 11 '21 08:03 mohamad-1994

import { ... PanResponder, } from 'react-native';

const _circularProgressRef = React.createRef(); const _panResponder = PanResponder.create({ onStartShouldSetPanResponder: (evt, gestureState) => true, onStartShouldSetPanResponderCapture: (evt, gestureState) => true, onMoveShouldSetPanResponder: (evt, gestureState) => true, onMoveShouldSetPanResponderCapture: (evt, gestureState) => true,

onPanResponderGrant: (evt, gestureState) => {
  setIsMoving(true);
  setPointsDelta(0);
},

onPanResponderMove: (evt, gestureState) => {
  if (_circularProgressRef.current) {
    _circularProgressRef.current.animate(0, 0);
  }

  // Handle state variable

},
onPanResponderTerminationRequest: (evt, gestureState) => true,
onPanResponderRelease: (evt, gestureState) => {
  if (_circularProgressRef.current) {
    _circularProgressRef.current.animate(100, 3000);
  }

  setIsMoving(false);
  setPointsDelta(0);
},

});

. . .

<View style={styles.progressBar} {..._panResponder.panHandlers}> <AnimatedCircularProgress duration={0} size={300} width={25} fill={percentArc} tintColor="#6277f1" backgroundColor="#b1b1b1" padding={10} rotation={ROTATION} arcSweepAngle={ARC} renderCap={({center}) => ( <Circle cx={center.x} cy={center.y} r="18" fill="#4d4d4d" /> )}> ... </AnimatedCircularProgress> </View>

voulgarakis avatar Mar 16 '21 07:03 voulgarakis

is not working for me

halesh71 avatar Nov 08 '21 11:11 halesh71