{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/4175","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/4175/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/4175/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/4175/events","html_url":"https://github.com/facebook/react-native/issues/4175","id":117343029,"number":4175,"title":"[iOS] Clear image in `RCTImageView` causes lagging","user":{"login":"leafduo","id":28619,"avatar_url":"https://avatars.githubusercontent.com/u/28619?v=3","gravatar_id":"","url":"https://api.github.com/users/leafduo","html_url":"https://github.com/leafduo","followers_url":"https://api.github.com/users/leafduo/followers","following_url":"https://api.github.com/users/leafduo/following{/other_user}","gists_url":"https://api.github.com/users/leafduo/gists{/gist_id}","starred_url":"https://api.github.com/users/leafduo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leafduo/subscriptions","organizations_url":"https://api.github.com/users/leafduo/orgs","repos_url":"https://api.github.com/users/leafduo/repos","events_url":"https://api.github.com/users/leafduo/events{/privacy}","received_events_url":"https://api.github.com/users/leafduo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"nicklockwood","id":546885,"avatar_url":"https://avatars.githubusercontent.com/u/546885?v=3","gravatar_id":"","url":"https://api.github.com/users/nicklockwood","html_url":"https://github.com/nicklockwood","followers_url":"https://api.github.com/users/nicklockwood/followers","following_url":"https://api.github.com/users/nicklockwood/following{/other_user}","gists_url":"https://api.github.com/users/nicklockwood/gists{/gist_id}","starred_url":"https://api.github.com/users/nicklockwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicklockwood/subscriptions","organizations_url":"https://api.github.com/users/nicklockwood/orgs","repos_url":"https://api.github.com/users/nicklockwood/repos","events_url":"https://api.github.com/users/nicklockwood/events{/privacy}","received_events_url":"https://api.github.com/users/nicklockwood/received_events","type":"User","site_admin":false},"assignees":[],"milestone":null,"comments":3,"created_at":"2015-11-17T12:18:30Z","updated_at":"2016-08-24T12:36:11Z","closed_at":null,"body":"We mix React Native and native code in our iOS app, and we run into a problem when using `RCTImageView`.\r\n\r\nSteps to reproduce:\r\n\r\n1. Put a `RCTRootView` in view controller A, inside the root view, we have a `<Image>` and a `<Text>` component.\r\n2. Schedule some heavy work on main thread in `-viewWillAppear:`. (In the demo, we put a `sleep(1)`)\r\n3. Push to another view controller\r\n4. Pop to view controller A\r\n\r\nResult: The image doesn't show immediately after the pop finishing, while the text shows instantly.\r\nExpected behavior: The image and text should both show immediately after the pop.\r\n\r\nWe made a demo of the bug: https://github.com/leafduo/RCTImageView-lagging-bug\r\n\r\n![untitled](https://cloud.githubusercontent.com/assets/28619/11211114/16159c2e-8d68-11e5-91f5-3d033fe59789.gif)\r\n\r\nAfter reading part of the source code of `RCTImageView`, we found out that `clearImage` actually cause the problem. It set `image` property to `nil`, and `reloadImage` doesn't finish loading the image again until our heavy work finished.\r\n\r\n```\r\n- (void)clearImage\r\n{\r\n  [self cancelImageLoad];\r\n  [self.layer removeAnimationForKey:@\"contents\"];\r\n  self.image = nil;\r\n}\r\n```\r\n\r\nDeleting `self.image = nil` solves the bug.\r\n\r\nThis behavior was first introduced in commit https://github.com/facebook/react-native/commit/98ab7581a560c8db4f9637bc5de14f273f599d27. I haven't fully understand the purpose of the commit. If it's made for improving the performance of `ListView`, maybe we should do some work in `ListView`, because improving the performance of a component that can be used inside `ListView` doesn't solve the problem of `ListView` itself."},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/242047006","html_url":"https://github.com/facebook/react-native/issues/4175#issuecomment-242047006","issue_url":"https://api.github.com/repos/facebook/react-native/issues/4175","id":242047006,"user":{"login":"juanpujol","id":30832,"avatar_url":"https://avatars.githubusercontent.com/u/30832?v=3","gravatar_id":"","url":"https://api.github.com/users/juanpujol","html_url":"https://github.com/juanpujol","followers_url":"https://api.github.com/users/juanpujol/followers","following_url":"https://api.github.com/users/juanpujol/following{/other_user}","gists_url":"https://api.github.com/users/juanpujol/gists{/gist_id}","starred_url":"https://api.github.com/users/juanpujol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanpujol/subscriptions","organizations_url":"https://api.github.com/users/juanpujol/orgs","repos_url":"https://api.github.com/users/juanpujol/repos","events_url":"https://api.github.com/users/juanpujol/events{/privacy}","received_events_url":"https://api.github.com/users/juanpujol/received_events","type":"User","site_admin":false},"created_at":"2016-08-24T12:36:11Z","updated_at":"2016-08-24T12:36:11Z","body":"Is there any news on this? Thank you."}}
{"actor":{"display_login":"juanpujol"}}