我是本机反应的新手,我试图将 reduxstore 连接到我的应用程序,以便我的 Menu 组件可以获取菜肴。我已经尝试了所有检查导出错误的方法,但我找不到路线丢失的地方。请帮助我被卡住了菜单组件.jsimport React, { Component } from "react";import { FlatList } from "react-native";import { Tile } from "react-native-elements";import { connect } from "react-redux";import { baseUrl } from "../shared/baseUrl";const mapStateToProps = state => { return { dishes: state.dishes }};class Menu extends Component { static navigationOptions = { title: "Menu" }; render() { const renderMenuItem = ({ item, index }) => { return ( <Tile key={index} title={item.name} subtitle={item.description} featured onPress={() => navigate("Dishdetail", { dishId: item.id })} imageSrc={{ uri: baseUrl + item.image }} /> ); }; const { navigate } = this.props.navigation; return ( <FlatList data={this.props.dishes.dishes} renderItem={renderMenuItem} keyExtractor={item => item.id.toString()} /> ); }}export default connect(mapStateToProps)(Menu);
1 回答
智慧大石
TA贡献1946条经验 获得超3个赞
我认为您的屏幕设置不正确export default。
你能改变这个代码吗?
const MenuNavigator = createStackNavigator(
{
Menu: {
screen: () => <Menu />,
添加回答
举报
0/150
提交
取消