skip to Main Content

I’m using ScrollableTabView for scrollable tab, in iOS I am able to set initiate page. But in android it not working

<ScrollableTabView
  tabBarActiveTextColor={Colors.POLYCHROME_15}
  initialPage={this.getInitialPage()}
  tabBarUnderlineStyle={[
    Styles.tabBarBorder
  ]}
  locked={true}
  style={Styles.tabBarContainer}
>
getInitialPage() {
 const routesData = this.props.data;        

 const somethingData = this.props?.something;
 let indexSomething = 0;
 if (somethingData.length > 0) {
   let dataEnable = [];


   theDataFaq.map((dataSomethingEnable) => {
     if (dataSomethingEnable.enable) {
       dataEnable.push(dataFaqEnable)
     }
    })
    if (dataEnable.length > 0) {
      dataEnable.map((dataSomething, index) => {
        if (routesData === dataSomething.something) {
          indexSomething = index;
        }
      })
    }
  }
  return indexSomething;
}

did i missing something? or there is some bugs ?

version of ScrollableTabView "react-native-scrollable-tab-view": "^1.0.0",

2

Answers


  1. Chosen as BEST ANSWER

    this should be able to fix this temporary:

    set ref props for

    <ScrollableTabView
    ref={(ref) => { this.scrollableTabView = ref; }}
    >
    {list}
    </ScrollableTabView>
    

    then use setTimeOut (because scrollableTabView must be rendered first)

    setTimeout(() => {
    this.scrollableTabView.goToPage(index)
    }, 30);
    

  2. This is a bug in the newer versions.

    Please use this version -> 0.6.0

    npm install —save [email protected]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search