Skip to content

Commit

Permalink
Implement ScrollView.indicatorStyle
Browse files Browse the repository at this point in the history
Summary: Changelog: [internal]

Differential Revision: D25996218

fbshipit-source-id: 38b521b0ac52635a2c6341450592e6dd27be00f4
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Jan 21, 2021
1 parent fa728b2 commit 768ecc2
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ static UIScrollViewKeyboardDismissMode RCTUIKeyboardDismissModeFromProps(ScrollV
}
}

static UIScrollViewIndicatorStyle RCTUIScrollViewIndicatorStyleFromProps(ScrollViewProps const &props)
{
switch (props.indicatorStyle) {
case ScrollViewIndicatorStyle::Default:
return UIScrollViewIndicatorStyleDefault;
case ScrollViewIndicatorStyle::Black:
return UIScrollViewIndicatorStyleBlack;
case ScrollViewIndicatorStyle::White:
return UIScrollViewIndicatorStyleWhite;
}
}

static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteger tag)
{
static uint16_t coalescingKey = 0;
Expand Down Expand Up @@ -166,7 +178,6 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &
// MAP_SCROLL_VIEW_PROP(automaticallyAdjustContentInsets);
MAP_SCROLL_VIEW_PROP(decelerationRate);
MAP_SCROLL_VIEW_PROP(directionalLockEnabled);
// MAP_SCROLL_VIEW_PROP(indicatorStyle);
MAP_SCROLL_VIEW_PROP(maximumZoomScale);
MAP_SCROLL_VIEW_PROP(minimumZoomScale);
MAP_SCROLL_VIEW_PROP(scrollEnabled);
Expand All @@ -180,6 +191,10 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &
_scrollView.scrollIndicatorInsets = RCTUIEdgeInsetsFromEdgeInsets(newScrollViewProps.scrollIndicatorInsets);
}

if (oldScrollViewProps.indicatorStyle != newScrollViewProps.indicatorStyle) {
_scrollView.indicatorStyle = RCTUIScrollViewIndicatorStyleFromProps(newScrollViewProps);
}

if (oldScrollViewProps.scrollEventThrottle != newScrollViewProps.scrollEventThrottle) {
// Zero means "send value only once per significant logical event".
// Prop value is in milliseconds.
Expand Down

0 comments on commit 768ecc2

Please sign in to comment.