From 560bab17e19a518cedfed6385db26fffe2adf3a6 Mon Sep 17 00:00:00 2001 From: Saad Ismail Date: Wed, 26 Jul 2017 13:27:21 -0700 Subject: [PATCH] Revert D5441491: [react-native][PR] Add 'contentInsetAdjustmentBehavior' (new in iOS 11) to ScrollView Differential Revision: D5441491 fbshipit-source-id: 0ae920c6c020f41ee0fde38e57b735f87b26d4a9 --- Libraries/Components/ScrollView/ScrollView.js | 12 ---------- React/Views/RCTScrollView.m | 24 ------------------- React/Views/RCTScrollViewManager.m | 12 ---------- 3 files changed, 48 deletions(-) diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 69f9d45e7..66cce10ce 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -360,18 +360,6 @@ const ScrollView = createReactClass({ * @platform ios */ zoomScale: PropTypes.number, - /** - * This property specifies how the safe area insets are used to modify the - * content area of the scroll view. The default value of this property is - * "never". Available on iOS 11 and later. - * @platform ios - */ - contentInsetAdjustmentBehavior: PropTypes.oneOf([ - 'automatic', - 'scrollableAxes', - 'never', // default - 'always', - ]), /** * A RefreshControl component, used to provide pull-to-refresh diff --git a/React/Views/RCTScrollView.m b/React/Views/RCTScrollView.m index 35d8c628b..65d4539b5 100644 --- a/React/Views/RCTScrollView.m +++ b/React/Views/RCTScrollView.m @@ -354,22 +354,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init) if ((self = [super initWithFrame:CGRectZero])) { _eventDispatcher = eventDispatcher; - _scrollView = [[RCTCustomScrollView alloc] initWithFrame:CGRectZero]; _scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _scrollView.delegate = self; _scrollView.delaysContentTouches = NO; - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - // `contentInsetAdjustmentBehavior` is only available since iOS 11. - // We set the default behavior to "never" so that iOS - // doesn't do weird things to UIScrollView insets automatically - // and keeps it as an opt-in behavior. - if ([_scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { - _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - } -#endif - _automaticallyAdjustContentInsets = YES; _DEPRECATED_sendUpdatedChildFrames = NO; _contentInset = UIEdgeInsetsZero; @@ -913,18 +901,6 @@ RCT_SET_AND_PRESERVE_OFFSET(setShowsVerticalScrollIndicator, showsVerticalScroll RCT_SET_AND_PRESERVE_OFFSET(setZoomScale, zoomScale, CGFloat); RCT_SET_AND_PRESERVE_OFFSET(setScrollIndicatorInsets, scrollIndicatorInsets, UIEdgeInsets); -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ -- (void)setContentInsetAdjustmentBehavior:(UIScrollViewContentInsetAdjustmentBehavior)behavior -{ - // `contentInsetAdjustmentBehavior` is available since iOS 11. - if ([_scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { - CGPoint contentOffset = _scrollView.contentOffset; - _scrollView.contentInsetAdjustmentBehavior = behavior; - _scrollView.contentOffset = contentOffset; - } -} -#endif - - (void)sendScrollEventWithName:(NSString *)eventName scrollView:(UIScrollView *)scrollView userData:(NSDictionary *)userData diff --git a/React/Views/RCTScrollViewManager.m b/React/Views/RCTScrollViewManager.m index 2e5c931f9..ca1bf444c 100644 --- a/React/Views/RCTScrollViewManager.m +++ b/React/Views/RCTScrollViewManager.m @@ -36,15 +36,6 @@ RCT_ENUM_CONVERTER(UIScrollViewIndicatorStyle, (@{ @"white": @(UIScrollViewIndicatorStyleWhite), }), UIScrollViewIndicatorStyleDefault, integerValue) -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ -RCT_ENUM_CONVERTER(UIScrollViewContentInsetAdjustmentBehavior, (@{ - @"automatic": @(UIScrollViewContentInsetAdjustmentAutomatic), - @"scrollableAxes": @(UIScrollViewContentInsetAdjustmentScrollableAxes), - @"never": @(UIScrollViewContentInsetAdjustmentNever), - @"always": @(UIScrollViewContentInsetAdjustmentAlways), -}), UIScrollViewContentInsetAdjustmentNever, integerValue) -#endif - @end @implementation RCTScrollViewManager @@ -89,9 +80,6 @@ RCT_EXPORT_VIEW_PROPERTY(onScrollEndDrag, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollBegin, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollEnd, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(DEPRECATED_sendUpdatedChildFrames, BOOL) -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ -RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior) -#endif // overflow is used both in css-layout as well as by react-native. In css-layout // we always want to treat overflow as scroll but depending on what the overflow