File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -274,6 +274,29 @@ var View = React.createClass({
274274 * @platform android
275275 */
276276 collapsable : PropTypes . bool ,
277+
278+ /**
279+ * Whether this view needs to rendered offscreen and composited with an alpha
280+ * in order to preserve 100% correct colors and blending behavior. The default
281+ * (false) falls back to drawing the component and its children with an alpha
282+ * applied to the paint used to draw each element instead of rendering the full
283+ * component offscreen and compositing it back with an alpha value. This default
284+ * may be noticeable and undesired in the case where the View you are setting
285+ * an opacity on has multiple overlapping elements (e.g. multiple overlapping
286+ * Views, or text and a background).
287+ *
288+ * Rendering offscreen to preserve correct alpha behavior is extremely
289+ * expensive and hard to debug for non-native developers, which is why it is
290+ * not turned on by default. If you do need to enable this property for an
291+ * animation, consider combining it with renderToHardwareTextureAndroid if the
292+ * view **contents** are static (i.e. it doesn't need to be redrawn each frame).
293+ * If that property is enabled, this View will be rendered off-screen once,
294+ * saved in a hardware texture, and then composited onto the screen with an alpha
295+ * each frame without having to switch rendering targets on the GPU.
296+ *
297+ * @platform android
298+ */
299+ needsOffscreenAlphaCompositing : PropTypes . bool ,
277300 } ,
278301
279302 render : function ( ) {
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ ReactNativeViewAttributes.UIView = {
3030 onAccessibilityTap : true ,
3131 onMagicTap : true ,
3232 collapsable : true ,
33+ needsOffscreenAlphaCompositing : true ,
3334} ;
3435
3536ReactNativeViewAttributes . RCTView = merge (
You can’t perform that action at this time.
0 commit comments