2015-03-31 17:44:16 +00:00
|
|
|
var React = require('React');
|
|
|
|
var NativeModules = require('NativeModules');
|
|
|
|
var ReactIOSViewAttributes = require('ReactIOSViewAttributes');
|
|
|
|
var StyleSheet = require('StyleSheet');
|
|
|
|
var createReactIOSNativeComponentClass = require('createReactIOSNativeComponentClass');
|
|
|
|
var PropTypes = require('ReactPropTypes');
|
|
|
|
var NativeMethodsMixin = require('NativeMethodsMixin');
|
|
|
|
var flattenStyle = require('flattenStyle');
|
|
|
|
var merge = require('merge');
|
2015-04-06 18:14:40 +00:00
|
|
|
var deepDiffer = require('deepDiffer');
|
2015-03-31 17:44:16 +00:00
|
|
|
|
|
|
|
var LinearGradient = React.createClass({
|
|
|
|
propTypes: {
|
|
|
|
colors: PropTypes.array,
|
2015-04-01 00:48:11 +00:00
|
|
|
start: PropTypes.array,
|
|
|
|
end: PropTypes.array,
|
|
|
|
locations: PropTypes.array,
|
2015-03-31 17:44:16 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
mixins: [NativeMethodsMixin],
|
|
|
|
|
|
|
|
viewConfig: {
|
|
|
|
uiViewClassName: 'UIView',
|
|
|
|
validAttributes: ReactIOSViewAttributes.UIView
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
var style = flattenStyle([styles.base, this.props.style]);
|
|
|
|
|
|
|
|
var nativeProps = merge(this.props, {
|
|
|
|
style,
|
|
|
|
});
|
|
|
|
|
|
|
|
return <BVLinearGradient {... nativeProps} />
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
var BVLinearGradient = createReactIOSNativeComponentClass({
|
2015-04-06 02:34:20 +00:00
|
|
|
validAttributes: merge(ReactIOSViewAttributes.UIView, {
|
2015-04-06 18:14:40 +00:00
|
|
|
colors: {diff: deepDiffer},
|
|
|
|
start: {diff: deepDiffer},
|
|
|
|
end: {diff: deepDiffer},
|
|
|
|
locations: {diff: deepDiffer},
|
2015-04-06 02:34:20 +00:00
|
|
|
}),
|
2015-03-31 17:44:16 +00:00
|
|
|
uiViewClassName: 'BVLinearGradient',
|
|
|
|
});
|
|
|
|
|
2015-04-06 02:34:20 +00:00
|
|
|
|
2015-03-31 17:44:16 +00:00
|
|
|
var styles = StyleSheet.create({
|
|
|
|
base: { },
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = LinearGradient;
|