From f6e35daaaeaf950ca0977d9cb1eff0e2a9777af6 Mon Sep 17 00:00:00 2001 From: phillx Date: Thu, 10 Sep 2020 01:43:05 +0200 Subject: [PATCH] passing useNativeDriver property to Animated.timing, adding useNativeDriver into propTypes --- src/Toast.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Toast.js b/src/Toast.js index fc3b557..d3f9db1 100644 --- a/src/Toast.js +++ b/src/Toast.js @@ -24,6 +24,7 @@ class Toast extends Component { textStyle: ViewPropTypes.style, styles: PropTypes.any, theme: PropTypes.any, + useNativeDriver: PropTypes.bool, }; static defaultProps = { @@ -37,6 +38,7 @@ class Toast extends Component { textStyle: null, styles: {}, theme: GalioTheme, + useNativeDriver: true, }; state = { @@ -49,7 +51,7 @@ class Toast extends Component { visibilityTimeout; componentDidUpdate(prevProps) { - const { isShow, fadeInDuration, fadeOutDuration } = this.props; + const { isShow, fadeInDuration, fadeOutDuration, useNativeDriver } = this.props; const { isShow: prevIsShow } = prevProps; const { fadeAnim } = this.state; @@ -59,6 +61,7 @@ class Toast extends Component { this.animation = Animated.timing(fadeAnim, { toValue: 1, duration: fadeInDuration, + useNativeDriver, }).start(); } @@ -66,6 +69,7 @@ class Toast extends Component { this.animation = Animated.timing(fadeAnim, { toValue: 0, duration: fadeOutDuration, + useNativeDriver, }).start(); this.visibilityTimeout = setTimeout(() => {