I am using Navigator Navigator Navigator from https://reactnavigation.org/docs/navigators/tab , when I switch between tab screens, I do not get any navigation state in this.props.navigation.
Tab Navigator :
import React, { Component } from 'react'; import { View, Text, Image} from 'react-native'; import DashboardTabScreen from 'FinanceBakerZ/src/components/dashboard/DashboardTabScreen'; import { TabNavigator } from 'react-navigation'; render() { console.log(this.props.navigation); return ( <View> <DashboardTabNavigator /> </View> ); } const DashboardTabNavigator = TabNavigator({ TODAY: { screen: DashboardTabScreen }, THISWEEK: { screen: DashboardTabScreen } });
DISC SCREEN:
import React, { Component } from 'react'; import { View, Text} from 'react-native'; export default class DashboardTabScreen extends Component { constructor(props) { super(props); this.state = {}; console.log('props', props); } render() { console.log('props', this.props); return ( <View style={{flex: 1}}> <Text>Checking!</Text> </View> ); } }
I get the details on the toolbar screen when it first displays the component, but I don't get the details when I switch tabs. I need to get the current screen name ie TODAY or THISWEEK.
source share