Skip to content

Commit

Permalink
fix: visionOS builds
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Aug 21, 2024
1 parent ea11c94 commit cca654a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions ios/RNCPagerScrollView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <UIKit/UIKit.h>

@interface RNCPagerScrollView : UIScrollView <UIGestureRecognizerDelegate>
@end
2 changes: 2 additions & 0 deletions ios/RNCPagerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions ios/RNCPagerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ @implementation RNCPagerView {
- (instancetype)initWithEventDispatcher:(id<RCTEventDispatcherProtocol>)eventDispatcher {
if (self = [super init]) {
_initialPage = 0;
#if !TARGET_OS_VISION
_dismissKeyboard = UIScrollViewKeyboardDismissModeNone;
#endif
_coalescingKey = 0;
_eventDispatcher = eventDispatcher;
_orientation = @"horizontal";
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit cca654a

Please sign in to comment.