From 9e6c520fb99d3dd3ba702af8c4e2bacea02f5418 Mon Sep 17 00:00:00 2001 From: CoderProject Date: Tue, 13 Jun 2017 02:09:54 +0300 Subject: [PATCH] Add initial value option Add ability to set an initial value so we can have choice not to animate from 0 at startup. --- dist/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index c2b339f..1ace5c4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -21,6 +21,7 @@ export default class AnimateNumber extends Component { interval? : ?number, steps? : ?number, value : number, + initial : ?number, timing : 'linear' | 'easeOut' | 'easeIn' | () => number, formatter : () => {}, onProgress : () => {}, @@ -77,7 +78,7 @@ export default class AnimateNumber extends Component { super(props); // default values of state and non-state variables this.state = { - value : 0, + value : this.props.initial ? this.props.initial : 0, displayValue : 0 } this.dirty = false;