-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Back out "Convert ReactViewManager, ReactClippingViewManager to Kotli…
…n" (#46581) Summary: Pull Request resolved: #46581 Original commit changeset: 09a81c91a1c9 Original Phabricator Diff: D62776270 changelog: [internal] internal Reviewed By: bvanderhoof Differential Revision: D63076764 fbshipit-source-id: 9cbd8ab86be356a7c35e44c86a95b80342c3da76
- Loading branch information
1 parent
d721d83
commit 151008f
Showing
5 changed files
with
522 additions
and
470 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
95 changes: 95 additions & 0 deletions
95
...ve/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactClippingViewManager.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,95 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and 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.views.view; | ||
|
||
import android.view.View; | ||
import androidx.annotation.Nullable; | ||
import com.facebook.infer.annotation.Nullsafe; | ||
import com.facebook.react.bridge.UiThreadUtil; | ||
import com.facebook.react.uimanager.ViewGroupManager; | ||
import com.facebook.react.uimanager.annotations.ReactProp; | ||
|
||
/** | ||
* View manager which handles clipped subviews. Useful for custom views which extends from {@link | ||
* com.facebook.react.views.view.ReactViewGroup} | ||
*/ | ||
@Nullsafe(Nullsafe.Mode.LOCAL) | ||
public abstract class ReactClippingViewManager<T extends ReactViewGroup> | ||
extends ViewGroupManager<T> { | ||
|
||
@ReactProp( | ||
name = com.facebook.react.uimanager.ReactClippingViewGroupHelper.PROP_REMOVE_CLIPPED_SUBVIEWS) | ||
public void setRemoveClippedSubviews(T view, boolean removeClippedSubviews) { | ||
UiThreadUtil.assertOnUiThread(); | ||
|
||
view.setRemoveClippedSubviews(removeClippedSubviews); | ||
} | ||
|
||
@Override | ||
public void addView(T parent, View child, int index) { | ||
UiThreadUtil.assertOnUiThread(); | ||
|
||
boolean removeClippedSubviews = parent.getRemoveClippedSubviews(); | ||
if (removeClippedSubviews) { | ||
parent.addViewWithSubviewClippingEnabled(child, index); | ||
} else { | ||
parent.addView(child, index); | ||
} | ||
} | ||
|
||
@Override | ||
public int getChildCount(T parent) { | ||
boolean removeClippedSubviews = parent.getRemoveClippedSubviews(); | ||
if (removeClippedSubviews) { | ||
return parent.getAllChildrenCount(); | ||
} else { | ||
return parent.getChildCount(); | ||
} | ||
} | ||
|
||
@Override | ||
@Nullable | ||
public View getChildAt(T parent, int index) { | ||
boolean removeClippedSubviews = parent.getRemoveClippedSubviews(); | ||
if (removeClippedSubviews) { | ||
return parent.getChildAtWithSubviewClippingEnabled(index); | ||
} else { | ||
return parent.getChildAt(index); | ||
} | ||
} | ||
|
||
@Override | ||
public void removeViewAt(T parent, int index) { | ||
UiThreadUtil.assertOnUiThread(); | ||
|
||
boolean removeClippedSubviews = parent.getRemoveClippedSubviews(); | ||
if (removeClippedSubviews) { | ||
View child = getChildAt(parent, index); | ||
if (child != null) { | ||
if (child.getParent() != null) { | ||
parent.removeView(child); | ||
} | ||
parent.removeViewWithSubviewClippingEnabled(child); | ||
} | ||
} else { | ||
parent.removeViewAt(index); | ||
} | ||
} | ||
|
||
@Override | ||
public void removeAllViews(T parent) { | ||
UiThreadUtil.assertOnUiThread(); | ||
|
||
boolean removeClippedSubviews = parent.getRemoveClippedSubviews(); | ||
if (removeClippedSubviews) { | ||
parent.removeAllViewsWithSubviewClippingEnabled(); | ||
} else { | ||
parent.removeAllViews(); | ||
} | ||
} | ||
} |
73 changes: 0 additions & 73 deletions
73
...tive/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactClippingViewManager.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.