I'm using react-navigation
to build nested TabNavigator.
My problem is that I can't navigate to other tab until I click search button. This is so weird.
(UPDATE) I just found that when I change tab, it changes the header for 'Follow' or 'Popular' only. It doesn't render the seconrd tab, 'Popular', and it doesn't switch the tab.
Here is First StackNavigator (Attached to the Root)
export default StackNavigator ({
Feedo: {
screen: FeedMainTabNavigator,
navigationOptions: {
title: 'Title',
},
},
Searcho: {
screen: SearchScreen, // if I click second tab, it doesn't show the second tab.
//But then I navigate to SearchScreen and goback to FeedScreen,
//I can see the second tab was selected.
}
}, {
lazy: true
});
Here is FeedMainTabNavigator
export default TabNavigator({
UserFeed: {
screen: UserFeedScreen
},
PopularPost: {
screen: PopularPostScreen
},
}, {
tabBarOptions: {
style: {
backgroundColor: "#7E50CE",
overflow: "hidden"
},
activeTintColor: "white",
inactiveTintColor: "white",
tabStyle: { width: 120 },
indicatorStyle: { backgroundColor: 'white' }
}
}
);
Here is UserFeedScreen (maybe problem here?)
import {withRkTheme, RkText} from 'react-native-ui-kitten'
let ThemedNavigationBar = withRkTheme(NavBar);
import { FontAwesome } from '../../assets/icons'
class UserFeedScreen extends Component {
static navigationOptions = ({navigation}) => ({
title: 'Follow',
headerRight: (
<RkText
rkType='awesome small'
style={{color: 'white'}}
onPress={() => {navigation.navigate('Searcho')}}>{FontAwesome.search}</RkText>
),
header: (headerProps) => {
return <ThemedNavigationBar navigation={navigation} headerProps={headerProps}/>
},
})