简体   繁体   English

不变违规:查看组件“RecentExpenses”的配置 getter 回调必须是 function(接收到“undefined”)

[英]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.

相关问题 不变违规:组件`RNCSafeAreaProvider` 的查看配置getter 回调必须是一个函数(收到`undefined`) - Invariant Violation: View config getter callback for component `RNCSafeAreaProvider` must be a function (received `undefined`) 不变违规:组件“div”的视图配置 getter 回调必须是 function(收到“未定义”)。 确保启动组件 - Invariant Violation: View config getter callback for component `div` must be a function (received `undefined`). Make sure to start componen 反应本机 - 组件“输入”的视图配置 getter 回调必须是 function(收到“未定义”) - React native - view config getter callback for component 'input' must be a function (received 'undefined') React Native(组件`input`的视图配置getter回调必须是function(收到`undefined`)。确保以组件名称开头) - React Native (View config getter callback for component `input` must be a function (received `undefined`). Make sure to start component names with) 组件“div”的视图配置 getter 回调必须是 function(收到“未定义”)。 确保以大写字母开头的组件名称 - view config getter callback for component 'div' must be a function (received 'undefined'). Make sure to start component names with a capital letter React Native Invariant Violation:查看配置 - React Native Invariant Violation: View config 不变违规:未找到名称 div 的查看配置 - Invariant Violation: View config not found for name div 反应本机渲染错误(查看组件'div'的配置getter回调? - react native render error (view config getter callback for component 'div'? 不变违规:未找到名称 p 的查看配置 - Invariant Violation: View config not found for name p 不变违规:未找到名称 div 的查看配置。 确保组件名称以大写字母开头 - Invariant Violation: View config not found for name div. Make sure to start component names with a capital letter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM