abhiaiyer91 / apollo-storybook-decorator

Wrap your storybook environment with Apollo Client, provide mocks for isolated UI testing with GraphQL
332 stars 34 forks source link

import apolloStorybookDecorator from 'apollo-storybook-react'; causes error in React Native #47

Open austinamorusocfc opened 5 years ago

austinamorusocfc commented 5 years ago

If import apolloStorybookDecorator from 'apollo-storybook-react'; I get the following error

undefined is not an object (evaluating 'navigator.userAgent.length')

Not really sure how to get around this issue

austinamorusocfc commented 5 years ago
"dependencies": {
    "apollo-link-state": "^0.4.1",
    "appcenter": "^1.6.0",
    "aws-appsync": "^1.0.23",
    "aws-appsync-react": "^1.0.14",
    "aws-sdk": "^2.259.1",
    "bugsnag-js": "^4.7.2",
    "bugsnag-react": "^1.1.1",
    "bugsnag-react-native": "^2.9.5",
    "email-validator": "^2.0.4",
    "graphql-tag": "^2.9.2",
    "mixpanel-browser": "^2.22.4",
    "prop-types": "^15.6.2",
    "react": "^16.5.2",
    "react-apollo": "^2.1.5",
    "react-art": "^16.4.2",
    "react-dom": "^16.5.2",
    "react-native": "~0.55.2",
    "react-native-calendar-datepicker": "^1.2.2",
    "react-native-config": "^0.11.5",
    "react-native-mixpanel": "^1.0.2",
    "react-native-table-component": "^1.1.8",
    "react-native-web": "^0.9.3",
    "react-web-config": "^1.0.0",
    "url": "^0.11.0"
  },
"devDependencies": {
    "@storybook/addon-actions": "^3.4.8",
    "@storybook/addon-links": "^3.4.8",
    "@storybook/addons": "^3.4.8",
    "@storybook/cli": "^3.4.11",
    "@storybook/react": "^3.4.8",
    "@storybook/react-native": "^3.4.8",
    "apollo-storybook-react": "^0.1.8",
    "appium": "^1.8.1",
    "appium-doctor": "^1.4.3",
    "babel-core": "^6.26.3",
    "babel-eslint": "^8.2.3",
    "babel-loader": "^7.1.2",
    "babel-plugin-module-resolver": "^3.1.1",
    "babel-plugin-react-native-web": "^0.4.0",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-plugin-transform-imports": "^1.4.1",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-react-native-stage-0": "^1.0.1",
    "babel-runtime": "^6.26.0",
    "canvas-prebuilt": "^1.6.5-prerelease.1",
    "case-sensitive-paths-webpack-plugin": "^2.1.2",
    "codemods": "https://github.com/JamieMason/codemods",
    "enzyme": "^3.3.0",
    "enzyme-adapter-react-16": "^1.1.1",
    "eslint": "^4.19.1",
    "eslint-config-prettier": "^2.9.0",
    "eslint-import-resolver-webpack": "^0.10.1",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-jest": "^21.17.0",
    "eslint-plugin-prettier": "^2.6.0",
    "eslint-plugin-promise": "^3.8.0",
    "eslint-plugin-react": "^7.11.1",
    "file-loader": "^1.1.7",
    "graphql-tools": "^4.0.1",
    "husky": "^1.0.0-rc.9",
    "jest": "^23.4.2",
    "jest-react-native": "^18.0.0",
    "jscodeshift": "^0.5.1",
    "nightwatch": "^0.9.21",
    "prettier": "1.13.5",
    "react-devtools": "^3.2.3",
    "selenium-standalone": "^6.15.1",
    "testarmada-nightwatch-extra": "^5.1.0",
    "webpack": "^3.11.0",
    "webpack-bugsnag-plugins": "^1.2.0",
    "webpack-dev-server": "2.9.4"
  },
abhiaiyer91 commented 5 years ago

Hey! Should you be using the react-native version of this lib?

austinamorusocfc commented 5 years ago

where / what is that?

austinamorusocfc commented 5 years ago

installed and switched import to import apolloStorybookDecorator from 'apollo-storybook-react-native'; same error

abhiaiyer91 commented 5 years ago

There must be a dependency somewhere thats referencing the navigator. Maybe something like this? https://github.com/facebook/react-native/issues/7117

austinamorusocfc commented 5 years ago

So for some reason an index.js in src was being sucked up automatically by storybook causing the issue which was only intended to run on web.