File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -225,8 +225,28 @@ var View = React.createClass({
225225 * different parameters. The downside is that this can use up limited video
226226 * memory, so this prop should be set back to false at the end of the
227227 * interaction/animation.
228+ * @platform android
228229 */
229230 renderToHardwareTextureAndroid : PropTypes . bool ,
231+
232+ /**
233+ * Whether this view should be rendered as a bitmap before compositing.
234+ *
235+ * On iOS, this is useful for animations and interactions that do not
236+ * modify this component's dimensions nor its children; for example, when
237+ * translating the position of a static view, rasterization allows the
238+ * renderer to reuse a cached bitmap of a static view and quickly composite
239+ * it during each frame.
240+ *
241+ * Rasterization incurs an off-screen drawing pass and the bitmap consumes
242+ * memory. Test and measure when using this property.
243+ * @platform ios
244+ */
245+ shouldRasterizeIOS : PropTypes . bool ,
246+
247+ /**
248+ * @platform android
249+ */
230250 collapsable : PropTypes . bool ,
231251 } ,
232252
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ ReactNativeViewAttributes.UIView = {
2323 accessibilityLiveRegion : true ,
2424 accessibilityTraits : true ,
2525 testID : true ,
26+ shouldRasterizeIOS : true ,
2627 onLayout : true ,
2728 onAccessibilityTap : true ,
2829 onMagicTap : true ,
Original file line number Diff line number Diff line change @@ -112,6 +112,11 @@ - (RCTViewManagerUIBlock)uiBlockToAmendWithShadowViewRegistry:(__unused RCTSpars
112112RCT_REMAP_VIEW_PROPERTY (shadowOpacity, layer.shadowOpacity, float )
113113RCT_REMAP_VIEW_PROPERTY(shadowRadius, layer.shadowRadius, CGFloat)
114114RCT_REMAP_VIEW_PROPERTY(overflow, clipsToBounds, css_clip_t )
115+ RCT_CUSTOM_VIEW_PROPERTY(shouldRasterizeIOS, BOOL , RCTView)
116+ {
117+ view.layer .shouldRasterize = json ? [RCTConvert BOOL: json] : defaultView.layer .shouldRasterize ;
118+ view.layer .rasterizationScale = view.layer .shouldRasterize ? view.window .screen .scale : defaultView.layer .rasterizationScale ;
119+ }
115120RCT_CUSTOM_VIEW_PROPERTY (transformMatrix, CATransform3D, RCTView)
116121{
117122 view.layer .transform = json ? [RCTConvert CATransform3D: json] : defaultView.layer .transform ;
You can’t perform that action at this time.
0 commit comments