-
Notifications
You must be signed in to change notification settings - Fork 63
/
index.js
43 lines (37 loc) · 1.29 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {processColor,requireNativeComponent,View} from 'react-native';
import {ViewPropTypes} from 'deprecated-react-native-prop-types';
export default class RadialGradient extends Component {
static propTypes = {
center: PropTypes.arrayOf(PropTypes.number),
colors: PropTypes.arrayOf(PropTypes.string),
stops: PropTypes.arrayOf(PropTypes.number),
radius: PropTypes.number,
...ViewPropTypes,
};
render() {
const {
children,
colors,
stops,
center,
radius,
style,
...otherProps
} = this.props;
return (
<View ref={(component) => { this.gradientRef = component; }} {...otherProps} style={style}>
<NativeRadialGradient
style={{position: 'absolute', top: 0, left: 0, bottom: 0, right: 0}}
colors={(colors)?colors.map(processColor):null}
center={center}
radius={radius}
stops={stops}
/>
{ children }
</View>
);
}
}
const NativeRadialGradient = requireNativeComponent('SRSRadialGradient', null);