Coder Social home page Coder Social logo

Comments (9)

darron1217 avatar darron1217 commented on July 23, 2024 3

I found the code change from Ionic 3.2.0 release.
ionic-team/ionic-framework@5d56216#diff-c7183d7ba6fabfec3a2be33bf4b070f8

This problem is caused by the change of src/components/segment/segment-button.ts file.
The code

constructor(private _renderer: Renderer, private _elementRef: ElementRef) {}

Changed to

constructor() {}

So now super-tabs cannot find variable _elementRef from SegmentButton

  private indexSegmentButtonWidths() {
    let index = [], total = 0;

    this.segmentButtons.forEach((btn: SegmentButton, i: number) => {
      // Cannot read property 'nativeElement' of undefined 
      index[i] = <ElementRef>(<any>btn)._elementRef.nativeElement.offsetWidth;
      total += index[i] + 10;
    });

    this.segmentButtonWidths = index;
    this.segmentWidth = total;
  }

So.. @ihadeed we should figure out the way to get _elementRef by fixing the code below.

@ViewChildren(SegmentButton)
private segmentButtons: QueryList<SegmentButton>;

from ionic-super-tabs.

ihadeed avatar ihadeed commented on July 23, 2024 2

Working on a fix now. Getting rid of ion-segment completely and building a custom component from scratch. A step closer to making this plugin less "hacky" ...

from ionic-super-tabs.

ihadeed avatar ihadeed commented on July 23, 2024 2

Fixed in [email protected].

from ionic-super-tabs.

mforloni avatar mforloni commented on July 23, 2024 1

I have the same problem. The scrollTabs not work in this new version.

from ionic-super-tabs.

mumairofficial avatar mumairofficial commented on July 23, 2024 1

@ihadeed It is fixed basically version was not updated in my package.json which is 2.6.1 not 2.6.0, so ionic embed older code while packaging.

DON'T forget to add --save flag while updating

npm install --save ionic2-super-tabs@latest

Thank you for hard work to make this functionality work 👍

from ionic-super-tabs.

squallliu avatar squallliu commented on July 23, 2024
@ViewChildren(SegmentButton, { read: ElementRef })
private segmentButtons: QueryList<ElementRef>;

this.segmentButtons.forEach((btn: ElementRef, i: number) => {
      index[i] = btn.nativeElement.offsetWidth;
      total += index[i] + 10;
});

from ionic-super-tabs.

hayuki avatar hayuki commented on July 23, 2024

@ihadeed Cannot update to 2.6.0, getting the following error:

pm ERR! notarget No compatible version found: [email protected]
npm ERR! notarget Valid install targets:
npm ERR! notarget 0.1.0, 0.2.0, 1.0.0, 1.1.0, 1.1.1, 2.0.0-alpha.1, 2.0.0-alpha.2, 2.0.0-beta.1, 2.0.0, 2.1.0, 2.2.0, 2.2.2, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.4.1, 2.4.2, 2.5.0, 2.5.1, 2.5.2
npm ERR! notarget

Could you perhaps have forgotten to publish the new tag on npm?..

from ionic-super-tabs.

ihadeed avatar ihadeed commented on July 23, 2024

@hayuki looks like a valid tag to me... try clearing your NPM cache by running npm cache clear

image

image

from ionic-super-tabs.

mumairofficial avatar mumairofficial commented on July 23, 2024

@ihadeed I have tried to install 2.6.0 it seems like installed but after clearing npm cache.
I checked the version which is same as before; also problem persist:

image

from ionic-super-tabs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.