Implement setNativeProps in component to allow use as a child component in TouchableHighlight, etc.
This commit is contained in:
parent
7f5155bc95
commit
890fd1877b
|
@ -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)}
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue