React Native - 路由“...”的组件必须是 React 组件
Posted
技术标签:
【中文标题】React Native - 路由“...”的组件必须是 React 组件【英文标题】:React Native - The Component for route '...' must be a React component 【发布时间】:2019-01-09 06:22:34 【问题描述】:您好,我正在尝试使用带有标签栏的屏幕,但我无法继续,因为错误阻止了我。我知道我确实正确地遵循了一些教程,但在我的情况下它不起作用。
错误: Screen_Shot
目标用户界面:
Tab Bar => Ordering (screen) => Category (screen)
Settlement (screen)
Pending (screen)
代码:
import Login from './src/component/screens/Login';
import tables from './src/component/screens/tables';
import Category from './src/component/screens/Category';
import Dishes from './src/component/screens/Dishes';
import Settlement from './src/component/screens/Settlement';
import Pending from './src/component/screens/Pending';
import SendingShit from './src/component/screens/SendingShit';
export default class App extends Component
render()
return (
<Root />
);
const TabNav = createBottomTabNavigator (
uggh : screen: Kaartihan , // The problem is here
Settlement : screen: Settlement ,
Pending : screen: Pending ,
);
const Kaartihan = StackNavigator (
Ordering : screen: tables ,
Category : screen: Category ,
);
const Root = StackNavigator (
Login : screen: Login ,
Tabs : screen: TabNav ,
Dishes : screen: Dishes ,
SendingShit : screen: SendingShit
);
【问题讨论】:
【参考方案1】:Kaartihan 未初始化。尝试将 Kaartihan 放在 TabNav 之前
【讨论】:
是的,它有效!但我不明白,为什么有必要这样做?我只是在“ const Tabnav ”之前更改了可能“ const Kaartihan ”的位置。以上是关于React Native - 路由“...”的组件必须是 React 组件的主要内容,如果未能解决你的问题,请参考以下文章