color conversion in JS

This commit is contained in:
Nick Hudkins 2015-09-29 12:43:22 -04:00
parent 210ea4ce90
commit 1a2cd1c4f2
1 changed files with 12 additions and 2 deletions

View File

@ -5,7 +5,17 @@
'use strict';
var { requireNativeComponent, } = require('react-native');
var LinearGradient = requireNativeComponent('BVLinearGradient', null);
var React = require('react-native');
var { requireNativeComponent, processColor } = React;
var NativeLinearGradient = requireNativeComponent('BVLinearGradient', null);
var LinearGradient = React.createClass({
render: function() {
var { colors, ...otherProps } = this.props;
return (
<NativeLinearGradient {...otherProps} colors={colors.map(processColor)} />
);
}
});
module.exports = LinearGradient;