{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/3460","labels_url":"https://api.github.com/repos/facebook/react-native/issues/3460/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/3460/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/3460/events","html_url":"https://github.com/facebook/react-native/issues/3460","id":111823393,"number":3460,"title":"[Image] With defaultSource set, it keep showing default image","user":{"login":"zhuzhang","id":4180937,"avatar_url":"https://avatars.githubusercontent.com/u/4180937?v=3","gravatar_id":"","url":"https://api.github.com/users/zhuzhang","html_url":"https://github.com/zhuzhang","followers_url":"https://api.github.com/users/zhuzhang/followers","following_url":"https://api.github.com/users/zhuzhang/following{/other_user}","gists_url":"https://api.github.com/users/zhuzhang/gists{/gist_id}","starred_url":"https://api.github.com/users/zhuzhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhuzhang/subscriptions","organizations_url":"https://api.github.com/users/zhuzhang/orgs","repos_url":"https://api.github.com/users/zhuzhang/repos","events_url":"https://api.github.com/users/zhuzhang/events{/privacy}","received_events_url":"https://api.github.com/users/zhuzhang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"jspahrsummers","id":432536,"avatar_url":"https://avatars.githubusercontent.com/u/432536?v=3","gravatar_id":"","url":"https://api.github.com/users/jspahrsummers","html_url":"https://github.com/jspahrsummers","followers_url":"https://api.github.com/users/jspahrsummers/followers","following_url":"https://api.github.com/users/jspahrsummers/following{/other_user}","gists_url":"https://api.github.com/users/jspahrsummers/gists{/gist_id}","starred_url":"https://api.github.com/users/jspahrsummers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jspahrsummers/subscriptions","organizations_url":"https://api.github.com/users/jspahrsummers/orgs","repos_url":"https://api.github.com/users/jspahrsummers/repos","events_url":"https://api.github.com/users/jspahrsummers/events{/privacy}","received_events_url":"https://api.github.com/users/jspahrsummers/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-10-16T12:39:13Z","updated_at":"2015-10-19T09:41:05Z","closed_at":null,"body":"When render *ImageView* on iOS platform like below :\r\n``` xml\r\n<Image\r\n  source={{uri: \"http://example.org/test.jpg\"}}\r\n  defaultSource={require('image!placeholder')} />\r\n```\r\nit would keep showing the placeholder all day long....\r\n\r\nSo I dig source file and find out that it really don't trigger *RCTImageView* to download wanted_image when set frame, related source in file \"RCTImageView.m\" shows as below:\r\n``` objective-c\r\n- (void)reactSetFrame:(CGRect)frame\r\n{\r\n  [super reactSetFrame:frame];\r\n  if (self.image == nil) {\r\n    _targetSize = frame.size;\r\n    [self reloadImage];\r\n  } else if ([RCTImageView srcNeedsReload:_src]) {\r\n    CGSize imageSize = self.image.size;\r\n    CGSize idealSize = RCTTargetSize(imageSize, self.image.scale, frame.size, RCTScreenScale(), self.contentMode, YES);\r\n\r\n    if (RCTShouldReloadImageForSizeChange(imageSize, idealSize)) {\r\n      if (RCTShouldReloadImageForSizeChange(_targetSize, idealSize)) {\r\n        RCTLogInfo(@\"[PERF IMAGEVIEW] Reloading image %@ as size %@\", _src, NSStringFromCGSize(idealSize));\r\n\r\n        // If the existing image or an image being loaded are not the right size, reload the asset in case there is a\r\n        // better size available.\r\n        _targetSize = idealSize;\r\n        [self reloadImage];\r\n      }\r\n    } else {\r\n      // Our existing image is good enough.\r\n      [self cancelImageLoad];\r\n      _targetSize = imageSize;\r\n    }\r\n  }\r\n}\r\n```\r\nThe problem is that it *reloadImage* when \r\n``` objective-c\r\nRCTShouldReloadImageForSizeChange(imageSize, idealSize) &&\r\nRCTShouldReloadImageForSizeChange(_targetSize, idealSize)\r\n```\r\n and it should be\r\n``` objective-c\r\nRCTShouldReloadImageForSizeChange(_targetSize, idealSize) ||\r\nRCTShouldReloadImageForSizeChange(imageSize, idealSize)\r\n```\r\n\r\nThis is tested with version '0.13.0-rc', not tested on master yet. but it should have same result because of  the same source code related. "},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/149164414","html_url":"https://github.com/facebook/react-native/issues/3460#issuecomment-149164414","issue_url":"https://api.github.com/repos/facebook/react-native/issues/3460","id":149164414,"user":{"login":"jspahrsummers","id":432536,"avatar_url":"https://avatars.githubusercontent.com/u/432536?v=3","gravatar_id":"","url":"https://api.github.com/users/jspahrsummers","html_url":"https://github.com/jspahrsummers","followers_url":"https://api.github.com/users/jspahrsummers/followers","following_url":"https://api.github.com/users/jspahrsummers/following{/other_user}","gists_url":"https://api.github.com/users/jspahrsummers/gists{/gist_id}","starred_url":"https://api.github.com/users/jspahrsummers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jspahrsummers/subscriptions","organizations_url":"https://api.github.com/users/jspahrsummers/orgs","repos_url":"https://api.github.com/users/jspahrsummers/repos","events_url":"https://api.github.com/users/jspahrsummers/events{/privacy}","received_events_url":"https://api.github.com/users/jspahrsummers/received_events","type":"User","site_admin":false},"created_at":"2015-10-19T09:41:05Z","updated_at":"2015-10-19T09:41:05Z","body":"The reason this check uses `&&` is to avoid overeager reloading of the image when the current size is already good, or the desired size change is in-flight (which is why we set `_targetSize` before loading).\r\n\r\n@javache @nicklockwood I understand why this is a bug, but what's the expected logic for loading `source` over `defaultSource`? Why does it depend on the frame size at all?"}}