This commit is contained in:
Jacob Lauritzen 2018-06-25 16:46:28 +02:00
parent 805c34efcd
commit 2474fdbd7c
5 changed files with 13 additions and 86 deletions

View File

@ -24,13 +24,13 @@ export default class Example extends React.Component {
},
onPanResponderMove: (evt, gestureState) => {
this.refs.circularProgress.performLinearAnimation(0, 0);
this.refs.circularProgress.animate(0, 0);
// For each 2 pixels add or subtract 1 point
this.setState({ pointsDelta: Math.round(-gestureState.dy / 2) });
},
onPanResponderTerminationRequest: (evt, gestureState) => true,
onPanResponderRelease: (evt, gestureState) => {
this.refs.circularProgress.performLinearAnimation(100, 2000);
this.refs.circularProgress.animate(100, 2000);
let points = this.state.points + this.state.pointsDelta;
console.log(Math.min(points, MAX_POINTS));
this.setState({
@ -55,12 +55,13 @@ export default class Example extends React.Component {
fill={fill}
tintColor="#00e0ff"
backgroundColor="#3d5875"
renderChild={(fill) => (
>
{(fill) => (
<Text style={styles.points}>
{ Math.round(MAX_POINTS * fill / 100) }
</Text>
)}
/>
</AnimatedCircularProgress>
<AnimatedCircularProgress
size={120}

View File

@ -9131,93 +9131,22 @@
"integrity": "sha1-IWevhrvJ+WS9Rb1fN2hOW1SWXjI="
},
"react-native-circular-progress": {
"version": "file:..",
"version": "git+https://github.com/bgryszko/react-native-circular-progress.git#805c34efcdfe150a5290d8f12d00fdc0424bf290",
"from": "git+https://github.com/bgryszko/react-native-circular-progress.git",
"requires": {
"prop-types": "^15.6.0",
"react-native-svg": "^6.3.1"
},
"dependencies": {
"color": {
"version": "2.0.1",
"bundled": true,
"requires": {
"color-convert": "^1.9.1",
"color-string": "^1.5.2"
}
},
"color-convert": {
"version": "1.9.2",
"bundled": true,
"requires": {
"color-name": "1.1.1"
}
},
"color-name": {
"version": "1.1.1",
"bundled": true
},
"color-string": {
"version": "1.5.2",
"bundled": true,
"requires": {
"color-name": "^1.0.0",
"simple-swizzle": "^0.2.2"
}
},
"fbjs": {
"version": "",
"bundled": true
},
"is-arrayish": {
"version": "0.3.2",
"bundled": true
},
"js-tokens": {
"version": "3.0.2",
"bundled": true
},
"lodash": {
"version": "4.17.10",
"bundled": true
},
"loose-envify": {
"version": "1.3.1",
"bundled": true,
"requires": {
"js-tokens": "^3.0.0"
}
},
"object-assign": {
"version": "4.1.1",
"bundled": true
},
"pegjs": {
"version": "0.10.0",
"bundled": true
},
"prop-types": {
"version": "15.6.2",
"bundled": true,
"requires": {
"loose-envify": "^1.3.1",
"object-assign": "^4.1.1"
}
},
"react-native-svg": {
"version": "6.3.1",
"bundled": true,
"resolved": "https://registry.npmjs.org/react-native-svg/-/react-native-svg-6.3.1.tgz",
"integrity": "sha512-0kmfUwKUBWnPuJpy+bdGIYKkXHg/M/X57ji8b3d3ZFB2rRTWMRkwI1D+AJ6FQRX109+FJn6L6hsIokDj1lckzA==",
"requires": {
"color": "^2.0.1",
"lodash": "^4.16.6",
"pegjs": "^0.10.0"
}
},
"simple-swizzle": {
"version": "0.2.2",
"bundled": true,
"requires": {
"is-arrayish": "^0.3.1"
}
}
}
},

View File

@ -22,6 +22,6 @@
"expo": "^27.0.0",
"react": "16.3.1",
"react-native": "^0.55.0",
"react-native-circular-progress": "file:../"
"react-native-circular-progress": "git+https://github.com/bgryszko/react-native-circular-progress.git"
}
}

View File

@ -62,6 +62,6 @@ AnimatedCircularProgress.propTypes = {
AnimatedCircularProgress.defaultProps = {
duration: 500,
easing: Easing.ease,
easing: Easing.elastic(1),
prefill: 0,
};

View File

@ -83,7 +83,7 @@ export default class CircularProgress extends React.PureComponent {
</Svg>
{children && (
<View style={childContainerStyle}>
{typeof children === 'function' ? children(fill) : children}
{children(fill)}
</View>
)}
</View>
@ -102,10 +102,7 @@ CircularProgress.propTypes = {
rotation: PropTypes.number,
lineCap: PropTypes.string,
arcSweepAngle: PropTypes.number,
children: PropTypes.oneOf([
propTypes.func,
PropTypes.node,
]),
children: PropTypes.func,
};
CircularProgress.defaultProps = {