【发布时间】:2015-07-16 18:16:12
【问题描述】:
无法完成这项工作,交叉检查了所有参考资料,但没有帮助。这是视图的所有代码。
我不确定我缺少什么,需要所有依赖项。
var React = require('react-native');
var Delivery = require('./Delivery');
var {
View,
Text,
StyleSheet,
TouchableHighlight,
} = React;
class ListItem extends React.Component{
showDetails(){
this.props.navigator.push({
title: "Delivery details",
component: Delivery
});
}
render(){
return(
<TouchableHighlight onPress={this.showDetails.bind(this)} >
<View style={styles.listItem}>
<View style={styles.listContents}>
<Text style={styles.listHead}>JMD Megapolis</Text>
<Text style={styles.listAddress}>1109, Sector 48, Sohna Road, Gurgaon 122018</Text>
<Text style={styles.listMeta}>2Kms from store</Text>
</View>
<View style={styles.listCost}>
<Text style={styles.cost}>₹40</Text>
</View>
</View>
</TouchableHighlight>
)
}
}
module.exports = ListItem;
【问题讨论】:
-
将数据分配给组件的代码在哪里?
-
暂时都是静态数据,没有动态。
-
他问的是你在哪里初始化ListItem?在某个地方你应该有类似
-
上个月有人遇到了同样的问题,并在github上提到过。阅读本文,您将找到解决方案:github.com/facebook/react-native/issues/416。底线...您在哪里添加 NavigatorIOS?
-
点击here,希望对你有帮助!
标签: reactjs react-native