From cca654a4dd178c19d8a165e15856d2b39fe3eb9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Kwas=CC=81niewski?= Date: Wed, 21 Aug 2024 10:48:06 +0200 Subject: [PATCH] fix: visionOS builds --- ios/RNCPagerScrollView.h | 1 + ios/RNCPagerView.h | 2 ++ ios/RNCPagerView.m | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/ios/RNCPagerScrollView.h b/ios/RNCPagerScrollView.h index d61de90b..bf28ac86 100644 --- a/ios/RNCPagerScrollView.h +++ b/ios/RNCPagerScrollView.h @@ -3,6 +3,7 @@ NOTE: This file is *not* currently used, for context see: - https://github.com/callstack/react-native-pager-view/pull/783#discussion_r1410295171 - https://github.com/callstack/react-native-pager-view/pull/783#discussion_r1410316201 */ +#include @interface RNCPagerScrollView : UIScrollView @end diff --git a/ios/RNCPagerView.h b/ios/RNCPagerView.h index 35325d9d..e9f7b6c1 100644 --- a/ios/RNCPagerView.h +++ b/ios/RNCPagerView.h @@ -11,7 +11,9 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic) NSInteger initialPage; @property(nonatomic) NSString* orientation; +#if !TARGET_OS_VISION @property(nonatomic, readonly) UIScrollViewKeyboardDismissMode dismissKeyboard; +#endif @property(nonatomic, copy) RCTDirectEventBlock onPageSelected; @property(nonatomic, copy) RCTDirectEventBlock onPageScroll; @property(nonatomic, copy) RCTDirectEventBlock onPageScrollStateChanged; diff --git a/ios/RNCPagerView.m b/ios/RNCPagerView.m index 709a12ba..584aada8 100644 --- a/ios/RNCPagerView.m +++ b/ios/RNCPagerView.m @@ -30,7 +30,9 @@ @implementation RNCPagerView { - (instancetype)initWithEventDispatcher:(id)eventDispatcher { if (self = [super init]) { _initialPage = 0; +#if !TARGET_OS_VISION _dismissKeyboard = UIScrollViewKeyboardDismissModeNone; +#endif _coalescingKey = 0; _eventDispatcher = eventDispatcher; _orientation = @"horizontal"; @@ -89,11 +91,13 @@ - (void)shouldScroll:(BOOL)scrollEnabled { } } +#if !TARGET_OS_VISION - (void)shouldDismissKeyboard:(NSString *)dismissKeyboard { _dismissKeyboard = [dismissKeyboard isEqual: @"on-drag"] ? UIScrollViewKeyboardDismissModeOnDrag : UIScrollViewKeyboardDismissModeNone; self.scrollView.keyboardDismissMode = _dismissKeyboard; } +#endif #pragma mark - Internal methods