ionic-super-tabs icon indicating copy to clipboard operation
ionic-super-tabs copied to clipboard

Change tab programmatically. activeTabIndex not work.

Open lags opened this issue 4 years ago • 0 comments

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>

lags avatar Feb 22 '21 07:02 lags