1 | import React from 'react';
|
2 | import { StyleSheet, View } from 'react-native';
|
3 | import { requireNativeViewManager } from '@unimodules/core';
|
4 | export default class NativeLinearGradient extends React.Component {
|
5 | render() {
|
6 | let { colors, locations, startPoint, endPoint, children, style, ...props } = this.props;
|
7 |
|
8 |
|
9 | let flatStyle = StyleSheet.flatten(style) || {};
|
10 | let borderRadius = flatStyle.borderRadius || 0;
|
11 |
|
12 |
|
13 | let borderRadiiPerCorner = [
|
14 | flatStyle.borderTopLeftRadius || borderRadius,
|
15 | flatStyle.borderTopLeftRadius || borderRadius,
|
16 | flatStyle.borderTopRightRadius || borderRadius,
|
17 | flatStyle.borderTopRightRadius || borderRadius,
|
18 | flatStyle.borderBottomRightRadius || borderRadius,
|
19 | flatStyle.borderBottomRightRadius || borderRadius,
|
20 | flatStyle.borderBottomLeftRadius || borderRadius,
|
21 | flatStyle.borderBottomLeftRadius || borderRadius,
|
22 | ];
|
23 | return (<View {...props} style={style}>
|
24 | <BaseNativeLinearGradient style={{ position: 'absolute', top: 0, left: 0, bottom: 0, right: 0 }} colors={colors} startPoint={startPoint} endPoint={endPoint} locations={locations} borderRadii={borderRadiiPerCorner}/>
|
25 | {children}
|
26 | </View>);
|
27 | }
|
28 | }
|
29 | const BaseNativeLinearGradient = requireNativeViewManager('ExpoLinearGradient');
|
30 | //# sourceMappingURL=NativeLinearGradient.android.js.map |
\ | No newline at end of file |