Skip to content

Commit

Permalink
remove experimental prop endDraggingSensitivityVelocityMultiplier fro…
Browse files Browse the repository at this point in the history
…m ScrollView (#43554)

Summary:
Pull Request resolved: #43554

changelog: [internal]

The prop endDraggingSensitivityVelocityMultiplier makes the API more complicated and provides only limited benefit. Let's remove it for the sake of simplicity.

Reviewed By: christophpurrer

Differential Revision: D53853298

fbshipit-source-id: d2663f2f6eef1dde3136debe8965ee871f4e043d
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Mar 19, 2024
1 parent 5a80935 commit ec6d027
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ @implementation RCTScrollViewComponentView {
__weak UIView *_firstVisibleView;

CGFloat _endDraggingSensitivityMultiplier;
CGFloat _endDraggingSensitivityVelocityMultiplier;
}

+ (RCTScrollViewComponentView *_Nullable)findScrollViewComponentViewForView:(UIView *)view
Expand Down Expand Up @@ -137,7 +136,6 @@ - (instancetype)initWithFrame:(CGRect)frame
[self.scrollViewDelegateSplitter addDelegate:self];

_scrollEventThrottle = 0;
_endDraggingSensitivityVelocityMultiplier = 0;
_endDraggingSensitivityMultiplier = 1;
}

Expand Down Expand Up @@ -236,7 +234,6 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
}

_endDraggingSensitivityMultiplier = newScrollViewProps.endDraggingSensitivityMultiplier;
_endDraggingSensitivityVelocityMultiplier = newScrollViewProps.endDraggingSensitivityVelocityMultiplier;

if (oldScrollViewProps.scrollEventThrottle != newScrollViewProps.scrollEventThrottle) {
// Zero means "send value only once per significant logical event".
Expand Down Expand Up @@ -444,12 +441,10 @@ - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView
withVelocity:(CGPoint)velocity
targetContentOffset:(inout CGPoint *)targetContentOffset
{
if (fabs(_endDraggingSensitivityMultiplier - 1) > 0.0001f ||
fabs(_endDraggingSensitivityVelocityMultiplier) > 0.0001f) {
if (fabs(_endDraggingSensitivityMultiplier - 1) > 0.0001f) {
if (targetContentOffset->y > 0) {
const CGFloat travel = targetContentOffset->y - scrollView.contentOffset.y;
targetContentOffset->y = scrollView.contentOffset.y + travel * _endDraggingSensitivityMultiplier +
velocity.y * _endDraggingSensitivityVelocityMultiplier;
targetContentOffset->y = scrollView.contentOffset.y + travel * _endDraggingSensitivityMultiplier;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ - (UIView *)view
RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustKeyboardInsets, BOOL)
RCT_EXPORT_VIEW_PROPERTY(decelerationRate, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(endDraggingSensitivityMultiplier, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(endDraggingSensitivityVelocityMultiplier, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(directionalLockEnabled, BOOL)
RCT_EXPORT_VIEW_PROPERTY(indicatorStyle, UIScrollViewIndicatorStyle)
RCT_EXPORT_VIEW_PROPERTY(keyboardDismissMode, UIScrollViewKeyboardDismissMode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,6 @@ ScrollViewProps::ScrollViewProps(
"endDraggingSensitivityMultiplier",
sourceProps.endDraggingSensitivityMultiplier,
1)),
endDraggingSensitivityVelocityMultiplier(
CoreFeatures::enablePropIteratorSetter
? sourceProps.endDraggingSensitivityVelocityMultiplier
: convertRawProp(
context,
rawProps,
"endDraggingSensitivityVelocityMultiplier",
sourceProps.endDraggingSensitivityVelocityMultiplier,
0)),
directionalLockEnabled(
CoreFeatures::enablePropIteratorSetter
? sourceProps.directionalLockEnabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class ScrollViewProps final : public ViewProps {
bool automaticallyAdjustsScrollIndicatorInsets{true};
Float decelerationRate{0.998f};
Float endDraggingSensitivityMultiplier{1};
Float endDraggingSensitivityVelocityMultiplier{0};
bool directionalLockEnabled{};
ScrollViewIndicatorStyle indicatorStyle{};
ScrollViewKeyboardDismissMode keyboardDismissMode{};
Expand Down

0 comments on commit ec6d027

Please sign in to comment.