This may be a dumb question, but is there not a way to have CachedImage fill the width and have the height be whatever it needs to be in respect of the width? This is how the Image tag works in Xamarin.Forms, but it doesn't work properly for CachedImage.
I agree. This is a serious issue. And actually its just the height. If there is no heightrequest the image does not show.
Yeah i'd love for this to work properly, even if it's just an option that you can turn on. Since I doubt this is built in, does anyone know a good workaround for now short of ditching FFImageLoading completely and using a regular Image tag?
I'm having the same problem in the last version.
Okay I'm not having this problem in iOS, but in Android the images doens't appears, I thought it was this problem but I have corrected in MainActivity using this: CachedImageRenderer.Init(enableFastRenderer: true);
CachedImage.FixedAndroidMotionEventHandler = true;
You can see the explanation in the release notes of the last version.
Just as @CarLoOSX said - it's a thing we need to change in an upcoming major release. It's mentioned in every FFImageLoading release notes.
FFImageLoading has a regression since 2.2.4 which caused CachedImage to always fill entire space available (different behaviour than Image. It's now fixed, but as it was included in many versions it may be a breaking change for some. That's why I didn't enable that fix by default. You can do it manually with:
CachedImage.FixedOnMeasureBehavior = true;
Read more here: #545Also for Xamarin.Forms >= 2.4 please set: CachedImage.FixedAndroidMotionEventHandler = true if experiencing any gesture recognizers problems on Android.
I'll include it as a default in next major version.
Xamarin.Forms (Android) now uses fast renderers by default if possible (correct XF version). You can enable / disable fast renderers by CachedImageRenderer.Init(enableFastRenderer: [true/false] override.
@CarLoOSX @daniel-luberda I'm not sure you guys understand the issue i'm talking about. If I don't set a Width or Height of an image, it should fill the width and the height should be whatever the image needs to fit the width. Right now even with the options on/off that you said the images appear, but are tiny.
@OpticNectar Could you share your code which works with Image? You must also set correct LayoutOptions
@daniel-luberda Here is one of the examples that works properly with Image, but not with ffimageloading:CachedImage on Android:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Image
HorizontalOptions="FillAndExpand"
VerticalOptions="Start"
Source="{ Binding image }"
Grid.Row="0" />
<StackLayout Padding="10, 10, 10, 10" Grid.Row="1" VerticalOptions="Center">
<Label Text="{ Binding title }" Style="{ StaticResource TitleStyle }" />
<Label Text="{ Binding subtitle }" Style="{ StaticResource SubtitleStyle }" />
</StackLayout>
<Label Text="{ Binding number }" Style="{ StaticResource NumberStyle }" Grid.Row="2" />
</Grid>
Did you set CachedImage.FixedOnMeasureBehavior = true; at app startup? Then removed bin/obj folders and cleaned your solution?
I just tried turning enableFastRenderer to false and that seemed to make them all work for some reason.
Could you check if it's solved in 2.2.25 and fast renderer enabled?
@daniel-luberda Yeah i'll give it a test tomorrow.
@daniel-luberda Yeah it seems to work now.
@daniel-luberda I am trying to use
@KunalKshatriya I'll need some more info to help you. Please create a separate issue with some details.
See this: https://github.com/luberda-molinet/FFImageLoading/issues/830 - there's a workaround mentioned there too.
Note: Using IsClippedToBounds="true" on a nested StackLayout in the demo project resolves the problem, but this was not required before XF 2.3.5 and don't want to assume this is a fix (may be a workaround).
I'm having this issue again btw.
It's Xamarin.Forms issue with fast renderers: https://bugzilla.xamarin.com/show_bug.cgi?id=58048
Hopefully they fix it soon
Most helpful comment
Just as @CarLoOSX said - it's a thing we need to change in an upcoming major release. It's mentioned in every FFImageLoading release notes.