Revert D7473762: [react-native][PR] added in snapAlignment for horizontal android scrollView

Differential Revision:
D7473762

Original commit changeset: ad4778b83f9f

fbshipit-source-id: 90f002ad60d26abd801a7a9d37e71254b063faef
This commit is contained in:
David Vacca 2018-04-11 08:46:10 -07:00 committed by Facebook Github Bot
parent c9a6b8560f
commit fcecc1502a
2 changed files with 1 additions and 25 deletions

View File

@ -52,7 +52,6 @@ public class ReactHorizontalScrollView extends HorizontalScrollView implements
private @Nullable Drawable mEndBackground;
private int mEndFillColor = Color.TRANSPARENT;
private int mSnapInterval = 0;
private String mSnapAlignment = "start";
private ReactViewBackgroundManager mReactBackgroundManager;
public ReactHorizontalScrollView(Context context) {
@ -97,13 +96,6 @@ public class ReactHorizontalScrollView extends HorizontalScrollView implements
public void setSnapInterval(int snapInterval) {
mSnapInterval = snapInterval;
if(snapInterval != 0) {
mPagingEnabled = true;
}
}
public void setSnapAlignment(String snapAlignment) {
mSnapAlignment = snapAlignment;
}
public void flashScrollIndicators() {
@ -244,17 +236,6 @@ public class ReactHorizontalScrollView extends HorizontalScrollView implements
return getWidth();
}
private int getAlignmentOffset() {
int width = getWidth();
int snapInterval = getSnapInterval();
if (mSnapAlignment.equals("center")) {
return (width - snapInterval)/2;
} else if(mSnapAlignment.equals("end")) {
return (width - snapInterval);
}
return 0;
}
public void setEndFillColor(int color) {
if (color != mEndFillColor) {
mEndFillColor = color;
@ -368,7 +349,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView implements
if (predictedX > page * width + width / 2) {
page = page + 1;
}
smoothScrollTo(page * width - getAlignmentOffset(), getScrollY());
smoothScrollTo(page * width, getScrollY());
}
@Override

View File

@ -80,11 +80,6 @@ public class ReactHorizontalScrollViewManager
view.setSnapInterval((int) (snapToInterval * screenDisplayMetrics.density));
}
@ReactProp(name = "snapToAlignment")
public void setSnapToAlignment(ReactHorizontalScrollView view, String snapToAlignment) {
view.setSnapAlignment(snapToAlignment);
}
@ReactProp(name = ReactClippingViewGroupHelper.PROP_REMOVE_CLIPPED_SUBVIEWS)
public void setRemoveClippedSubviews(ReactHorizontalScrollView view, boolean removeClippedSubviews) {
view.setRemoveClippedSubviews(removeClippedSubviews);