Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] ImageButton.Aspect Property is always Fill on iOS after update to Xamarin.Forms 4.4.0.991265 #9054

Closed
Soushi-Atsumi opened this issue Dec 31, 2019 · 32 comments
Labels
a/imagebutton e/2 🕑 2 i/regression in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 p/UWP t/bug 🐛
Milestone

Comments

@Soushi-Atsumi
Copy link

Description

After update to Xamarin.Forms 4.4.0.991265, ImageButton.Aspect Property is always Fill on iOS even if it is set to AspectFit. It worked correctly before I updated to 4.4.0.991265 from 4.3.0.991250. This issue does not occur on Android.

Steps to Reproduce

  1. Create a Page and place a StackLayout which contains some ImageButton.
  2. Set ImageButton.Aspect to AspectFit, or leave it blank (the default value is AspectFit).
  3. Set ImageButton.HorizontalOptions and ImageButton.VerticalOptions to FillAndExpand.
  4. Set ImageButton.Source to any ImageSource.
  5. Run on iOS.

Expected Behavior

Images of ImageButton displays as AspectFit.

Actual Behavior

Images of ImageButton displays as Fill. See Screenshots.

Basic Information

  • Version with issue: 4.4.0.991265
  • Last known good version: 4.3.0.991250
  • IDE: Microsoft Visual Studio Community 2019 Version 16.4.2
  • Platform Target Frameworks:
    • iOS: Default (Perhaps 13.2)
    • Android: Android 10.0 (API Level 29 - Q)
    • UWP: I have not tried
  • Affected Devices: iOS

Screenshots

These screenshots were taken on iPhone 4S - iOS 9.3.6.

Xamarin.Forms 4.4.0.991265 Xamarin.Forms 4.3.0.991250
image-1 image-2

Reproduction Link

https://gist.github.com/Soushi-Atsumi/0e79c20574f517008f83c1bf1f3aa8f6

@Soushi-Atsumi Soushi-Atsumi added s/unverified New report that has yet to be verified t/bug 🐛 labels Dec 31, 2019
@samhouts samhouts added this to the 4.4.0 milestone Dec 31, 2019
@samhouts samhouts added e/2 🕑 2 and removed s/unverified New report that has yet to be verified labels Jan 1, 2020
@samhouts
Copy link
Member

samhouts commented Jan 1, 2020

Issue9054.zip

@vtserej
Copy link

vtserej commented Jan 3, 2020

same here. Please fix it

@velocitysystems
Copy link
Contributor

@samhouts This is also the same on UWP too. Shall I create another ticket?

@samhouts samhouts added the p/UWP label Jan 17, 2020
@samhouts
Copy link
Member

@velocitysystems Thanks for the confirmation! We'll just put the UWP label on here. :)

@Nefiv
Copy link

Nefiv commented Jan 27, 2020

Image works as a workaround, but it's silly to have this bug for such a long time...

@fatderda
Copy link

same here.

@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Feb 21, 2020
@Tommigun1980
Copy link

Any chance this could get fixed? It is really really hard to make apps with Xamarin and to take it seriously, as so many of the most primitive controls are broken. So much time is wasted with "what am I doing wrong?", just to find out that it's another regression.
Thanks.

@GioviQ
Copy link

GioviQ commented Mar 9, 2020

Any chance this could get fixed? It is really really hard to make apps with Xamarin and to take it seriously, as so many of the most primitive controls are broken. So much time is wasted with "what am I doing wrong?", just to find out that it's another regression.
Thanks.

For now it is better to use a ContentButton like https://gist.github.com/GioviQ/1e73bc6f9df6ddf8f4e52d4ea5c8bac6

@BoutemineOualid
Copy link

Any chance this could get fixed? It is really really hard to make apps with Xamarin and to take it seriously, as so many of the most primitive controls are broken. So much time is wasted with "what am I doing wrong?", just to find out that it's another regression.
Thanks.

For now it is better to use a ContentButton like https://gist.github.com/GioviQ/1e73bc6f9df6ddf8f4e52d4ea5c8bac6

It's not practical to go over all controls and replace them. Is this going to be shipped in vNext and what's the ETA please.

@quentinR0bert
Copy link

quentinR0bert commented Mar 9, 2020

If you look the tree you will see that the fix (#9662) was merged today into forms 4.4.0. So it will be shipped in the next Service Release of 4.4.

@eekamouse
Copy link

Posting here to mention the same and follow along. This is preventing us from upgrading to 4.5.... which we need to upgrade to eventually given that Apple will stop allowing app submissions prior to 4.5 (because of the UIWebView issue). Do we know if this will get merged into 4.5?

@BoutemineOualid
Copy link

+1, we definitely need this to be shipped as part of v4.5.

@vtserej
Copy link

vtserej commented Mar 9, 2020

<ContentView Grid.Column="0" Grid.Row="1"> <Button Style="{StaticResource buttonStyle}" Command="{Binding SearchCommand}" /> </ContentView> <StackLayout Margin="25,0,0,0" InputTransparent="True" VerticalOptions="Center" Spacing="15" Orientation="Horizontal" Grid.Column="0" Grid.Row="1"> <Image WidthRequest="38" Source="search_button.png"></Image> <Label Style="{StaticResource textWhite18}" Text="{local:TranslateExtension search}"></Label> </StackLayout>

I would recommend switching for more reliable controls. This is what I used: a label and image and a button all 3 in the same grid/row position

@PureWeen
Copy link
Contributor

PureWeen commented Mar 9, 2020

#9662

@kgouraw
Copy link

kgouraw commented Mar 10, 2020

#9119 (comment)

@BoutemineOualid
Copy link

Any ETA for the upcoming service release?

@davecalkins
Copy link

Seeing this problem in Xamarin.Forms v4.5.0.356. Tried older versions and what I saw was the following.

4.4.0.991265 - DOES NOT WORK, IMAGE STRETCHED
4.3.0.991250 - WORKS CORRECTLY

So, as of v4.5.0.356 this was still not fixed.

@BoutemineOualid
Copy link

Seeing this problem in Xamarin.Forms v4.5.0.356. Tried older versions and what I saw was the following.

4.4.0.991265 - DOES NOT WORK, IMAGE STRETCHED
4.3.0.991250 - WORKS CORRECTLY

So, as of v4.5.0.356 this was still not fixed.

The fix has not been released yet. We are waiting for the next service release.

@davecalkins
Copy link

Seeing this problem in Xamarin.Forms v4.5.0.356. Tried older versions and what I saw was the following.
4.4.0.991265 - DOES NOT WORK, IMAGE STRETCHED
4.3.0.991250 - WORKS CORRECTLY
So, as of v4.5.0.356 this was still not fixed.

The fix has not been released yet. We are waiting for the next service release.

Not sure how the release cycle works, but I just tested v4.6.0.379-pre1 and the issue appears to still be present there.

@BoutemineOualid
Copy link

Seeing this problem in Xamarin.Forms v4.5.0.356. Tried older versions and what I saw was the following.
4.4.0.991265 - DOES NOT WORK, IMAGE STRETCHED
4.3.0.991250 - WORKS CORRECTLY
So, as of v4.5.0.356 this was still not fixed.

The fix has not been released yet. We are waiting for the next service release.

Not sure how the release cycle works, but I just tested v4.6.0.379-pre1 and the issue appears to still be present there.

Same here...

@samhouts
Copy link
Member

closed by #9662. This should be fixed in 4.4.0 sr6, 4.5.0.495 (sr2), and 4.6.0-pre2. Thanks!

@eekamouse
Copy link

eekamouse commented Mar 31, 2020

closed by #9662. This should be fixed in 4.4.0 sr6, 4.5.0.495 (sr2), and 4.6.0-pre2. Thanks!

I verified this is in fact NOT fixed in 4.5.0.495 or the pre-release for 4.6.0. Note the stretched images highlighted in yellow.

image

@PureWeen
Copy link
Contributor

@eekamouse can you attach a repro?

I tested with @samhouts zip here
#9054 (comment)

And I'm able to see the issue and then I update and the issue goes away

@eekamouse
Copy link

eekamouse commented Apr 1, 2020

<NavigationPage.TitleView> <Grid Margin="10" HorizontalOptions="FillAndExpand" AutomationId="HomeGrid" AutomationProperties.IsInAccessibleTree="True"> <Grid.ColumnDefinitions> <ColumnDefinition Width="48"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="48"/> </Grid.ColumnDefinitions> <ImageButton Command="{Binding CancelCommand}" Source="{local:Resource Source='back_icon'}" Style="{StaticResource TitleButton}" AutomationId="Cancel" AutomationProperties.IsInAccessibleTree="True"/> <Label Grid.Column="1" Text="{Binding Title}" Style="{StaticResource TitleLabel}" AutomationId="ProgramPageTitle" AutomationProperties.IsInAccessibleTree="True"> <Label.GestureRecognizers> <TapGestureRecognizer Command="{Binding TitleTappedCommand}"/> </Label.GestureRecognizers> </Label> <ImageButton Grid.Column="2" Command="{Binding BarCodeOpenCommand}" Source="{local:Resource Source='barcode_scan_icon_white'}" Style="{StaticResource ScanButton}"/> </Grid> </NavigationPage.TitleView>

Sorry the above isn't better formatted, but I have multiple examples like that where we have images in a TitleView that are skewed that look fine on UWP and Android... and were working on iOS on Xamarin 4.3.

@bondarenkod
Copy link
Contributor

if you want to fix this bug temporary, you can play with the padding property on the iOS platform.
Padding="0":
image

Padding="15", still not perfect but:
image

Padding="13,15,13,15", finally, very close to the original image:
image

Anyway, we have to use padding to increase the touching zone (for small buttons).

@eekamouse
Copy link

I messed around with padding today and it doesn't seem to do anything but make it worse (and make it look funky on Android and UWP). It might be because our images are in a TitleView.

@kgouraw
Copy link

kgouraw commented Apr 2, 2020

I updated and tested today with XF 4.4.0.991864. It's working fine.

@davecalkins
Copy link

davecalkins commented Apr 7, 2020

I updated and tested today with XF 4.4.0.991864. It's working fine.

I had tested v4.5.0.356 and it did not work in that version.

@kgouraw
Copy link

kgouraw commented Apr 7, 2020

I updated and tested today with XF 4.4.0.991864. It's working fine.

I had tested v4.5.0.356 and it did not work in that version.

Not tested with 4.5, but it's strange. Xamarin must work on the stability of their releases.

@Soushi-Atsumi
Copy link
Author

I have tested v4.5.0.617 and it works fine.

@fatderda
Copy link

I can confirm it works on 4.5.0.617.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/imagebutton e/2 🕑 2 i/regression in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 p/UWP t/bug 🐛
Projects
None yet
Development

No branches or pull requests