@@ -119,6 +119,7 @@ export default class Button extends React.Component {
119119 this . animating = false ;
120120 this . timeout = null ;
121121 this . pressing = false ;
122+ this . progressing = false ;
122123 this . containerWidth = null ;
123124
124125 this . state = {
@@ -212,14 +213,19 @@ export default class Button extends React.Component {
212213 } ;
213214
214215 pressOut = event => {
215- if ( this . props . disabled === true || ! this . props . children ) {
216+ if (
217+ this . props . disabled === true ||
218+ ! this . props . children ||
219+ this . progressing === true
220+ ) {
216221 return false ;
217222 }
218223 if ( event . nativeEvent && event . nativeEvent . contentOffset ) {
219224 this . release ( ) ;
220225 return ;
221226 }
222227 if ( this . animating === true ) {
228+ this . progressing = true ;
223229 this . press ( ) ;
224230 return ;
225231 }
@@ -236,7 +242,7 @@ export default class Button extends React.Component {
236242
237243 press = ( ) => {
238244 if ( this . props . progress === true ) {
239- this . animating = true ;
245+ // this.animating = true;
240246 this . setState (
241247 {
242248 activity : true
@@ -264,40 +270,42 @@ export default class Button extends React.Component {
264270 } ;
265271
266272 end = callback => {
267- if ( this . props . progress === true ) {
268- if ( this . timeout ) {
269- clearTimeout ( this . timeout ) ;
270- }
271- this . timeout = setTimeout ( ( ) => {
272- animateTiming ( {
273- variable : this . animatedLoading ,
274- toValue : 1 ,
275- callback : ( ) => {
276- animateElastic ( {
277- variable : this . textOpacity ,
278- toValue : 1
279- } ) ;
280- animateElastic ( {
281- variable : this . activityOpacity ,
282- toValue : 0 ,
283- callback : ( ) => {
284- callback && callback ( ) ;
285- }
286- } ) ;
287- animateTiming ( {
288- variable : this . loadingOpacity ,
289- toValue : 0 ,
290- delay : 100 ,
291- callback : ( ) => {
292- this . release ( ( ) => {
293- this . animating = false ;
294- } ) ;
295- }
296- } ) ;
297- }
298- } ) ;
299- } , 50 ) ;
273+ if ( this . props . progress !== true ) {
274+ return ;
300275 }
276+ if ( this . timeout ) {
277+ clearTimeout ( this . timeout ) ;
278+ }
279+ this . timeout = setTimeout ( ( ) => {
280+ animateTiming ( {
281+ variable : this . animatedLoading ,
282+ toValue : 1 ,
283+ callback : ( ) => {
284+ animateElastic ( {
285+ variable : this . textOpacity ,
286+ toValue : 1
287+ } ) ;
288+ animateElastic ( {
289+ variable : this . activityOpacity ,
290+ toValue : 0 ,
291+ callback : ( ) => {
292+ callback && callback ( ) ;
293+ }
294+ } ) ;
295+ animateTiming ( {
296+ variable : this . loadingOpacity ,
297+ toValue : 0 ,
298+ delay : 100 ,
299+ callback : ( ) => {
300+ this . release ( ( ) => {
301+ this . animating = false ;
302+ this . progressing = false ;
303+ } ) ;
304+ }
305+ } ) ;
306+ }
307+ } ) ;
308+ } , 50 ) ;
301309 } ;
302310
303311 release ( callback ) {
0 commit comments