title: How to fix Error: AnimatedValue: Attempting to set value to undefined - React Native
body: <p>I Want to resize logo when keyboard show and hide .
  these is the imgStyle.js</p>
  <pre><code> import {StyleSheet, Dimensions} from 'react-native';
  
      const Height = Dimensions.get('screen');
      const height_logo = Height * 0.2;
      const height_logo_small = Height * 0.6;
  
      const IMAGE_HEIGHT = height_logo;
  
      const IMAGE_HEIGHT_SMALL = height_logo_small;
  </code></pre>
  <p>and this is main code .. (NOT FULL CODE)</p>
  <pre><code>     constructor(props) {
              super(props);
           this.imageHeight = new Animated.Value(IMAGE_HEIGHT);
                }
        
      
      componentDidMount() {
          this.keyboardDidShowSub = Keyboard.addListener(
            'keyboardDidShow',
            this.keyboardDidShow, );
          this.keyboardDidHideSub = Keyboard.addListener(
            'keyboardDidHide',
            this.keyboardDidHide,
          );
        }
  
    
  
  componentWillUnmount() {
          this.keyboardDidShowSub.remove();
          this.keyboardDidHideSub.remove();
        }
        
  
  keyboardDidShow = () =&gt; {
          Animated.timing(this.imageHeight, {
            toValue: IMAGE_HEIGHT_SMALL,
            duration: 5000,
          }).start();
        };
    
  
  keyboardDidHide = () =&gt; {
      Animated.timing(this.imageHeight, {
        toValue: IMAGE_HEIGHT,
        duration: 5000,
      }).start();
    };
  </code></pre>
  <p>and this is the error :</p>
  <blockquote>
  <p>Error: AnimatedValue: Attempting to set value to undefined</p>
  </blockquote>
  <p>anybody has this error or solved it?</p>