-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.windows.js
More file actions
45 lines (39 loc) · 1.09 KB
/
Copy pathindex.windows.js
File metadata and controls
45 lines (39 loc) · 1.09 KB
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
44
45
/**
* @providesModule LinearGradient
* @flow
*/
import React, { Component } from 'react';
import { processColor, View } from 'react-native';
import NativeLinearGradient from './common';
// TODO: Update Windows native code + update Props to share the same API with iOS/android
type Props = {
start?: number[];
end?: number[];
colors: string[];
locations?: number[];
} & typeof(View);
export default class LinearGradient extends Component<Props> {
props: Props;
gradientRef: any;
setNativeProps(props: Props) {
this.gradientRef.setNativeProps(props);
}
render() {
const {
colors,
locations,
...otherProps
} = this.props;
if ((colors && locations) && (colors.length !== locations.length)) {
console.warn('LinearGradient colors and locations props should be arrays of the same length');
}
return (
<NativeLinearGradient
ref={(component) => { this.gradientRef = component; }}
{...otherProps}
colors={colors.map(processColor)}
locations={locations ? locations.slice(0, colors.length) : null}
/>
);
}
}