Merge pull request #118 from aprct/master

Implement setNativeProps to allow use in TouchableHighlight, etc
This commit is contained in:
Dmitry Gladkov 2016-10-27 14:15:52 +03:00 committed by GitHub
commit 8aab9d9f53
2 changed files with 10 additions and 1 deletions

View File

@ -10,6 +10,10 @@ export default class LinearGradient extends Component {
...View.propTypes,
};
setNativeProps(props) {
this.c.setNativeProps(props);
}
render() {
const {
children,
@ -44,7 +48,7 @@ export default class LinearGradient extends Component {
];
return (
<View {...otherProps} style={style}>
<View ref={(c) => { this.c = c; }} {...otherProps} style={style}>
<NativeLinearGradient
style={{position: 'absolute', top: 0, left: 0, bottom: 0, right: 0}}
colors={colors.map(processColor)}

View File

@ -14,6 +14,10 @@ export default class LinearGradient extends Component {
...View.propTypes,
};
setNativeProps(props) {
this.c.setNativeProps(props);
}
render() {
const {
colors,
@ -26,6 +30,7 @@ export default class LinearGradient extends Component {
return (
<NativeLinearGradient
ref={(c) => { this.c = c; }}
{...otherProps}
colors={colors.map(processColor)}
locations={locations ? locations.slice(0, colors.length) : null}