0

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",

Ahmet Firat Keler
  • 2,603
  • 2
  • 11
  • 22
HendyCrcs
  • 111
  • 11

2 Answers2

1

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);

index filled with number

HendyCrcs
  • 111
  • 11
0

This is a bug in the newer versions.

Please use this version -> 0.6.0

npm install —save react-native-scrollable-tab-view@0.6.0
Ahmet Firat Keler
  • 2,603
  • 2
  • 11
  • 22