我在响应本机中遇到错误。该错误听起来像这样: 不变的违反:元素类型无效:预期为字符串(对于内置组件)或类/函数(对于复合组件),但得到:未定义。您可能忘记了从定义文件中导出组件,或者可能混淆了默认导入和命名导入。
这是我在主要组件(应用)中的代码:
import React from 'react';
import { StatusBar } from 'react-native';
import { createAppContainer } from 'react-navigation';
import { createMaterialBottomTabNavigator } from 'react-navigation-material-bottom-tabs';
import HomeScreen from './Home';
import CalendarScreen from './Calendar';
import SettingsScreen from './Settings';
import DarkModeContextProvider from './dark-context';
import { LanguageProvider } from './Language/Language';
import { TaskListContextProvider} from './task-context'
const AppNavigator = createMaterialBottomTabNavigator(
{
Home: HomeScreen,
Calendar: CalendarScreen,
Settings: SettingsScreen
},
{
initialRouteName: 'Home',
barStyle: { backgroundColor: '#56F2F8' }
}
);
const AppContainer = createAppContainer(AppNavigator);
const App = () => {
return (
<TaskListContextProvider>
<LanguageProvider>
<DarkModeContextProvider>
<AppContainer />
</DarkModeContextProvider>
</LanguageProvider>
</TaskListContextProvider>
);
};
StatusBar.setHidden(true);
export default App;