diff --git a/src/index.js b/src/index.js index b5dd28b..031550b 100644 --- a/src/index.js +++ b/src/index.js @@ -23,6 +23,11 @@ export default class LinearGradient extends PureComponent { }; measure = (event) => { + // Zero-size indicates element disappearance. + // Do not repaint background gradient image to prevent jumps when it reappears. + if (event.nativeEvent.layout.width === 0 && event.nativeEvent.layout.height === 0) { + return; + } this.setState({ width: event.nativeEvent.layout.width, height: event.nativeEvent.layout.height,