Javascript 新路线中未显示道具

Javascript 新路线中未显示道具,javascript,reactjs,react-native,Javascript,Reactjs,React Native,我一直在努力学习英语,但比我想象的要难。我不能创建一个简单的“master detail”应用程序(我也找不到一个好的、简单的教程来解释如何做) 我已经设法显示了一个类别列表。单击其中一个后,它将显示类别名称+此列表中的项目列表: const data = [{ "category": "Fruits", "items": [{ "name": "Apple", "icon": "apple.png" }, { "name": "Orange", "i

我一直在努力学习英语,但比我想象的要难。我不能创建一个简单的“master detail”应用程序(我也找不到一个好的、简单的教程来解释如何做)

我已经设法显示了一个类别列表。单击其中一个后,它将显示类别名称+此列表中的项目列表:

const data = [{
  "category": "Fruits",
  "items": [{
    "name": "Apple",
    "icon": "apple.png"
  }, {
    "name": "Orange",
    "icon": "orange.png"
  }]
}, {
  "category": "Vegetables",
  "items": [{
    "name": "Lettuce",
    "icon": "lettuce.png"
  }, {
    "name": "Mustard",
    "icon": "mustard.png"
  }]
}];
在我的主课上,我设法显示了一个类别列表:

<ListView
  dataSource={this.state.dataSource}
  renderRow={(rowData) => 
  <Text onPress={this.onPressItem.bind(this, rowData.category)}>
    {rowData.category}
  </Text>}
/>
在“我的详细信息”视图中,未显示
类别
名称:

class DetailView extends Component {
  render() {
    return (
      <View style={ styles.container }>
        <Text>Category: { this.props.category }</Text>
        <TouchableHighlight onPress={ () => this.props.navigator.pop() }>
            <Text>GO Back</Text>
        </TouchableHighlight>
      </View>
    );
  }
}
class-DetailView扩展组件{
render(){
返回(
类别:{this.props.Category}
this.props.navigator.pop()}>
回去
);
}
}
如果有人能帮我,我将不胜感激。可能是我做错了什么傻事。创造这个简单的东西不会那么难/


我找到了解决办法。渲染视图时我犯了一个错误:

return React.createElement(
  route.component,
  { navigator },
  {...route.passProps}
);
正确的方法是:

return React.createElement(
  route.component,
  { navigator, ...route.passProps }
);

谢谢你的帮助。

我找到了解决办法。渲染视图时我犯了一个错误:

return React.createElement(
  route.component,
  { navigator },
  {...route.passProps}
);
正确的方法是:

return React.createElement(
  route.component,
  { navigator, ...route.passProps }
);
谢谢你帮助我