File tree Expand file tree Collapse file tree 2 files changed +25
-9
lines changed Expand file tree Collapse file tree 2 files changed +25
-9
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ namespace ReactiveUI . XamForms
4+ {
5+ public class DisableAnimationAttribute : Attribute
6+ {
7+ }
8+ }
Original file line number Diff line number Diff line change 33// See the LICENSE file in the project root for more information.
44
55using System ;
6- using Xamarin . Forms ;
7- using Splat ;
8- using ReactiveUI ;
6+ using System . Reactive ;
97using System . Reactive . Linq ;
108using System . Reactive . Threading . Tasks ;
11- using System . Diagnostics ;
12- using System . Reactive ;
9+ using System . Reflection ;
10+
11+ using Xamarin . Forms ;
12+
13+ using Splat ;
1314
1415namespace ReactiveUI . XamForms
1516{
@@ -86,19 +87,26 @@ public RoutedViewHost()
8687
8788 d ( this . WhenAnyObservable ( x => x . Router . Navigate )
8889 . SelectMany ( _ => PageForViewModel ( Router . GetCurrentViewModel ( ) ) )
89- . SelectMany ( async x => {
90+ . SelectMany ( async page => {
9091 if ( popToRootPending && this . Navigation . NavigationStack . Count > 0 )
9192 {
92- this . Navigation . InsertPageBefore ( x , this . Navigation . NavigationStack [ 0 ] ) ;
93+ this . Navigation . InsertPageBefore ( page , this . Navigation . NavigationStack [ 0 ] ) ;
9394 await this . PopToRootAsync ( ) ;
9495 }
9596 else
9697 {
97- await this . PushAsync ( x ) ;
98+ bool animated = true ;
99+ var attribute = page . GetType ( ) . GetCustomAttribute < DisableAnimationAttribute > ( ) ;
100+ if ( attribute != null )
101+ {
102+ animated = false ;
103+ }
104+
105+ await this . PushAsync ( page , animated ) ;
98106 }
99107
100108 popToRootPending = false ;
101- return x ;
109+ return page ;
102110 } )
103111 . Subscribe ( ) ) ;
104112
You can’t perform that action at this time.
0 commit comments