File tree Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -247,21 +247,24 @@ public async Task HandleTouch(TouchStatus status, TouchInteractionStatus? intera
247
247
defaultShadowRadius = ( float ? ) ( defaultShadowRadius ?? renderer . Layer . ShadowRadius ) ;
248
248
defaultShadowOpacity ??= renderer . Layer . ShadowOpacity ;
249
249
250
- await UIView . AnimateAsync ( .2 , ( ) =>
251
- {
252
- if ( color == Color . Default )
253
- renderer . Layer . Opacity = isStarted ? 0.5f : ( float ) control . Opacity ;
254
- else
255
- renderer . Layer . BackgroundColor = ( isStarted ? color : control . BackgroundColor ) . ToCGColor ( ) ;
256
-
257
- renderer . Layer . CornerRadius = isStarted ? radius : defaultRadius . GetValueOrDefault ( ) ;
258
-
259
- if ( shadowRadius >= 0 )
250
+ var tcs = new TaskCompletionSource < UIViewAnimatingPosition > ( ) ;
251
+ UIViewPropertyAnimator . CreateRunningPropertyAnimator ( .2 , 0 , UIViewAnimationOptions . AllowUserInteraction ,
252
+ ( ) =>
260
253
{
261
- renderer . Layer . ShadowRadius = isStarted ? shadowRadius : defaultShadowRadius . GetValueOrDefault ( ) ;
262
- renderer . Layer . ShadowOpacity = isStarted ? 0.7f : defaultShadowOpacity . GetValueOrDefault ( ) ;
263
- }
264
- } ) ;
254
+ if ( color == Color . Default )
255
+ renderer . Layer . Opacity = isStarted ? 0.5f : ( float ) control . Opacity ;
256
+ else
257
+ renderer . Layer . BackgroundColor = ( isStarted ? color : control . BackgroundColor ) . ToCGColor ( ) ;
258
+
259
+ renderer . Layer . CornerRadius = isStarted ? radius : defaultRadius . GetValueOrDefault ( ) ;
260
+
261
+ if ( shadowRadius >= 0 )
262
+ {
263
+ renderer . Layer . ShadowRadius = isStarted ? shadowRadius : defaultShadowRadius . GetValueOrDefault ( ) ;
264
+ renderer . Layer . ShadowOpacity = isStarted ? 0.7f : defaultShadowOpacity . GetValueOrDefault ( ) ;
265
+ }
266
+ } , endPos => tcs . SetResult ( endPos ) ) ;
267
+ await tcs . Task ;
265
268
}
266
269
}
267
270
You can’t perform that action at this time.
0 commit comments