0
I’m having a problem changing the name of tabBarLabel
of createMaterialBottomTabNavigator
by means of the i18next, because the routes are neither functions nor component, so I did it by this mode, but I still receive notice that I am trying to access the i18next before he starts.
Code:
import React from 'react';
import { createAppContainer, createSwitchNavigator } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';
import { createMaterialBottomTabNavigator } from 'react-navigation-material-bottom-tabs';
import Icon from 'react-native-vector-icons/MaterialIcons';
import i18n from 'i18next';
import ScreenSignIn from './pages/SignIn';
import ScreenSignUp from './pages/SingUp';
import ScreenSchedule from './pages/Schedule';
import ScreenMedicine from './pages/Medicine';
import ScreenOptions from './pages/Options';
import ScreenScheduleCreate from './pages/ScheduleCreated';
export default createAppContainer(
createSwitchNavigator(
{
Sign: createSwitchNavigator({
ScreenSignIn,
ScreenSignUp,
}),
App: createMaterialBottomTabNavigator(
{
Agenda: {
screen: createStackNavigator({
ScreenSchedule: {
screen: ScreenSchedule,
// Opções da tela de ScreenSchedule
navigationOptions: {
headerTransparent: true,
},
},
ScreenScheduleCreate,
}),
navigationOptions: () => ({
tabBarIcon: <Icon name="add" size={20} color="#FFF" />,
tabBarLabel: i18n.t('Navigation:Schedule'),
}),
},
Medicine: {
screen: ScreenMedicine,
navigationOptions: () => ({
tabBarIcon: <Icon name="add" size={20} color="#FFF" />,
tabBarLabel: i18n.t('Navigation:Medicine'),
}),
},
Options: {
screen: ScreenOptions,
navigationOptions: () => ({
tabBarIcon: <Icon name="add" size={20} color="#FFF" />,
tabBarLabel: i18n.t('Navigation:Options'),
}),
},
},
{
initialRouteName: 'Agenda',
barStyle: {
backgroundColor: '#7159c1',
},
}
),
},
{
initialRouteName: 'App',
}
)
);
Warning/Warning: