【发布时间】:2017-01-05 13:41:51
【问题描述】:
我正在使用react-native-chart 模块在我的应用程序中显示图表,并且我想为图表上的绘制点添加可触摸的功能,所以我进入库并尝试用@987654326 包装它@组件:https://github.com/tomauty/react-native-chart/blob/master/src/LineChart.js#L168
当我尝试运行我的应用程序时,我从 xcode 收到这些错误:
复制
通过直接从 github 安装 react-native-chart 模块,然后尝试使用 TouchableOpacity https://github.com/tomauty/react-native-chart/blob/master/src/LineChart.js#L168 包装它
return (
<View>
<View style={{ position: 'absolute' }}>
<Surface width={containerWidth} height={containerHeight}>
{ multipleLines }
{ multipleFills }
</Surface>
</View>
<View style={{ position: 'absolute' }}>
<Surface width={containerWidth} height={containerHeight} />
</View>
{(() => {
if (!this.props.showDataPoint) return null;
var multipleDataPoints = dataPoints.map( (dataPointSet, index) => {
let totalDataSet = dataPointSet.map((d, i) => {
return (
// <TouchableOpacity>
<Circle key={i} {...d} onPress={()=>alert(i)} />
// </TouchableOpacity>
);
});
return totalDataSet;
});
return (
<Surface width={containerWidth} height={containerHeight}>
{ multipleDataPoints }
</Surface>
);
})()}
</View>
);
附加信息
- React Native 版本:0.39.2
- 平台:iOS
- 操作系统:MacOSX 10.12.2
【问题讨论】:
标签: javascript ios react-native react-jsx