Skip to content

Tip for using it with Apollo 1.x #12

@Mexxerio

Description

@Mexxerio

Just leaving this hear in case someone has the same issue as me getting it to work with Apollo 1.x:

Copy this file to somewhere in your project: https://github.com/cpunion/react-native-actioncable/blob/master/index.js

And then after global.document add the following line:
global.__APOLLO_DEVTOOLS_GLOBAL_HOOK__ = ''

if(Platform.OS == 'ios' || Platform.OS == 'android'){
  global.document = {
    addEventListener () {},
    removeEventListener () {}
  }
  global.__APOLLO_DEVTOOLS_GLOBAL_HOOK__ = ''
}

The problem is that once there is a document, apollo checks for devtools meant for the browser and checks if global.__APOLLO_DEVTOOLS_GLOBAL_HOOK__ is undefined, then tries to give you some suggestions what devtools to use, but fails because there is no navigator.userAgent. So by just setting it to an empty string you skip the suggestion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions