Bug 35707 - Views don't lay out properly when changing the view hierarchy between rotation animations
Summary: Views don't lay out properly when changing the view hierarchy between rotatio...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.5.1
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-11-09 17:16 UTC by Adam Kemp
Modified: 2016-12-20 19:39 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Example project (172.27 KB, application/zip)
2015-11-09 17:16 UTC, Adam Kemp

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Adam Kemp 2015-11-09 17:16:03 UTC
Created attachment 13745 [details]
Example project

I am trying to implement a flip view where there is a "top" and a "bottom", and I can animate between the two using a flip animation. I'm effectively doing this by doing an animated rotation along the Y axis and swapping the views in the middle, like this:

                await _frame.RotateYTo(-90);
                _frame.Content = newView;
                _frame.RotationY = 90;
                await _frame.RotateYTo(0);

When I do this then at the end of the animation I can't see the content. Once I begin a new animation (swapping back to the other view) the current view suddenly appears during the first rotation animation, but in every case the view at the end of the animation is invisible.

I suspect that this is caused by a layout issue. I have experimented with a few variations like this:

                await _frame.RotateYTo(-90);
                _frame.RotationY = 0;
                _frame.Content = newView;
                await Task.Yield();
                _frame.RotationY = 90;
                await _frame.RotateYTo(0);

When I play games like this I can get the view to appear correctly most of the time (but not all of the time), but there are of course visual artifacts when I do this. The view jumps to the final appearance in the middle of the animation. Obviously this approach can't be the correct solution because it looks terrible, but it does give a hint about what the problem might be. It doesn't seem to like changing the frame content while it has a RotationY of 90.

Attached is an example project. Run the project and click on the button. The expected results are that the view flips to reveal "Bottom" and then "Top" and then "Bottom" etc. each time you click the button. Instead what you see is the view flips to a blank side, but next time you click the button that side is revealed.

The relevant code is in FlipCardView.cs in the SetSide method.
Comment 1 Rajneesh Kumar 2016-01-13 15:25:40 UTC
I have checked this issue and able to reproduce this. To reproduce this issue I have followed instruction provided in bug description.

I observed that each time I click the button, the view flips to a blank side, but next time I click the button that side is revealed.

Screencast: http://www.screencast.com/t/MHUuU6Rpiv3

Ide Logs: https://gist.github.com/Rajneesh360Logica/8132db9a45df93098d1e
Simulator Logs: https://gist.github.com/Rajneesh360Logica/0260270c25348ecf102c

Environment Info:

=== Xamarin Studio ===

Version 5.10.2 (build 50)
Installation UUID: 229ec167-a154-47bf-bb8b-10fe36c1ad41
	Mono 4.2.2 (explicit/d5c4649)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402020023

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/360_macmini/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3  (API level 15)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		6.0    (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.1
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.2 (9548)
Build 7C68

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 122b860
Branch: master
Build date: 2016-01-05 20:20:30-0500

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 510020050
Git revision: 63da12d16f2ab00849bd9dd59d08ba7f5f05d578
Build date: 2016-01-11 19:27:34-05
Xamarin addins: 55f2d3596d8c1229f68d10e2b94332ca67222b48
Build lane: monodevelop-lion-cycle6-c6sr1

=== Operating System ===

Mac OS X 10.11.2
Darwin 360-MACMINIs-Mac-mini.local 15.2.0 Darwin Kernel Version 15.2.0
    Fri Nov 13 19:56:56 PST 2015
    root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
Comment 2 Samantha Houts [MSFT] 2016-12-20 19:39:03 UTC
I tested this project without alteration on an Android device and an iOS device and did _not_ reproduce the described behavior. The content appears correctly at the beginning and end of the animation.

If you continue to experience this issue, please reopen the report with additional information.

Warm regards,
Xamarin Forms Team