jonaszuberbuehler / ion-affix

A directive for Ionic framework for creating affix headers.
MIT License
57 stars 20 forks source link

Runtime Error: Object(...) is not a function #28

Open omelsoft opened 6 years ago

omelsoft commented 6 years ago

I found this directive helpful in one of my project by looking at each demo. However, when I tried to integrate this to my project I got an error which says Object(...) is not a function as you can see below.

TypeError: Object(...) is not a function
    at ContentAdapter.onScroll (http://localhost:8100/build/vendor.js:163017:65)
    at IonAffix.ngAfterViewInit (http://localhost:8100/build/vendor.js:112992:52)
    at callProviderLifecycles (http://localhost:8100/build/vendor.js:13433:18)
    at callElementProvidersLifecycles (http://localhost:8100/build/vendor.js:13400:13)
    at callLifecycleHooksChildrenFirst (http://localhost:8100/build/vendor.js:13383:29)
    at checkAndUpdateView (http://localhost:8100/build/vendor.js:14538:5)
    at callViewAction (http://localhost:8100/build/vendor.js:14880:21)
    at execEmbeddedViewsAction (http://localhost:8100/build/vendor.js:14838:17)
    at checkAndUpdateView (http://localhost:8100/build/vendor.js:14530:5)
    at callViewAction (http://localhost:8100/build/vendor.js:14880:21)

The following are my Ionic info:

Ionic:

   ionic (Ionic CLI)  : 4.2.1 (C:\Users\omelsoft\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2-201807062122
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.1
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 5 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\omelsoft\AppData\Local\Android\sdk)
   NodeJS            : v8.11.4 (C:\Program Files\nodejs\node.exe)
   npm               : 6.4.1
   OS                : Windows 10
omelsoft commented 6 years ago

Managed to fix this by updating the onScroll() method to return just the ionScroll.

onScroll(): Observable { return this.content.ionScroll; // return merge(this.content.ionScrollStart, this.content.ionScroll, this.content.ionScrollEnd); }

Though you might want to take a look if this has other compatibility issues.

betojsx commented 6 years ago

Came here to post this issue but your solution worked for me. Many thanks!

omelsoft commented 6 years ago

Came here to post this issue but your solution worked for me. Many thanks!

I'm glad it helped you too. :)

jonaszuberbuehler commented 6 years ago

@omelsoft Thanks, will have a look at the PR ASAP.

andrew-lyashenko commented 5 years ago

any news about PR?

damonsomu commented 3 years ago

Still having the issue. tried the onScroll() method but no help.