@@ -211,16 +211,22 @@ - (void)setCustomRefreshControl:(UIView<RCTCustomRefreshControlProtocol> *)refre
211211 if ([_customRefreshControl respondsToSelector: @selector (setScrollView: )]) {
212212 _customRefreshControl.scrollView = self;
213213 }
214+ #if !TARGET_OS_TV
214215 if ([refreshControl isKindOfClass: UIRefreshControl.class]) {
215216 self.refreshControl = (UIRefreshControl *)refreshControl;
216217 } else {
218+ #endif
217219 [self addSubview: _customRefreshControl];
220+ #if !TARGET_OS_TV
218221 }
222+ #endif
219223}
220224
221225- (void )setPinchGestureEnabled:(BOOL )pinchGestureEnabled
222226{
227+ #if !TARGET_OS_TV
223228 self.pinchGestureRecognizer .enabled = pinchGestureEnabled;
229+ #endif
224230 _pinchGestureEnabled = pinchGestureEnabled;
225231}
226232
@@ -229,7 +235,9 @@ - (void)didMoveToWindow
229235 [super didMoveToWindow ];
230236 // ScrollView enables pinch gesture late in its lifecycle. So simply setting it
231237 // in the setter gets overridden when the view loads.
238+ #if !TARGET_OS_TV
232239 self.pinchGestureRecognizer .enabled = _pinchGestureEnabled;
240+ #endif
233241}
234242
235243- (BOOL )shouldGroupAccessibilityChildren
@@ -260,15 +268,19 @@ @implementation RCTScrollView {
260268
261269- (void )_registerKeyboardListener
262270{
271+ #if !TARGET_OS_TV
263272 [[NSNotificationCenter defaultCenter ] addObserver: self
264273 selector: @selector (_keyboardWillChangeFrame: )
265274 name: UIKeyboardWillChangeFrameNotification
266275 object: nil ];
276+ #endif
267277}
268278
269279- (void )_unregisterKeyboardListener
270280{
281+ #if !TARGET_OS_TV
271282 [[NSNotificationCenter defaultCenter ] removeObserver: self name: UIKeyboardWillChangeFrameNotification object: nil ];
283+ #endif
272284}
273285
274286static inline UIViewAnimationOptions animationOptionsWithCurve (UIViewAnimationCurve curve)
@@ -283,6 +295,7 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
283295
284296- (void )_keyboardWillChangeFrame : (NSNotification *)notification
285297{
298+ #if !TARGET_OS_TV
286299 if (![self automaticallyAdjustKeyboardInsets ]) {
287300 return ;
288301 }
@@ -358,6 +371,7 @@ - (void)_keyboardWillChangeFrame:(NSNotification *)notification
358371 [self scrollToOffset: newContentOffset animated: NO ];
359372 }
360373 completion: nil ];
374+ #endif
361375}
362376
363377- (instancetype )initWithEventDispatcher : (id <RCTEventDispatcherProtocol>)eventDispatcher
@@ -428,7 +442,11 @@ - (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex
428442 [super insertReactSubview: view atIndex: atIndex];
429443 if ([view conformsToProtocol: @protocol (RCTCustomRefreshControlProtocol)]) {
430444 [_scrollView setCustomRefreshControl: (UIView<RCTCustomRefreshControlProtocol> *)view];
445+ #if !TARGET_OS_TV
431446 if (![view isKindOfClass: [UIRefreshControl class ]] && [view conformsToProtocol: @protocol (UIScrollViewDelegate)]) {
447+ #else
448+ if ([view conformsToProtocol: @protocol (UIScrollViewDelegate)]) {
449+ #endif
432450 [self addScrollListener: (UIView<UIScrollViewDelegate> *)view];
433451 }
434452 } else {
@@ -449,8 +467,12 @@ - (void)removeReactSubview:(UIView *)subview
449467 [super removeReactSubview: subview];
450468 if ([subview conformsToProtocol: @protocol (RCTCustomRefreshControlProtocol)]) {
451469 [_scrollView setCustomRefreshControl: nil ];
470+ #if !TARGET_OS_TV
452471 if (![subview isKindOfClass: [UIRefreshControl class ]] &&
453472 [subview conformsToProtocol: @protocol (UIScrollViewDelegate)]) {
473+ #else
474+ if ([subview conformsToProtocol: @protocol (UIScrollViewDelegate)]) {
475+ #endif
454476 [self removeScrollListener: (UIView<UIScrollViewDelegate> *)subview];
455477 }
456478 } else {
@@ -1083,8 +1105,10 @@ -(type)getter \
10831105RCT_SET_AND_PRESERVE_OFFSET (setMaximumZoomScale, maximumZoomScale, CGFloat)
10841106RCT_SET_AND_PRESERVE_OFFSET (setMinimumZoomScale, minimumZoomScale, CGFloat)
10851107RCT_SET_AND_PRESERVE_OFFSET (setScrollEnabled, isScrollEnabled, BOOL )
1108+ #if !TARGET_OS_TV
10861109RCT_SET_AND_PRESERVE_OFFSET (setPagingEnabled, isPagingEnabled, BOOL )
10871110RCT_SET_AND_PRESERVE_OFFSET (setScrollsToTop, scrollsToTop, BOOL )
1111+ #endif
10881112RCT_SET_AND_PRESERVE_OFFSET (setShowsHorizontalScrollIndicator, showsHorizontalScrollIndicator, BOOL )
10891113RCT_SET_AND_PRESERVE_OFFSET (setShowsVerticalScrollIndicator, showsVerticalScrollIndicator, BOOL )
10901114RCT_SET_AND_PRESERVE_OFFSET (setZoomScale, zoomScale, CGFloat);
0 commit comments