forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mechanism to enforce certain Views always being visible in the Vi…
…ew hierarchy Summary: See comments in ReactClippingProhibitedView for details and motivation behind this new feature. You may have a View class inherit from the ReactClippingProhibitedView interface in order to enable this feature for instances of that View type. This can be added to Views that should /never/ be clipped from the View hierarchy - namely, TTRC components or other telemetry components that always need to be rendered in order for some feature to function. Changelog: [Added] Opt-in mechanism to allow native Android Views to be marked as "not clippable", soft exceptions will be logged if these Views are clipped from the View hierarchy Reviewed By: sshic Differential Revision: D29472439 fbshipit-source-id: b3be53df836b452aed5dc40514ff585ce0ad812b
- Loading branch information
1 parent
e6b9508
commit 34903ba
Showing
3 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingProhibitedView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.facebook.react.uimanager; | ||
|
||
/** | ||
* Some Views may not function if added directly to a ViewGroup that clips them. For example, TTRC | ||
* markers may rely on `onDraw` functionality to work properly, and will break if they're clipped | ||
* out of the View hierarchy for any resaon. | ||
* | ||
* <p>This situation can occur more often in Fabric with View Flattening. We may prevent this sort | ||
* of View Flattening from occurring in the future, but the connection is not entirely certain. | ||
* | ||
* <p>This can occur either because ReactViewGroup clips them out, using the ordinarary subview | ||
* clipping feature. It is also possible if a View is added directly to a ReactRootView below the | ||
* fold of the screen. | ||
* | ||
* <p>Generally the solution is to prevent View flattening in JS by adding `collapsable=false` to a | ||
* parent component of the clipped view, and/or move the View higher up in the hierarchy so it is | ||
* always rendered within the first page of the screen. | ||
*/ | ||
public interface ReactClippingProhibitedView {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters