oblador / react-native-animatable

Standard set of easy to use animations and declarative transitions for React Native
MIT License
9.81k stars 702 forks source link

useNativeDriver with Opacity causes Android element to show during Native UI #318

Open alexborton opened 4 years ago

alexborton commented 4 years ago

If i add a useNativeDriver on an animation view with opacity as the transition, the View will show instantly when a native UI is engaged (Android only).

For example, if you trigger Share.share() an element previously "hidden" with Opacity at 0 becomes instantly visible (no transition).

<Animatable.View
      transition="opacity"
      style={{
        ...styles.animated,
        ...(showStatus ? styles.animatedShow : null),
      }}
      /useNativeDriver
      duration={300}
      pointerEvents={!showStatus ? 'none' : null}
    >
    ....
</Animatable.View>

...

const styles = {
  animated: {
    opacity: 0,
  },
  animatedShow: {
    opacity: 1,
  },
}

Removing useNativeDriver from the animating view "fixes" the issue, but you lose the benefit of the native driver.

oblador commented 2 years ago

This sounds like a React Native bug to me, would you mind reporting it there?