react-native-pager-view icon indicating copy to clipboard operation
react-native-pager-view copied to clipboard

No command found with name "setScrollEnabledImperatively" on iOS

Open naquilini opened this issue 2 years ago • 4 comments

Environment

System: MacOS 12.6

Node: v14.12.0 React-native: 0.67.5

Description

After upgrading the react-native-pager-view library from 6.0.2 to 6.1.4, on iOS I'm getting the following error when I try to move to the next page. Simulator Screen Shot - iPhone 14 Pro Max - 2023-03-23 at 14 13 59

I think in order to fix it would be enough to rename the setScrollEnabled method in ReactViewPagerManager.m

@@ -63,7 +63,7 @@
     [self goToPage:reactTag index:index animated:false];
 }
 
-RCT_EXPORT_METHOD(setScrollEnabled
+RCT_EXPORT_METHOD(setScrollEnabledImperatively
                   : (nonnull NSNumber *)reactTag enabled
                   : (nonnull NSNumber *)enabled) {
     BOOL isEnabled = [enabled boolValue];

naquilini avatar Mar 23 '23 13:03 naquilini

Same on iOS

"react-native": "0.71.2",
"react-native-pager-view": "6.1.2"

whalemare avatar Mar 30 '23 11:03 whalemare

same on 6.1.4

alzalabany avatar May 08 '23 17:05 alzalabany

Hello @naquilini,

Did you re-run pod install? Because it looks like JS got out of sync with native dependency.

okwasniewski avatar Jul 17 '23 14:07 okwasniewski

Hi @okwasniewski Thank for the feedback.

Yes, I did run pod install.

Looking at 6.1.4 version files you'll see that inside ReactViewPagerManager.m there is no method called "setScrollEnabledImperatively" but there is one called "setScrollEnabled"

RCT_EXPORT_METHOD(setPage
                  : (nonnull NSNumber *)reactTag index
                  : (nonnull NSNumber *)index) {
    [self goToPage:reactTag index:index animated:true];
}

RCT_EXPORT_METHOD(setPageWithoutAnimation
                  : (nonnull NSNumber *)reactTag index
                  : (nonnull NSNumber *)index) {
    [self goToPage:reactTag index:index animated:false];
}

RCT_EXPORT_METHOD(setScrollEnabled
                  : (nonnull NSNumber *)reactTag enabled
                  : (nonnull NSNumber *)enabled) {
    BOOL isEnabled = [enabled boolValue];
    [self changeScrollEnabled:reactTag enabled:isEnabled];
}

https://github.com/callstack/react-native-pager-view/blob/v6.1.4/ios/ReactViewPagerManager.m

While in PagerViewNativeComponent.ts the commands defined are

export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
  supportedCommands: [
    'setPage',
    'setPageWithoutAnimation',
    'setScrollEnabledImperatively',
  ],
});

https://github.com/callstack/react-native-pager-view/blob/v6.1.4/src/PagerViewNativeComponent.ts

naquilini avatar Jul 17 '23 15:07 naquilini

Cannot reproduce, closing.

MrRefactor avatar Nov 29 '24 10:11 MrRefactor