mohebifar/react-native-loader

DoubleBounce animation lag

denis-kungurov opened this issue ยท 0 comments

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch react-native-loader@1.3.1 for the project I'm working on.

I have problem with DoubleBounce animation. It starts after 1 second after render and its looks weird.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-loader/src/DoubleBounce.js b/node_modules/react-native-loader/src/DoubleBounce.js
index 5cf93c1..4c324c4 100644
--- a/node_modules/react-native-loader/src/DoubleBounce.js
+++ b/node_modules/react-native-loader/src/DoubleBounce.js
@@ -25,7 +25,7 @@ export default class Pulse extends Component {
 
   componentDidMount() {
     this.animate(0);
-    setTimeout(() => this.animate(1), 1000);
+    this.animate(1);
   }
 
   componentWillUnmount() {
@@ -36,12 +36,12 @@ export default class Pulse extends Component {
     Animated
       .sequence([
         Animated.timing(this.state.bounces[index], {
-          toValue: 1,
+          toValue: index,
           duration: 1000,
           useNativeDriver: false
         }),
         Animated.timing(this.state.bounces[index], {
-          toValue: 0,
+          toValue: !index,
           duration: 1000,
           useNativeDriver: false
         })

This issue body was partially generated by patch-package.

Pull request for this issue: #29