diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index e67ff470..36042939 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -12,7 +12,6 @@ on: branches: - master - jobs: ios-build: runs-on: macos-14 @@ -39,7 +38,7 @@ jobs: cache-name: cached-ios-pods-deps with: path: example/ios/Pods - key: ${{ hashFiles('./example/ios/Podfile.lock') }} + key: ${{ hashFiles('example/ios/Podfile.lock') }} - name: Bundle app run: bun build:ios diff --git a/example/bun.lockb b/example/bun.lockb index 05c67483..e221895f 100755 Binary files a/example/bun.lockb and b/example/bun.lockb differ diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 27891d05..ea0c7050 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1332,7 +1332,7 @@ PODS: - React-jsiexecutor - React-RCTFBReactNativeSpec - ReactCommon/turbomodule/core - - react-native-pager-view (6.8.1): + - react-native-pager-view (7.0.0): - DoubleConversion - glog - hermes-engine @@ -2321,7 +2321,7 @@ SPEC CHECKSUMS: React-logger: 8edfcedc100544791cd82692ca5a574240a16219 React-Mapbuffer: c3f4b608e4a59dd2f6a416ef4d47a14400194468 React-microtasksnativemodule: 054f34e9b82f02bd40f09cebd4083828b5b2beb6 - react-native-pager-view: 919534782a0489f7e2aeeb9a8b8959edfd3f067a + react-native-pager-view: 39dffe42e6c5d419a16e3b8fe6522e43abcdf7e3 react-native-safe-area-context: 562163222d999b79a51577eda2ea8ad2c32b4d06 React-NativeModulesApple: 2c4377e139522c3d73f5df582e4f051a838ff25e React-oscompat: ef5df1c734f19b8003e149317d041b8ce1f7d29c diff --git a/example/package.json b/example/package.json index bb7b0d67..cb628ee4 100644 --- a/example/package.json +++ b/example/package.json @@ -36,7 +36,7 @@ "@babel/core": "^7.25.2", "@babel/preset-env": "^7.25.3", "@babel/runtime": "^7.25.0", - "@react-native-community/cli": "17.0.1", + "@react-native-community/cli": "15.0.1", "@react-native-community/cli-platform-android": "15.0.1", "@react-native-community/cli-platform-ios": "15.0.1", "@react-native/babel-preset": "0.79.2", @@ -60,4 +60,4 @@ "engines": { "node": ">=20" } -} \ No newline at end of file +} diff --git a/ios/RNCPagerViewComponentView.mm b/ios/RNCPagerViewComponentView.mm index ccc2595b..d52f5326 100644 --- a/ios/RNCPagerViewComponentView.mm +++ b/ios/RNCPagerViewComponentView.mm @@ -28,6 +28,7 @@ @implementation RNCPagerViewComponentView { NSInteger _destinationIndex; BOOL _overdrag; NSString *_layoutDirection; + BOOL _scrollEnabled; } // Needed because of this: https://github.com/facebook/react-native/pull/37274 @@ -64,6 +65,8 @@ - (void)initializeNativePageViewController { scrollView = (UIScrollView *)subview; } } + + [self applyScrollEnabled]; } - (instancetype)initWithFrame:(CGRect)frame @@ -76,6 +79,7 @@ - (instancetype)initWithFrame:(CGRect)frame _destinationIndex = -1; _layoutDirection = @"ltr"; _overdrag = NO; + _scrollEnabled = YES; } return self; @@ -126,6 +130,7 @@ -(void)prepareForRecycle { [super prepareForRecycle]; _nativePageViewController = nil; _currentIndex = -1; + _scrollEnabled = YES; } - (void)shouldDismissKeyboard:(RNCViewPagerKeyboardDismissMode)dismissKeyboard { @@ -143,6 +148,10 @@ - (void)shouldDismissKeyboard:(RNCViewPagerKeyboardDismissMode)dismissKeyboard { #endif } +- (void)applyScrollEnabled { + scrollView.scrollEnabled = _scrollEnabled; +} + - (void)updateProps:(const facebook::react::Props::Shared &)props oldProps:(const facebook::react::Props::Shared &)oldProps{ const auto &oldScreenProps = *std::static_pointer_cast(_props); @@ -165,8 +174,9 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props oldProps:(cons [self shouldDismissKeyboard: newScreenProps.keyboardDismissMode]; } - if (newScreenProps.scrollEnabled != scrollView.scrollEnabled) { - scrollView.scrollEnabled = newScreenProps.scrollEnabled; + if (oldScreenProps.scrollEnabled != newScreenProps.scrollEnabled) { + _scrollEnabled = newScreenProps.scrollEnabled; + [self applyScrollEnabled]; } if (newScreenProps.overdrag != _overdrag) { @@ -387,7 +397,8 @@ - (void)setPageWithoutAnimation:(NSInteger)index { } - (void)setScrollEnabledImperatively:(BOOL)scrollEnabled { - [scrollView setScrollEnabled:scrollEnabled]; + _scrollEnabled = scrollEnabled; + [self applyScrollEnabled]; } #pragma mark - Helpers