-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Back out "Redo "[RN][Android] Convert ReactViewManager, ReactClipping…
…ViewManager to Kotlin"" Summary: Backing out the stack since a same crash that previously effected many apps appeared again, and there are changes soon landing that will add more conflicts. Reviewed By: Abbondanzo Differential Revision: D63493332 fbshipit-source-id: 4423bf41c793e00a0aa22d12a77bca69d3b1ae77
- Loading branch information
1 parent
8d22e3b
commit 3f88099
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.