[英]Invariant Violation: View config getter callback for component `RecentExpenses` must be a function (received `undefined`)
here i am getting error of improper import of the header file but i had imported it correctly can someone help me to figure it out where i had gone wrong in it.在这里,我收到 header 文件导入不当的错误,但我已经正确导入了它,有人可以帮我弄清楚我哪里出错了。 I am generally making an expense tracking app which contain Bottom navigation tab and 3 screens viz.
我通常制作一个费用跟踪应用程序,其中包含底部导航选项卡和 3 个屏幕。 Manage Expenses, All Expenses and Recent Expense
管理费用、所有费用和近期费用
App.js应用程序.js
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import ManageExpense from "../ExpenseTracker/screens/ManageExpense";
import AllExpenses from "../ExpenseTracker/screens/AllExpenses";
import RecentExpenses from "../ExpenseTracker/screens/RecentExpenses";
const Stack = createNativeStackNavigator();
const BottomTabs = createBottomTabNavigator();
function ExpensesOverview() {
return (
<BottomTabs.Navigator>
<BottomTabs.Screen name="RecentExpenses" component={"RecentExpenses"} />
<BottomTabs.Screen name="AllExpenses" component={"AllExpenses"} />
</BottomTabs.Navigator>
);
}
export default function App() {
return (
<>
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="ExpensesOverview" component={ExpensesOverview}/>
<Stack.Screen name="ManageExpense" component={ManageExpense} />
</Stack.Navigator>
</NavigationContainer>
</>
);
};
AllExpenses.js AllExpenses.js
import {Text} from 'react-native';
function AllExpenses(){
return <Text>All Expense Screen</Text>;
}
export default AllExpenses;
RecentExpenses.js RecentExpenses.js
import {Text} from 'react-native';
function RecentExpenses() {
return <Text>Recent Expenses Screen</Text>;
}
export default RecentExpenses;
ManageExpenes.js ManageExpenes.js
import {Text} from 'react-native'
function ManageExpense(){
return <Text>Manage Expense Screen</Text>;
}
export default ManageExpense;
<BottomTabs.Screen name="RecentExpenses" component={"RecentExpenses"} />
<BottomTabs.Screen name="AllExpenses" component={"AllExpenses"} />
You had passed component as a string rather than passing the actual component您已将组件作为字符串传递,而不是传递实际组件
Do it like像那样做
<BottomTabs.Screen name="RecentExpenses" component={RecentExpenses} />
<BottomTabs.Screen name="AllExpenses" component={AllExpenses} />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.