React native 'this' references dedicatedWorkerGlobalScope instead of class instance


I have a component that I want to capture gesture events for using panResponder, however while trying to debug remotely (within chome) the 'this' context is referencing an instance of DedicatedWorkerGlobalScope instead of the class instance.

Say I have a simple component

import React, { Component } from 'react';

import {
} from 'react-native';

class MyC extends Component
      this.panResponder = PanResponder.create({

            onStartShouldSetPanResponder : () => true,
            onMoveShouldSetPanResponder : () => true,
            onPanResponderGrant : this.panResponderGranted ,

    panResponderGranted = (e, gestureState) => {

       this.setState({offset : gestureState.dx}); //this.setState is undefined


      return (<View />)


now whenever I step through the panResponderGranted function and I look at the first level closure, I can see that there is a variable named _this that has the correct reference to the instance of the class. I am debugging wrong? is this expected behavior, or a bug?


You need to bind panResponderGranted, because ES6 doesn't automatically bind functions.


onPanResponderGrant : this.panResponderGranted.bind(this),

Include the dependency


instead of


in your POM.xml

Another issue could be the mysql jar located in your .m2 folder. Try to delete the jar file, update your pom.xml and try again.

By : Maxinator

When you initialize an array and the initializer provides fewer elements than there are in the array, the remaining elements are initialized to zero:

int a[3] = { 1 };   // same as { 1, 0, 0 }

char s[4] = "ab";   // same as { 'a', 'b', 0, 0 }

In other words, your code is printing five null bytes before printing the five letters.

(You can see this easily by redirecting the output to a file and looking at the file size.)

By : Kerrek SB

This video can help you solving your question :)
By: admin