framework7 react - switch tab programmatically

Viewed 102

i am used this example project as template https://github.com/codivoire/cordova-framework7-react

Now, i created a page with tabs and inside tab 1 i have one button.

I try this: When i click on the button, the tab should be changed to second tab.

import {
  Page,
  Navbar,
  Block,
  BlockTitle,
  List,
  ListItem
} from "framework7-react";

import RegisterBackButtonAction from "../../services/RegisterBackButtonAction";

export default class SecondPage extends Component {
  constructor(props) {
    super(props);
  }

  nextTab(tabId) {
    // .????????????????
  }

  componentDidMount() {
    RegisterBackButtonAction(this.$f7router);
  }

  render() {
    return (
      <Page>
        <div class="tabs-swipeable-wrap tabs-swipeable-wrap-start">
          <div class="tabs">
            <div id="tab1" class="tab tab-active">
                <a class="button " onClick={() => this.nextTab('tab2')>Test!</a>
            </div>
            <div id="tab2" class="tab">
              
            </div>
            <div id="tab3" class="tab">
              
            </div>
          </div>
        </div>
        <div class="toolbar tabbar toolbar-bottom">
          <div class="toolbar-inner">
            <a href="#tab1" class="tab-link tab-link-active">
            <i class="ion ion-md-radio-button-off"></i>
            </a>
            <a href="#tab2" class="tab-link">
            <i class="ion ion-md-radio-button-off"></i>
            </a>
            <a href="#tab3" class="tab-link">
            <i class="ion ion-md-radio-button-off"></i>
            </a>
          </div>
        </div>
      </Page>
    );
  }
}

I hope anyone can help me with this issue

0 Answers
Related