[RFC][Rendering] Add shouldRasterizeIOS to View components
Summary: Exposes the `shouldRasterize` property. Fixes #1986. Closes https://github.com/facebook/react-native/pull/2226 Github Author: James Ide <ide@jameside.com>
This commit is contained in:
parent
d8f43105ed
commit
d4eac3ddca
|
@ -225,8 +225,28 @@ var View = React.createClass({
|
||||||
* different parameters. The downside is that this can use up limited video
|
* different parameters. The downside is that this can use up limited video
|
||||||
* memory, so this prop should be set back to false at the end of the
|
* memory, so this prop should be set back to false at the end of the
|
||||||
* interaction/animation.
|
* interaction/animation.
|
||||||
|
* @platform android
|
||||||
*/
|
*/
|
||||||
renderToHardwareTextureAndroid: PropTypes.bool,
|
renderToHardwareTextureAndroid: PropTypes.bool,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this view should be rendered as a bitmap before compositing.
|
||||||
|
*
|
||||||
|
* On iOS, this is useful for animations and interactions that do not
|
||||||
|
* modify this component's dimensions nor its children; for example, when
|
||||||
|
* translating the position of a static view, rasterization allows the
|
||||||
|
* renderer to reuse a cached bitmap of a static view and quickly composite
|
||||||
|
* it during each frame.
|
||||||
|
*
|
||||||
|
* Rasterization incurs an off-screen drawing pass and the bitmap consumes
|
||||||
|
* memory. Test and measure when using this property.
|
||||||
|
* @platform ios
|
||||||
|
*/
|
||||||
|
shouldRasterizeIOS: PropTypes.bool,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @platform android
|
||||||
|
*/
|
||||||
collapsable: PropTypes.bool,
|
collapsable: PropTypes.bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ ReactNativeViewAttributes.UIView = {
|
||||||
accessibilityLiveRegion: true,
|
accessibilityLiveRegion: true,
|
||||||
accessibilityTraits: true,
|
accessibilityTraits: true,
|
||||||
testID: true,
|
testID: true,
|
||||||
|
shouldRasterizeIOS: true,
|
||||||
onLayout: true,
|
onLayout: true,
|
||||||
onAccessibilityTap: true,
|
onAccessibilityTap: true,
|
||||||
onMagicTap: true,
|
onMagicTap: true,
|
||||||
|
|
|
@ -112,6 +112,11 @@ RCT_REMAP_VIEW_PROPERTY(shadowOffset, layer.shadowOffset, CGSize);
|
||||||
RCT_REMAP_VIEW_PROPERTY(shadowOpacity, layer.shadowOpacity, float)
|
RCT_REMAP_VIEW_PROPERTY(shadowOpacity, layer.shadowOpacity, float)
|
||||||
RCT_REMAP_VIEW_PROPERTY(shadowRadius, layer.shadowRadius, CGFloat)
|
RCT_REMAP_VIEW_PROPERTY(shadowRadius, layer.shadowRadius, CGFloat)
|
||||||
RCT_REMAP_VIEW_PROPERTY(overflow, clipsToBounds, css_clip_t)
|
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;
|
||||||
|
}
|
||||||
RCT_CUSTOM_VIEW_PROPERTY(transformMatrix, CATransform3D, RCTView)
|
RCT_CUSTOM_VIEW_PROPERTY(transformMatrix, CATransform3D, RCTView)
|
||||||
{
|
{
|
||||||
view.layer.transform = json ? [RCTConvert CATransform3D:json] : defaultView.layer.transform;
|
view.layer.transform = json ? [RCTConvert CATransform3D:json] : defaultView.layer.transform;
|
||||||
|
|
Loading…
Reference in New Issue