I want to switch active tab of Tabs component programatically, I'm passing a prop page equal to 1 to make the second tab active and it does nothing.
@sankhadeeproy007 I have the same problem.
Will be documented soon,
this._tabs.goToPage(tabIndex); should do the needful. tabIndex is an integer denoting the Tab number.
Hello, please this._tabs.goToPage(tabindex) is not working for me.Please what am i doing wrong?
render() {
return (
);
}
@phixtalk
You need to set your _tabs object in the constructor
I have this._tabs = null and than you reference the tab component
<Tabs
ref={ t=>this._tabs = t }
renderTabBar={() => <ScrollableTab/>}>
--MY TABS--
</Tabs>
Than i have an input with an onFocus
<Input
onFocus={()=>{this._tabs.goToPage(tabsIndex)}}<---- call the ref
onChangeText={this.handleText}/>
Using refs stuff seems a bit dodgy though, but it works when you need a hack
@phixtalk
You need to set your _tabs object in the constructor
I have this._tabs = null and than you reference the tab component<Tabs ref={ t=>this._tabs = t } renderTabBar={() => <ScrollableTab/>}> --MY TABS-- </Tabs>Than i have an input with an onFocus
<Input onFocus={()=>{this._tabs.goToPage(tabsIndex)}}<---- call the ref onChangeText={this.handleText}/>Using refs stuff seems a bit dodgy though, but it works when you need a hack
Work for me but the current tab was not highlited
@phixtalk
You need to set your _tabs object in the constructor
I have this._tabs = null and than you reference the tab component<Tabs ref={ t=>this._tabs = t } renderTabBar={() => <ScrollableTab/>}> --MY TABS-- </Tabs>Than i have an input with an onFocus
<Input onFocus={()=>{this._tabs.goToPage(tabsIndex)}}<---- call the ref onChangeText={this.handleText}/>Using refs stuff seems a bit dodgy though, but it works when you need a hack
is not work for me and no error ,its undefined
i have only 2 tabs
what do you mean "You need to set your _tabs object in the constructor"
Most helpful comment
@phixtalk
You need to set your _tabs object in the constructor
I have this._tabs = null and than you reference the tab component
Than i have an input with an onFocus
Using refs stuff seems a bit dodgy though, but it works when you need a hack