Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear time out fix #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import {
Text,
View
} from 'react-native';
import Timer from 'react-timer-mixin';
import TimerMixin from 'react-timer-mixin';
import reactMixin from 'react-mixin';

const HALF_RAD = Math.PI/2

export default class AnimateNumber extends Component {
class AnimateNumber extends Component {

props : {
countBy? : ?number,
Expand Down Expand Up @@ -130,7 +131,7 @@ export default class AnimateNumber extends Component {

let progress = this.getAnimationProgress()

Timer.setTimeout(() => {
this.setTimeout(() => {

let value = (this.endWith - this.startFrom)/this.props.steps
let sign = value >= 0 ? 1 : -1
Expand Down Expand Up @@ -173,3 +174,7 @@ export default class AnimateNumber extends Component {
}

}

reactMixin(AnimateNumber.prototype, TimerMixin);

export default AnimateNumber;
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "MIT",
"dependencies": {
"babel-plugin-syntax-async-functions": "^6.8.0",
"react-mixin": "^4.0.0",
"react-timer-mixin": "^0.13.3"
},
"keywords": [
Expand Down Expand Up @@ -57,7 +58,7 @@
"react-native": "0.25.1",
"react-native-mock": "^0.1.0"
},
"repository": {
"url": "https://github.com/wkh237/react-native-animate-number.git"
}
"repository": {
"url": "https://github.com/wkh237/react-native-animate-number.git"
}
}