2015-04-13 22:10:00 -07:00
|
|
|
/**
|
|
|
|
* @providesModule LinearGradient
|
|
|
|
* @flow
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
2016-05-05 13:12:40 +03:00
|
|
|
import React, { PropTypes } from 'react';
|
|
|
|
import { processColor, requireNativeComponent, View } from 'react-native';
|
2015-09-29 12:43:22 -04:00
|
|
|
|
|
|
|
var LinearGradient = React.createClass({
|
2015-12-07 10:15:01 -08:00
|
|
|
propTypes: {
|
2016-01-27 15:38:15 +02:00
|
|
|
start: PropTypes.arrayOf(PropTypes.number),
|
|
|
|
end: PropTypes.arrayOf(PropTypes.number),
|
|
|
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
|
|
locations: PropTypes.arrayOf(PropTypes.number),
|
2015-12-07 10:15:01 -08:00
|
|
|
...View.propTypes,
|
|
|
|
},
|
|
|
|
|
2015-09-29 12:43:22 -04:00
|
|
|
render: function() {
|
|
|
|
var { colors, ...otherProps } = this.props;
|
|
|
|
return (
|
|
|
|
<NativeLinearGradient {...otherProps} colors={colors.map(processColor)} />
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
2015-03-31 10:44:16 -07:00
|
|
|
|
2016-01-27 15:38:15 +02:00
|
|
|
var NativeLinearGradient = requireNativeComponent('BVLinearGradient', null);
|
|
|
|
|
2015-03-31 10:44:16 -07:00
|
|
|
module.exports = LinearGradient;
|