App hangs and crashes when continuous swiping is done.
Closed this issue · 5 comments
When expand-collapse cycle is repeated continuously, application hangs and shows ANR dialog. Even on clicking wait of ANR, the app stays unresponsive and the only option is to kill the app.
Phone: Google Pixel 2
OS: Android 10
Thanks for reporting this!
Is it the sample app or your own app? If it is your own app can you share the property values that you use for CoordinatorLayout?
Sure @mariusmuntean, I've uploaded a video on youtube that demonstrates this issue.
The app hangs at around 27s into that video, shows ANR after a while, and then crashes.
And here below is the complete xaml of my view:
<ContentView.Content>
<Grid RowDefinitions="42,80,*" RowSpacing="0">
<controls:AppHeader/>
<button:SfButton Grid.Row="1" Text="{Binding NextAction}"
BackgroundColor="#483D8B"
CornerRadius="50"
Padding="12"
Margin="0,8"
WidthRequest="250"
Command="{Binding PlaceOrderCommand}"
Style="{StaticResource FooterButtonStyle}"/>
<xamarinForms:CoordinatorLayout Grid.Row="2" x:Name="_coordinatorLayout"
Grid.Column="0"
InitialExpansionState="Expanded"
ExpansionEventHandler="_coordinatorLayout_ExpansionEventHandler"
ProportionalTopViewHeightMax="0.33"
ProportionalTopViewHeightMin="0.1"
ProportionalSnapHeight="0.3"
ShouldSnap="true"
ShouldKineticScroll="true"
ShouldExpandFromKineticScroll="true"
AutohideActionView="true">
<!-- The TopView expands and collapses -->
<xamarinForms:CoordinatorLayout.TopView>
<Grid>
<BoxView x:Name="_boxView"
Color="DodgerBlue"
Margin="5"
Opacity="0.5" />
<Label Grid.Row="0" Text="{Binding CurrentOrder.OrderTotal,StringFormat='Order Total Rs. {0}'}" HorizontalOptions="StartAndExpand" FontSize="Large" Style="{StaticResource LabelStyle}"/>
<Label Grid.Row="1" Text="{Binding CurrentOrder.OrderNo,StringFormat='Order No. {0}'}" HorizontalOptions="StartAndExpand" FontSize="Large" Style="{StaticResource LabelStyle}"/>
</Grid>
</xamarinForms:CoordinatorLayout.TopView>
<!-- The BottomView is shown below the TopView and might scroll if its content doesn't fit into the available space -->
<xamarinForms:CoordinatorLayout.BottomView>
<StackLayout Padding="0" Spacing="0" Margin="0">
<controls:BusyIndicator />
<controls:MessagePopup />
<StackLayout Padding="16,0">
<StackLayout Orientation="Horizontal" Padding="0" Margin="0" Spacing="0">
<button:SfButton Text="{Binding NextAction}"
BackgroundColor="#483D8B"
CornerRadius="50,0,0,50"
Padding="12"
Margin="0,8"
WidthRequest="250"
Command="{Binding PlaceOrderCommand}"
Style="{StaticResource FooterButtonStyle}"/>
<Button Text="CANCEL"
BackgroundColor="#DC3545"
CornerRadius="0,50,50,0"
Padding="4"
Margin="0,8"
WidthRequest="40"
Style="{StaticResource FooterButtonStyle}"
HorizontalOptions="FillAndExpand"/>
</StackLayout>
<Label Text="Your Order Status" HorizontalOptions="StartAndExpand" FontSize="Large" Margin="0,32,0,8" Style="{StaticResource LabelStyle}"/>
<Frame Padding="0" BorderColor="Transparent" BackgroundColor="Transparent" CornerRadius="24">
<Image Source="Step1" Margin="0" x:Name="Img"
Aspect="Fill" HorizontalOptions="Fill" HeightRequest="200">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</Image.GestureRecognizers>
</Image>
</Frame>
<Button Text="MAKE PAYMENT"
BackgroundColor="#483D8B"
CornerRadius="50"
Padding="12"
Margin="24"
Style="{StaticResource FooterButtonStyle}"
HorizontalOptions="FillAndExpand"
/>
<StackLayout Orientation="Horizontal"
Padding="0"
Spacing="0"
BackgroundColor="Transparent"
VerticalOptions="EndAndExpand"
Margin="0,4">
<Button Margin="0"
Padding="6"
TextColor="#483D8B"
CornerRadius="50,0,0,50"
IsVisible="{Binding PrevButtonVisibility}"
Text="BACK" Command="{Binding BackCommand}"
Style="{StaticResource FooterButtonStyle}"
BackgroundColor="White"
HorizontalOptions="FillAndExpand"
HorizontalTextAlignment="Center">
</Button>
<Button IsVisible="{Binding NextButtonVisibility}"
Style="{StaticResource FooterButtonStyle}"
Text="ADD"
BackgroundColor="#483D8B"
CornerRadius="0,50,50,0"
Padding="4"
Margin="0"
HorizontalOptions="FillAndExpand"
Command="{Binding AddFoodToOrderCommand}" >
</Button>
</StackLayout>
</StackLayout>
</StackLayout>
</xamarinForms:CoordinatorLayout.BottomView>
<!-- The ActionView is shown right between the TopView and BottomView. It usually contains views that trigger actions -->
<!--<xamarinForms:CoordinatorLayout.ActionView>
<Button
Text="Hi"
TextColor="Color.Goldenrod"
FontSize="18"
BorderColor="Color.Goldenrod"
BorderWidth="2.0"
HeightRequest="50"
WidthRequest="50"
CornerRadius="25"
BackgroundColor="Color.White"
HorizontalOptions="End"
VerticalOptions="Center"
Margin="15" />
</xamarinForms:CoordinatorLayout.ActionView>-->
</xamarinForms:CoordinatorLayout>
</Grid>
</ContentView.Content>
Thanks for the video; I could reproduce it with the "Blinkist" sample app, but only on Android.
I've got some time now and I'll investigate it.
@MrClan I found the issue and fixed it. The new version should already be available on NuGet.
Please let me know if it works for you.
Thanks a lot for this quick fix, @mariusmuntean, I've already upgraded the package in my project, and I'm unable to replicate the issue as of yet. So looks like the issue has been resolved. I will update you if I encounter this issue again as I test it on other devices too.