Skip to content

Change tab programmatically. activeTabIndex not work.Β #462

@lags

Description

@lags

With ionic 5 and react activeTabIndex of <SuperTabs> tag not work if value change.

const [tabIdx, setTabIdx] = useState(0);

For ex: Initial state of tabIdx is 0 so work properly but if tabIdx change with setTabIdx(2); nothing happen. I mean that component rerender successfully but tab not change.

In react mode how to change tab programmatically?

      <SuperTabs activeTabIndex={tabIdx} config={{ debug: false, sideMenu: 'left', allowElementScroll: true, nativeSmoothScroll: true }}>
        <SuperTabsToolbar slot="top" color="antracite">
          <SuperTabButton>
            <IonLabel>TestTAB1</IonLabel>
          </SuperTabButton>
          <SuperTabButton>
            <IonLabel>TestTAB2</IonLabel>
          </SuperTabButton>
          <SuperTabButton>
            <IonLabel>TestTAB3</IonLabel>
          </SuperTabButton>
        </SuperTabsToolbar>
        <SuperTabsContainer autoScrollTop>
          <TestTAB1 />
          <TestTAB2 />
          <TestTAB3 />
        </SuperTabsContainer>
      </SuperTabs>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions