React Native:"undefined is not an object" 使用 ListView 和外部数据源渲染组件

React Native: "undefined is not an object" Rendering components with ListView and external dataSource

我有一个应该呈现 ListView 的容器组件。

ListView 的数据源需要调用外部(但本地)JSON 文件,其中包含 "reservations"。

ListView 应该为 JSON 文件中的每个条目呈现一个新的 "card" 并带有标题。

但是,我收到以下错误:

undefined is not an object (evaluating 'this.props.dataSource.title')

下面是我的代码的要点...我做错了什么?

https://gist.github.com/chapeljuice/316cb72432bf0d3ff90ca93349b85570

我想如果你使用

this.props.data.title

this.props.title

而不是

this.props.dataSource.title

你可以得到答案。因为当你将数据传递给 'ReservationCard' 时,数据将作为它的道具。