Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修正在RN0.17无法编译问题 #2

Merged
merged 2 commits into from
Jan 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
245 changes: 94 additions & 151 deletions CombinedChart.android.js
Original file line number Diff line number Diff line change
@@ -1,160 +1,103 @@
var React=require('react-native');
var {
requireNativeComponent,
PropTypes,
Component
} = React;

var iface = {
name: 'CombinedChart',
propTypes: {
data:PropTypes.object,
touchEnabled:PropTypes.bool,
dragEnabled:PropTypes.bool,
scaleEnabled:PropTypes.bool,
scaleXEnabled:PropTypes.bool,
scaleYEnabled:PropTypes.bool,
pinchZoom:PropTypes.bool,
doubleTapToZoomEnabled:PropTypes.bool,
highlightPerDragEnabled:PropTypes.bool,
highlightPerTapEnabled:PropTypes.bool,
dragDecelerationEnabled:PropTypes.bool,
dragDecelerationFrictionCoef:PropTypes.number,
maxVisibleValueCount:PropTypes.number,
limitLine:PropTypes.object,
description:PropTypes.string,
backgroundColor:PropTypes.string,
drawGridBackground:PropTypes.bool,
gridBackgroundColor:PropTypes.string,
visibleXRange:PropTypes.array,
borderColor:PropTypes.string,
borderWidth:PropTypes.number,
xAxis:PropTypes.object,
yAxisLeft:PropTypes.object,
yAxisRight:PropTypes.object,
yAxis:PropTypes.object,
fitScreen:PropTypes.bool,
chartPadding:PropTypes.string,
legend:PropTypes.object,
scaleX: PropTypes.number,
scaleY: PropTypes.number,
translateX: PropTypes.number,
translateY: PropTypes.number,
rotation: PropTypes.number,
renderToHardwareTextureAndroid: React.PropTypes.bool,
onLayout: React.PropTypes.bool,
accessibilityLiveRegion: React.PropTypes.string,
accessibilityComponentType: React.PropTypes.string,
importantForAccessibility: React.PropTypes.string,
accessibilityLabel: React.PropTypes.string,
testID: React.PropTypes.string,
},
};

// RIGHT_OF_CHART,
// RIGHT_OF_CHART_CENTER,
// RIGHT_OF_CHART_INSIDE,
// LEFT_OF_CHART,
// LEFT_OF_CHART_CENTER,
// LEFT_OF_CHART_INSIDE,
// BELOW_CHART_LEFT,
// BELOW_CHART_RIGHT,
// BELOW_CHART_CENTER,
// ABOVE_CHART_LEFT,
// ABOVE_CHART_RIGHT,
// ABOVE_CHART_CENTER,
// PIECHART_CENTER;


var MPCombinedChart= requireNativeComponent('MPCombinedChart', iface);
import React,{ requireNativeComponent, Component, PropTypes, View } from 'react-native';

class CombinedChart extends Component {
constructor(props) {
super(props);
}

var CombinedChart = React.createClass({
propTypes: {
data:PropTypes.object,
touchEnabled:PropTypes.bool,
dragEnabled:PropTypes.bool,
scaleEnabled:PropTypes.bool,
scaleXEnabled:PropTypes.bool,
scaleYEnabled:PropTypes.bool,
pinchZoom:PropTypes.bool,
doubleTapToZoomEnabled:PropTypes.bool,
highlightPerDragEnabled:PropTypes.bool,
highlightPerTapEnabled:PropTypes.bool,
dragDecelerationEnabled:PropTypes.bool,
dragDecelerationFrictionCoef:PropTypes.number,
maxVisibleValueCount:PropTypes.number,
limitLine:PropTypes.object,
description:PropTypes.string,
backgroundColor:PropTypes.string,
drawGridBackground:PropTypes.bool,
gridBackgroundColor:PropTypes.string,
visibleXRange:PropTypes.array,
borderColor:PropTypes.string,
borderWidth:PropTypes.number,
xAxis:PropTypes.object,
yAxisLeft:PropTypes.object,
yAxisRight:PropTypes.object,
yAxis:PropTypes.object,
fitScreen:PropTypes.bool,
chartPadding:PropTypes.string,
legend:PropTypes.object,
scaleX: PropTypes.number,
scaleY: PropTypes.number,
translateX: PropTypes.number,
translateY: PropTypes.number,
rotation: PropTypes.number,
renderToHardwareTextureAndroid: React.PropTypes.bool,
onLayout: React.PropTypes.bool,
accessibilityLiveRegion: React.PropTypes.string,
accessibilityComponentType: React.PropTypes.string,
importantForAccessibility: React.PropTypes.string,
accessibilityLabel: React.PropTypes.string,
testID: React.PropTypes.string,
},
render: function() {
var chartData={};
var children=this.props.children;
if(children.length){
for (var i = 0; i < children.length; i++) {
var child=children[i]
chartData[child.props.chartType]=child.props.data;
}
}else{
chartData[children.props.chartType]=children.props.data;
render() {
let chartData={};
let children=this.props.children;
if(children.length){
for (var i = 0; i < children.length; i++) {
var child=children[i]
chartData[child.props.chartType]=child.props.data;
}
}else{
chartData[children.props.chartType]=children.props.data;
}
let {
style,
data,
...other
}=this.props;
return (
<MPCombinedChart
style={this.props.style}
{...other}
data={chartData}/>
);
}
var {
style,
data,
children,
...other
}=this.props;
return (
<MPCombinedChart
style={this.props.style}
{...other}
data={chartData}/>
);
}
});
}

class chart extends Component {
propTypes:{
chartType:PropTypes.string,
CombinedChart.propTypes = {
data:PropTypes.object,
}
constructor(props) {
super(props);
}
touchEnabled:PropTypes.bool,
dragEnabled:PropTypes.bool,
scaleEnabled:PropTypes.bool,
scaleXEnabled:PropTypes.bool,
scaleYEnabled:PropTypes.bool,
pinchZoom:PropTypes.bool,
doubleTapToZoomEnabled:PropTypes.bool,
highlightPerDragEnabled:PropTypes.bool,
highlightPerTapEnabled:PropTypes.bool,
dragDecelerationEnabled:PropTypes.bool,
dragDecelerationFrictionCoef:PropTypes.number,
maxVisibleValueCount:PropTypes.number,
limitLine:PropTypes.object,
description:PropTypes.string,
backgroundColor:PropTypes.string,
drawGridBackground:PropTypes.bool,
gridBackgroundColor:PropTypes.string,
visibleXRange:PropTypes.array,
borderColor:PropTypes.string,
borderWidth:PropTypes.number,
xAxis:PropTypes.object,
yAxisLeft:PropTypes.object,
yAxisRight:PropTypes.object,
yAxis:PropTypes.object,
fitScreen:PropTypes.bool,
chartPadding:PropTypes.string,
legend:PropTypes.object,
scaleX: PropTypes.number,
scaleY: PropTypes.number,
translateX: PropTypes.number,
translateY: PropTypes.number,
rotation: PropTypes.number,
renderToHardwareTextureAndroid: React.PropTypes.bool,
onLayout: React.PropTypes.bool,
accessibilityLiveRegion: React.PropTypes.string,
accessibilityComponentType: React.PropTypes.string,
importantForAccessibility: React.PropTypes.string,
accessibilityLabel: React.PropTypes.string,
testID: React.PropTypes.string
};

class chart extends Component {
constructor(props) {
super(props);
}
}
// var chart =React.Component({
// propTypes:{
// chartType:PropTypes.string,
// data:PropTypes.object,
// }
// })
chart.propTypes = {
chartType:PropTypes.string,
data:PropTypes.object
};
CombinedChart.Chart=chart;

// RIGHT_OF_CHART,
// RIGHT_OF_CHART_CENTER,
// RIGHT_OF_CHART_INSIDE,
// LEFT_OF_CHART,
// LEFT_OF_CHART_CENTER,
// LEFT_OF_CHART_INSIDE,
// BELOW_CHART_LEFT,
// BELOW_CHART_RIGHT,
// BELOW_CHART_CENTER,
// ABOVE_CHART_LEFT,
// ABOVE_CHART_RIGHT,
// ABOVE_CHART_CENTER,
// PIECHART_CENTER;

CombinedChart.Chart=chart;
var MPCombinedChart = requireNativeComponent('MPCombinedChart', CombinedChart);

module.exports = CombinedChart;
export default CombinedChart;