{"action":"created","comment":{"url":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls/comments/66926155","id":66926155,"diff_hunk":"@@ -188,58 +203,125 @@ protected override Border CreateViewInstance(ThemedReactContext reactContext)\n         {\n             return new Border\n             {\n-                Background = new ImageBrush(),\n+                Background = new ImageBrush\n+                {\n+                    Stretch = Stretch.UniformToFill,\n+                },\n             };\n         }\n \n-        /// <summary>\n-        /// Install custom event emitters on the given view.\n-        /// </summary>\n-        /// <param name=\"reactContext\">The React context.</param>\n-        /// <param name=\"view\">The view instance.</param>\n-        protected override void AddEventEmitters(ThemedReactContext reactContext, Border view)\n+        internal void ImageLoaded(object data, bool loaded, string source)\n         {\n-            var imageBrush = (ImageBrush)view.Background;\n+            var view = ((Tuple<Border, Color?, Color?>)data).Item1;\n+            var tintColor = ((Tuple<Border, Color?, Color?>)data).Item2;\n+            var backgroundColor = ((Tuple<Border, Color?, Color?>)data).Item3;\n+            var loader = view.GetReactContext().GetNativeModule<ImageLoaderModule>();\n \n-            var imageFailedHandler = new ExceptionRoutedEventHandler(\n-                (sender, args) => OnImageFailed(view, args));\n+            view.GetReactContext().GetNativeModule<UIManagerModule>().\n+                EventDispatcher.DispatchEvent(\n+                    new ReactImageLoadEvent(view.GetTag(),\n+                                            ReactImageLoadEvent.OnLoadEnd));\n \n-            imageBrush.ImageFailed += imageFailedHandler;\n+            if (loaded)\n+            {\n+                var image = loader.GetImage(source);\n \n-            var imageOpenedHandler = new RoutedEventHandler(\n-                (sender, args) => OnImageOpened(view, args));\n+                if (tintColor != null || backgroundColor != null)\n+                {\n+                    SetColors(view, image, source, tintColor, backgroundColor);\n+                }\n+                else\n+                {\n+                    ((ImageBrush)view.Background).ImageSource = image;\n+                    loader.FreeReference(source);\n+                }\n+            }\n+        }\n \n-            imageBrush.ImageOpened += imageOpenedHandler;\n+        internal void DataLoaded(object data, string source)\n+        {\n+            var view = ((Tuple<Border, Color?, Color?>)data).Item1;\n+            var tintColor = ((Tuple<Border, Color?, Color?>)data).Item2;\n+            var backgroundColor = ((Tuple<Border, Color?, Color?>)data).Item3;\n+            var loader = view.GetReactContext().GetNativeModule<ImageLoaderModule>();\n+\n+            var image = loader.GetImage(source);\n+            var pixels = loader.GetPixelData(source);\n \n-            _imageFailedHandlers.Add(view, imageFailedHandler);\n+            SetPixels(view, image, tintColor, backgroundColor, pixels, source);\n         }\n \n-        private void OnImageFailed(Border view, ExceptionRoutedEventArgs args)\n+        private void SetColors(Border view, BitmapImage image, string source, Color? tintColor, Color? backgroundColor)\n         {\n-            view.GetReactContext()\n-                .GetNativeModule<UIManagerModule>()\n-                .EventDispatcher\n-                .DispatchEvent(\n-                    new ReactImageLoadEvent(\n-                        view.GetTag(),\n-                        ReactImageLoadEvent.OnLoadEnd));\n+            var loader = view.GetReactContext().GetNativeModule<ImageLoaderModule>();\n+            var pixelData = loader.GetPixelData(source);\n+\n+            if (pixelData != null)\n+            {\n+                SetPixels(view, image, tintColor, backgroundColor, pixelData, source);\n+            }\n+            else\n+            {\n+                loader.LoadImagePixelData(source, this, Tuple.Create(view, tintColor, backgroundColor));\n+            }\n         }\n \n-        private void OnImageOpened(Border view, RoutedEventArgs args)\n+        private async void SetPixels(","path":"ReactWindows/ReactNative/Views/Image/ReactImageManager.cs","position":231,"original_position":231,"commit_id":"2f13658449fb2bcc57e04e5c2f83414ca02b74a7","original_commit_id":"2f13658449fb2bcc57e04e5c2f83414ca02b74a7","user":{"login":"ebragge","id":7395421,"avatar_url":"https://avatars.githubusercontent.com/u/7395421?v=3","gravatar_id":"","url":"https://api.github.com/users/ebragge","html_url":"https://github.com/ebragge","followers_url":"https://api.github.com/users/ebragge/followers","following_url":"https://api.github.com/users/ebragge/following{/other_user}","gists_url":"https://api.github.com/users/ebragge/gists{/gist_id}","starred_url":"https://api.github.com/users/ebragge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebragge/subscriptions","organizations_url":"https://api.github.com/users/ebragge/orgs","repos_url":"https://api.github.com/users/ebragge/repos","events_url":"https://api.github.com/users/ebragge/events{/privacy}","received_events_url":"https://api.github.com/users/ebragge/received_events","type":"User","site_admin":false},"body":"OK","created_at":"2016-06-14T08:14:58Z","updated_at":"2016-06-14T08:14:58Z","html_url":"https://github.com/ReactWindows/react-native-windows/pull/467#discussion_r66926155","pull_request_url":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls/467","_links":{"self":{"href":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls/comments/66926155"},"html":{"href":"https://github.com/ReactWindows/react-native-windows/pull/467#discussion_r66926155"},"pull_request":{"href":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls/467"}}},"pull_request":{"url":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls/467","id":73394464,"html_url":"https://github.com/ReactWindows/react-native-windows/pull/467","diff_url":"https://github.com/ReactWindows/react-native-windows/pull/467.diff","patch_url":"https://github.com/ReactWindows/react-native-windows/pull/467.patch","issue_url":"https://api.github.com/repos/ReactWindows/react-native-windows/issues/467","number":467,"state":"open","locked":false,"title":"fix(ReactImageView): Add features","user":{"login":"ebragge","id":7395421,"avatar_url":"https://avatars.githubusercontent.com/u/7395421?v=3","gravatar_id":"","url":"https://api.github.com/users/ebragge","html_url":"https://github.com/ebragge","followers_url":"https://api.github.com/users/ebragge/followers","following_url":"https://api.github.com/users/ebragge/following{/other_user}","gists_url":"https://api.github.com/users/ebragge/gists{/gist_id}","starred_url":"https://api.github.com/users/ebragge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebragge/subscriptions","organizations_url":"https://api.github.com/users/ebragge/orgs","repos_url":"https://api.github.com/users/ebragge/repos","events_url":"https://api.github.com/users/ebragge/events{/privacy}","received_events_url":"https://api.github.com/users/ebragge/received_events","type":"User","site_admin":false},"body":"resizeMode\r\ntintColor\r\nbackgroundColor\r\nimageSize\r\n\r\nFixes #278, #366","created_at":"2016-06-10T15:46:51Z","updated_at":"2016-06-14T08:14:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a9e648961b021d3dd94e32e48a55f925fd6ed1f3","assignee":{"login":"ebragge","id":7395421,"avatar_url":"https://avatars.githubusercontent.com/u/7395421?v=3","gravatar_id":"","url":"https://api.github.com/users/ebragge","html_url":"https://github.com/ebragge","followers_url":"https://api.github.com/users/ebragge/followers","following_url":"https://api.github.com/users/ebragge/following{/other_user}","gists_url":"https://api.github.com/users/ebragge/gists{/gist_id}","starred_url":"https://api.github.com/users/ebragge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebragge/subscriptions","organizations_url":"https://api.github.com/users/ebragge/orgs","repos_url":"https://api.github.com/users/ebragge/repos","events_url":"https://api.github.com/users/ebragge/events{/privacy}","received_events_url":"https://api.github.com/users/ebragge/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls/467/commits","review_comments_url":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls/467/comments","review_comment_url":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ReactWindows/react-native-windows/issues/467/comments","statuses_url":"https://api.github.com/repos/ReactWindows/react-native-windows/statuses/2f13658449fb2bcc57e04e5c2f83414ca02b74a7","head":{"label":"ReactWindows:Issue-278","ref":"Issue-278","sha":"2f13658449fb2bcc57e04e5c2f83414ca02b74a7","user":{"login":"ReactWindows","id":18399765,"avatar_url":"https://avatars.githubusercontent.com/u/18399765?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactWindows","html_url":"https://github.com/ReactWindows","followers_url":"https://api.github.com/users/ReactWindows/followers","following_url":"https://api.github.com/users/ReactWindows/following{/other_user}","gists_url":"https://api.github.com/users/ReactWindows/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactWindows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactWindows/subscriptions","organizations_url":"https://api.github.com/users/ReactWindows/orgs","repos_url":"https://api.github.com/users/ReactWindows/repos","events_url":"https://api.github.com/users/ReactWindows/events{/privacy}","received_events_url":"https://api.github.com/users/ReactWindows/received_events","type":"Organization","site_admin":false},"repo":{"id":48009214,"name":"react-native-windows","full_name":"ReactWindows/react-native-windows","owner":{"login":"ReactWindows","id":18399765,"avatar_url":"https://avatars.githubusercontent.com/u/18399765?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactWindows","html_url":"https://github.com/ReactWindows","followers_url":"https://api.github.com/users/ReactWindows/followers","following_url":"https://api.github.com/users/ReactWindows/following{/other_user}","gists_url":"https://api.github.com/users/ReactWindows/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactWindows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactWindows/subscriptions","organizations_url":"https://api.github.com/users/ReactWindows/orgs","repos_url":"https://api.github.com/users/ReactWindows/repos","events_url":"https://api.github.com/users/ReactWindows/events{/privacy}","received_events_url":"https://api.github.com/users/ReactWindows/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ReactWindows/react-native-windows","description":"A framework for building native apps with React.","fork":false,"url":"https://api.github.com/repos/ReactWindows/react-native-windows","forks_url":"https://api.github.com/repos/ReactWindows/react-native-windows/forks","keys_url":"https://api.github.com/repos/ReactWindows/react-native-windows/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ReactWindows/react-native-windows/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ReactWindows/react-native-windows/teams","hooks_url":"https://api.github.com/repos/ReactWindows/react-native-windows/hooks","issue_events_url":"https://api.github.com/repos/ReactWindows/react-native-windows/issues/events{/number}","events_url":"https://api.github.com/repos/ReactWindows/react-native-windows/events","assignees_url":"https://api.github.com/repos/ReactWindows/react-native-windows/assignees{/user}","branches_url":"https://api.github.com/repos/ReactWindows/react-native-windows/branches{/branch}","tags_url":"https://api.github.com/repos/ReactWindows/react-native-windows/tags","blobs_url":"https://api.github.com/repos/ReactWindows/react-native-windows/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ReactWindows/react-native-windows/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ReactWindows/react-native-windows/git/refs{/sha}","trees_url":"https://api.github.com/repos/ReactWindows/react-native-windows/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ReactWindows/react-native-windows/statuses/{sha}","languages_url":"https://api.github.com/repos/ReactWindows/react-native-windows/languages","stargazers_url":"https://api.github.com/repos/ReactWindows/react-native-windows/stargazers","contributors_url":"https://api.github.com/repos/ReactWindows/react-native-windows/contributors","subscribers_url":"https://api.github.com/repos/ReactWindows/react-native-windows/subscribers","subscription_url":"https://api.github.com/repos/ReactWindows/react-native-windows/subscription","commits_url":"https://api.github.com/repos/ReactWindows/react-native-windows/commits{/sha}","git_commits_url":"https://api.github.com/repos/ReactWindows/react-native-windows/git/commits{/sha}","comments_url":"https://api.github.com/repos/ReactWindows/react-native-windows/comments{/number}","issue_comment_url":"https://api.github.com/repos/ReactWindows/react-native-windows/issues/comments{/number}","contents_url":"https://api.github.com/repos/ReactWindows/react-native-windows/contents/{+path}","compare_url":"https://api.github.com/repos/ReactWindows/react-native-windows/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ReactWindows/react-native-windows/merges","archive_url":"https://api.github.com/repos/ReactWindows/react-native-windows/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ReactWindows/react-native-windows/downloads","issues_url":"https://api.github.com/repos/ReactWindows/react-native-windows/issues{/number}","pulls_url":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls{/number}","milestones_url":"https://api.github.com/repos/ReactWindows/react-native-windows/milestones{/number}","notifications_url":"https://api.github.com/repos/ReactWindows/react-native-windows/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ReactWindows/react-native-windows/labels{/name}","releases_url":"https://api.github.com/repos/ReactWindows/react-native-windows/releases{/id}","deployments_url":"https://api.github.com/repos/ReactWindows/react-native-windows/deployments","created_at":"2015-12-15T00:16:54Z","updated_at":"2016-06-14T06:38:36Z","pushed_at":"2016-06-13T21:29:31Z","git_url":"git://github.com/ReactWindows/react-native-windows.git","ssh_url":"git@github.com:ReactWindows/react-native-windows.git","clone_url":"https://github.com/ReactWindows/react-native-windows.git","svn_url":"https://github.com/ReactWindows/react-native-windows","homepage":"http://facebook.github.io/react-native/","size":142458,"stargazers_count":628,"watchers_count":628,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":58,"forks":40,"open_issues":58,"watchers":628,"default_branch":"master"}},"base":{"label":"ReactWindows:master","ref":"master","sha":"e96de1a26966cf98a3907fcd947b749663b601c6","user":{"login":"ReactWindows","id":18399765,"avatar_url":"https://avatars.githubusercontent.com/u/18399765?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactWindows","html_url":"https://github.com/ReactWindows","followers_url":"https://api.github.com/users/ReactWindows/followers","following_url":"https://api.github.com/users/ReactWindows/following{/other_user}","gists_url":"https://api.github.com/users/ReactWindows/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactWindows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactWindows/subscriptions","organizations_url":"https://api.github.com/users/ReactWindows/orgs","repos_url":"https://api.github.com/users/ReactWindows/repos","events_url":"https://api.github.com/users/ReactWindows/events{/privacy}","received_events_url":"https://api.github.com/users/ReactWindows/received_events","type":"Organization","site_admin":false},"repo":{"id":48009214,"name":"react-native-windows","full_name":"ReactWindows/react-native-windows","owner":{"login":"ReactWindows","id":18399765,"avatar_url":"https://avatars.githubusercontent.com/u/18399765?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactWindows","html_url":"https://github.com/ReactWindows","followers_url":"https://api.github.com/users/ReactWindows/followers","following_url":"https://api.github.com/users/ReactWindows/following{/other_user}","gists_url":"https://api.github.com/users/ReactWindows/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactWindows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactWindows/subscriptions","organizations_url":"https://api.github.com/users/ReactWindows/orgs","repos_url":"https://api.github.com/users/ReactWindows/repos","events_url":"https://api.github.com/users/ReactWindows/events{/privacy}","received_events_url":"https://api.github.com/users/ReactWindows/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ReactWindows/react-native-windows","description":"A framework for building native apps with React.","fork":false,"url":"https://api.github.com/repos/ReactWindows/react-native-windows","forks_url":"https://api.github.com/repos/ReactWindows/react-native-windows/forks","keys_url":"https://api.github.com/repos/ReactWindows/react-native-windows/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ReactWindows/react-native-windows/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ReactWindows/react-native-windows/teams","hooks_url":"https://api.github.com/repos/ReactWindows/react-native-windows/hooks","issue_events_url":"https://api.github.com/repos/ReactWindows/react-native-windows/issues/events{/number}","events_url":"https://api.github.com/repos/ReactWindows/react-native-windows/events","assignees_url":"https://api.github.com/repos/ReactWindows/react-native-windows/assignees{/user}","branches_url":"https://api.github.com/repos/ReactWindows/react-native-windows/branches{/branch}","tags_url":"https://api.github.com/repos/ReactWindows/react-native-windows/tags","blobs_url":"https://api.github.com/repos/ReactWindows/react-native-windows/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ReactWindows/react-native-windows/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ReactWindows/react-native-windows/git/refs{/sha}","trees_url":"https://api.github.com/repos/ReactWindows/react-native-windows/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ReactWindows/react-native-windows/statuses/{sha}","languages_url":"https://api.github.com/repos/ReactWindows/react-native-windows/languages","stargazers_url":"https://api.github.com/repos/ReactWindows/react-native-windows/stargazers","contributors_url":"https://api.github.com/repos/ReactWindows/react-native-windows/contributors","subscribers_url":"https://api.github.com/repos/ReactWindows/react-native-windows/subscribers","subscription_url":"https://api.github.com/repos/ReactWindows/react-native-windows/subscription","commits_url":"https://api.github.com/repos/ReactWindows/react-native-windows/commits{/sha}","git_commits_url":"https://api.github.com/repos/ReactWindows/react-native-windows/git/commits{/sha}","comments_url":"https://api.github.com/repos/ReactWindows/react-native-windows/comments{/number}","issue_comment_url":"https://api.github.com/repos/ReactWindows/react-native-windows/issues/comments{/number}","contents_url":"https://api.github.com/repos/ReactWindows/react-native-windows/contents/{+path}","compare_url":"https://api.github.com/repos/ReactWindows/react-native-windows/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ReactWindows/react-native-windows/merges","archive_url":"https://api.github.com/repos/ReactWindows/react-native-windows/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ReactWindows/react-native-windows/downloads","issues_url":"https://api.github.com/repos/ReactWindows/react-native-windows/issues{/number}","pulls_url":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls{/number}","milestones_url":"https://api.github.com/repos/ReactWindows/react-native-windows/milestones{/number}","notifications_url":"https://api.github.com/repos/ReactWindows/react-native-windows/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ReactWindows/react-native-windows/labels{/name}","releases_url":"https://api.github.com/repos/ReactWindows/react-native-windows/releases{/id}","deployments_url":"https://api.github.com/repos/ReactWindows/react-native-windows/deployments","created_at":"2015-12-15T00:16:54Z","updated_at":"2016-06-14T06:38:36Z","pushed_at":"2016-06-13T21:29:31Z","git_url":"git://github.com/ReactWindows/react-native-windows.git","ssh_url":"git@github.com:ReactWindows/react-native-windows.git","clone_url":"https://github.com/ReactWindows/react-native-windows.git","svn_url":"https://github.com/ReactWindows/react-native-windows","homepage":"http://facebook.github.io/react-native/","size":142458,"stargazers_count":628,"watchers_count":628,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":58,"forks":40,"open_issues":58,"watchers":628,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls/467"},"html":{"href":"https://github.com/ReactWindows/react-native-windows/pull/467"},"issue":{"href":"https://api.github.com/repos/ReactWindows/react-native-windows/issues/467"},"comments":{"href":"https://api.github.com/repos/ReactWindows/react-native-windows/issues/467/comments"},"review_comments":{"href":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls/467/comments"},"review_comment":{"href":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ReactWindows/react-native-windows/pulls/467/commits"},"statuses":{"href":"https://api.github.com/repos/ReactWindows/react-native-windows/statuses/2f13658449fb2bcc57e04e5c2f83414ca02b74a7"}}}}
{"actor":{"display_login":"ebragge"}}