Closed BigPun86 closed 8 years ago
I think your problem is that this.state.selectedTab
might be null or an invalid value at some point. Try initializing your component with this.state = { selectedTab: 'tab1' }
.
Okay, i will try it. But isn´t it just a different syntax when using class React.Component instead of var React.createClass:
constructor(){
super();
this.state = {
selectedTab: 'tab1'
}
}
VS
getInitialState(){
return {
selectedTab: 'tab1'
}
}
Shoudn´t this give me the same result?
getInitialState should be fine too. I just don't know if getStateFromStore is causing issues for you.
Oh man! I am an idiot :D i forgot to change that :D I´ll try it later, thanks...
Okay thanks! The issue was caused by my Store....
Hey there.
In my Tab Component i set the initialTab in my getInitialState as follows:
I use two Tabs with the TabNavigator, the problem i have now, is that when i set it initial to tab1 it jumps "sometimes" from tab2 to tab1. I tried setting nothing because i thought it might be handles in the react-native-tab-navigator component. Actually i hope someone can show me their solution i just coudn´t figure out how to set the initial selectedTab so there is no jumping around
My TabNavigators: