{"action":"created","issue":{"url":"https://api.github.com/repos/luberda-molinet/FFImageLoading/issues/606","repository_url":"https://api.github.com/repos/luberda-molinet/FFImageLoading","labels_url":"https://api.github.com/repos/luberda-molinet/FFImageLoading/issues/606/labels{/name}","comments_url":"https://api.github.com/repos/luberda-molinet/FFImageLoading/issues/606/comments","events_url":"https://api.github.com/repos/luberda-molinet/FFImageLoading/issues/606/events","html_url":"https://github.com/luberda-molinet/FFImageLoading/issues/606","id":229122467,"number":606,"title":"[Xamarin.Forms] CachedImage not loading on first viewing of page, but showing on second","user":{"login":"renzska","id":13021263,"avatar_url":"https://avatars2.githubusercontent.com/u/13021263?v=4","gravatar_id":"","url":"https://api.github.com/users/renzska","html_url":"https://github.com/renzska","followers_url":"https://api.github.com/users/renzska/followers","following_url":"https://api.github.com/users/renzska/following{/other_user}","gists_url":"https://api.github.com/users/renzska/gists{/gist_id}","starred_url":"https://api.github.com/users/renzska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renzska/subscriptions","organizations_url":"https://api.github.com/users/renzska/orgs","repos_url":"https://api.github.com/users/renzska/repos","events_url":"https://api.github.com/users/renzska/events{/privacy}","received_events_url":"https://api.github.com/users/renzska/received_events","type":"User","site_admin":false},"labels":[{"id":308672687,"url":"https://api.github.com/repos/luberda-molinet/FFImageLoading/labels/Xamarin.Forms","name":"Xamarin.Forms","color":"207de5","default":false},{"id":166094357,"url":"https://api.github.com/repos/luberda-molinet/FFImageLoading/labels/invalid","name":"invalid","color":"e6e6e6","default":true},{"id":166094358,"url":"https://api.github.com/repos/luberda-molinet/FFImageLoading/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2017-05-16T18:11:56Z","updated_at":"2018-03-22T18:56:59Z","closed_at":"2017-06-05T23:17:15Z","author_association":"NONE","body":"I have a Xamarin.Forms app that has a header in a rather complex grid layout. When the page is loaded the first time, it does not show the header. If I go back and the reload the page, the header now shows and every time after that it shows. I'm using FFImageLoading 2.2.9. I'm using Xamarin.Forms 2.3.4.231. Any ideas why this might be occurring?\r\n\r\n```\r\n<ffimageloading:CachedImage Grid.Row=\"1\"\r\n            HorizontalOptions=\"FillAndExpand\"\r\n            VerticalOptions=\"FillAndExpand\"\r\n            DownsampleToViewSize=\"true\"\r\n            Source=\"header.png\" />\r\n```"},"comment":{"url":"https://api.github.com/repos/luberda-molinet/FFImageLoading/issues/comments/375420423","html_url":"https://github.com/luberda-molinet/FFImageLoading/issues/606#issuecomment-375420423","issue_url":"https://api.github.com/repos/luberda-molinet/FFImageLoading/issues/606","id":375420423,"user":{"login":"walkerj77","id":24661227,"avatar_url":"https://avatars0.githubusercontent.com/u/24661227?v=4","gravatar_id":"","url":"https://api.github.com/users/walkerj77","html_url":"https://github.com/walkerj77","followers_url":"https://api.github.com/users/walkerj77/followers","following_url":"https://api.github.com/users/walkerj77/following{/other_user}","gists_url":"https://api.github.com/users/walkerj77/gists{/gist_id}","starred_url":"https://api.github.com/users/walkerj77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/walkerj77/subscriptions","organizations_url":"https://api.github.com/users/walkerj77/orgs","repos_url":"https://api.github.com/users/walkerj77/repos","events_url":"https://api.github.com/users/walkerj77/events{/privacy}","received_events_url":"https://api.github.com/users/walkerj77/received_events","type":"User","site_admin":false},"created_at":"2018-03-22T18:56:59Z","updated_at":"2018-03-22T18:56:59Z","author_association":"NONE","body":"I was running into the same issue. My UIImageViews are created dynamically in ViewDidLoad() and get their images set via LoadUrl().Into(). The first time the view controller loaded, the images would not be displayed, even though the Success and Finished events were triggered. However, if I triggered the image load through a user action (e.g. a button press), or if I closed the view controller and reopened it, the images would immediately be visible.\r\n\r\nMy fix for this was to call SetNeedsLayout on the image view in the Success event like this:\r\n```\r\nvar imageView = new UIImageView(new CGRect(0, 0, 30, 30));\r\nImageService.Instance\r\n    .LoadUrl(imageUrl)\r\n    .Success(() => {\r\n        InvokeOnMainThread(() => {\r\n            imageView.SetNeedsDisplay();\r\n        });\r\n    })\r\n    .Into(imageView);\r\n```\r\n\r\nDaniel, I'm not very familiar with the FFImageLoading source code, but maybe the call to SetNeedsDisplay can be added before the Success callback is invoked, so that the image is always loaded the first time?"}}
{"actor":{"display_login":"walkerj77"}}