From 12d5f0d6f4ae2aa9359169cd30ae1b26864ac206 Mon Sep 17 00:00:00 2001 From: James Ide Date: Mon, 17 Aug 2015 05:53:42 -0700 Subject: [PATCH] [Views] Change rasterization scale to the main screen's scale Summary: `view.screen` can be nil if the view has not yet been added to the view hierarchy (e.g. new view), so we should use `[UIScreen mainScreen]` instead. In the future, if we need to support multiple screens, one possible fix is to set the rasterization scale in didMoveToWindow/Superview. For now we have just one screen, though. Closes https://github.com/facebook/react-native/pull/2334 Github Author: James Ide --- React/Views/RCTViewManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/React/Views/RCTViewManager.m b/React/Views/RCTViewManager.m index e6feb5ca9..9c7a97483 100644 --- a/React/Views/RCTViewManager.m +++ b/React/Views/RCTViewManager.m @@ -126,7 +126,7 @@ RCT_REMAP_VIEW_PROPERTY(overflow, clipsToBounds, css_clip_t) RCT_CUSTOM_VIEW_PROPERTY(shouldRasterizeIOS, BOOL, RCTView) { view.layer.shouldRasterize = json ? [RCTConvert BOOL:json] : defaultView.layer.shouldRasterize; - view.layer.rasterizationScale = view.layer.shouldRasterize ? view.window.screen.scale : defaultView.layer.rasterizationScale; + view.layer.rasterizationScale = view.layer.shouldRasterize ? [UIScreen mainScreen].scale : defaultView.layer.rasterizationScale; } RCT_CUSTOM_VIEW_PROPERTY(transformMatrix, CATransform3D, RCTView) {