Skip to content

Commit 3839f29

Browse files
bilewintersMinishlink
authored andcommitted
Allowing passing through of onLayout prop rather than overwriting and ignoring with measure function
1 parent 813eeaa commit 3839f29

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ export default class LinearGradient extends PureComponent {
2222
height: 1,
2323
};
2424

25-
measure = ({ nativeEvent }) =>
25+
measure = (event) => {
2626
this.setState({
27-
width: nativeEvent.layout.width,
28-
height: nativeEvent.layout.height,
27+
width: event.nativeEvent.layout.width,
28+
height: event.nativeEvent.layout.height,
2929
});
30+
if (this.props.onLayout) {
31+
this.props.onLayout(event);
32+
}
33+
}
3034

3135
getAngle = () => {
3236
if (this.props.useAngle) {

0 commit comments

Comments
 (0)