title: value is not assigned to variable in react native
body: <p>Im new to react native. 
  There are two files one is parent and another is child. From child file Im receiving callbacks in parent file. </p>
  
  <p>In that callback , as attached in screenshot, I have value in this.positionId, but when I assign that to another variable is results as 'undefined'. Can anyone tell me why this is happening ? </p>
  
  <p>Child js file contains panResponder : </p>
  
  <pre><code>componentWillMount: function() {
  this._animatedValueX = 0;
  this._animatedValueY = 0;
  this.state.pan.x.addListener((value) =&gt; this._animatedValueX = value.value);
  this.state.pan.y.addListener((value) =&gt; this._animatedValueY = value.value);
    this._panResponder = PanResponder.create({
      onMoveShouldSetResponderCapture: () =&gt; true, //Tell iOS that we are allowing the movement
      onMoveShouldSetPanResponderCapture: () =&gt; true, // Same here, tell iOS that we allow dragging
      onPanResponderGrant: (e, gestureState) =&gt; {
        this.state.pan.setOffset({x: this._animatedValueX, y: this._animatedValueY});
        this.state.pan.setValue({x: 0, y: 0}); //Initial value
      },
      onPanResponderMove: Animated.event([
        // null,
        // {
        //   dx: this.state.pan.x, dy: this.state.pan.y
        // }
      ]), // Creates a function to handle the movement and set offsets
      onPanResponderRelease: (e, gesture) =&gt; {
        this.state.pan.flattenOffset(); // Flatten the offset so it resets the default positioning
        this.props.releaseValues(e, gesture);
      }
    });
    },
  </code></pre>
  
  <p>as you can see the line this.props.releaseValues(e, gesture) gives the callback to parent controller. </p>
  
  <p>Code of positionID component --> </p>
  
  <pre><code>addElements: function(){
  return this.props.ElementsToBeAdded.map(function(element,key){
    return &lt;DraggableView
        color={element}
        positionId={key}
        key={key}
        releaseValues={(e, gesture) =&gt; {
          if(((gesture.moveX &gt; (currentX + currentWidht)) ||
              (gesture.moveX &lt; currentX)) ||
              ((gesture.moveY &gt; (currentY + currentHeight)) ||
              (gesture.moveY &lt; currentY)))
          {
            _this.setState({positionID:this.positionId});
            _this.props.releaseValuesFirstView(e,gesture,0);
          }
          else {
            _this.props.releaseValuesFirstView(e,gesture,-1);
          }
        }
      } /&gt;
  });
   },
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/z4e8K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z4e8K.png" alt="enter image description here"></a></p>