jamesmontemagno / ImageCirclePlugin

Circle Images for your Xamarin.Forms Applications
MIT License
239 stars 68 forks source link

CircleImage in ListView(ListViewCachingStrategy.RecycleElement) CellView #52

Closed paleicikas closed 6 years ago

paleicikas commented 6 years ago

Bug Information

Version Number of Plugin: 2.0.1.0 (latest) Device Tested On: iOS Emulator

Steps to reproduce the Behavior

CircleImage image used in ListView(ListViewCachingStrategy.RecycleElement) CellView

Expected Behavior

One circle around image

Actual Behavior

Two circle around image (only in iOS, Android looks good)

Code snippet

Bug white using ListView(ListViewCachingStrategy.RecycleElement) ViewCell, declaration:

_photo = new CircleImage { BorderThickness = ProfileImageBorder, Aspect = Aspect.AspectFill, IsOpaque = true, WidthRequest = ProfileImageSize, HeightRequest = ProfileImageSize, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start };

Screenshotst

circlebug

jamesmontemagno commented 6 years ago

Is it only in latest version? What about previous. There has been no changes to the iOS version for ever, so would be a regression with Forms itself.

paleicikas commented 6 years ago

Its only with latest version + latest XF version

prashantvc commented 6 years ago

@paleicikas I am not able to reproduce this on iOS 11.2. Is it possible to share a small demonstrating the issue? It will help us to troubleshoot the issue

paleicikas commented 6 years ago

Result (screenshot): https://ibb.co/jvGjRw

var listView = new ListView(ListViewCachingStrategy.RecycleElement)
            {
                ItemsSource = List,
                IsPullToRefreshEnabled = true,
                HasUnevenRows = true,
                SeparatorColor = StyleKit.ListSeparatorColor,
                BackgroundColor = Color.Transparent,
                ItemTemplate = new DataTemplate(() =>
                {
                    return new XCellView();
                })
            };

CellView:

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using ImageCircle.Forms.Plugin.Abstractions;
using Xamarin.Forms;

namespace Common.Models.ListViewCells
{
    public class XCellView : ViewCell
    {
        private static Random rnd = new Random();
        private readonly CircleImage _photo;

        public XCellView()
        {
            _photo = new CircleImage
            {
                BorderThickness = 5,
                Aspect = Aspect.AspectFill,
                IsOpaque = true,
                WidthRequest = 100,
                HeightRequest = 100,
                VerticalOptions = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.Start
            };

            View = _photo;
        }

        protected override void OnBindingContextChanged()
        {
            var colors = new List { 
                Color.Red,
                Color.Green,
                Color.Orange,
                Color.Blue
            };

            _photo.BorderColor = colors[rnd.Next(colors.Count)];

            _photo.Source = new UriImageSource
            {
                Uri = new Uri("https://g2.dcdn.lt/images/pix/430x260/PTr1NMzWRqs/lamelo-ballas-76979493.jpg")
            };

            base.OnBindingContextChanged();
        }
    }
}
benevbright commented 6 years ago

same for me.

I updated to 2.0.1 from 1.8.1 and it came up. I downgraded it to 1.8.1, this bug is gone thanksfully.

Tested Device : iPhone 7 (real device) / iOS 11.2.2 Xamarin.Forms : 2.5.0.122203 (latest)

img_4748