Revert D5441491: [react-native][PR] Add 'contentInsetAdjustmentBehavior' (new in iOS 11) to ScrollView
Differential Revision: D5441491 fbshipit-source-id: 0ae920c6c020f41ee0fde38e57b735f87b26d4a9
This commit is contained in:
parent
3149348358
commit
560bab17e1
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue