react-native-linear-gradient/index.android.js

33 lines
875 B
JavaScript
Raw Normal View History

2015-09-30 17:06:36 +00:00
var React = require('react-native');
var { requireNativeComponent, PropTypes, View, processColor } = React;
var LinearGradient = React.createClass({
propTypes: {
start: PropTypes.array,
end: PropTypes.array,
2015-09-30 17:06:36 +00:00
colors: PropTypes.array.isRequired,
locations: PropTypes.array,
...View.propTypes,
2015-09-30 17:06:36 +00:00
},
render: function() {
var {style, children, colors, locations, start, end, ...otherProps} = this.props;
2015-09-30 17:06:36 +00:00
return (
<View style={style}>
<NativeLinearGradient
style={{position: 'absolute', top: 0, left: 0, bottom: 0, right: 0}}
colors={colors.map(processColor)}
start={start}
end={end}
locations={locations} />
2015-09-30 17:06:36 +00:00
{ children }
</View>
);
}
})
var NativeLinearGradient = requireNativeComponent('BVLinearGradient', LinearGradient);
module.exports = LinearGradient;