JesperLekland / react-native-svg-charts

šŸ“ˆ One library to rule all charts for React Native šŸ“Š
MIT License
2.36k stars 410 forks source link

XAxis only shows up if "debug js remote" is turned on? #186

Closed acomito closed 6 years ago

acomito commented 6 years ago

What is the problem?

This is a really strange one. If I run my code with debug js remotely turned on, I see:

screen shot 2018-07-05 at 9 23 23 am

and when debug js remotely is off, or when I'm running in production, I see this:

screen shot 2018-07-05 at 9 24 24 am

Same exact data. Same exact code. Same exact phone/simulator. Really strange.

I'm going to try and isolate the code for a reproduction, and will update this post here as I go. In the mean time, here's some of my stats:

  "dependencies": {
    "accounting-js": "^1.1.1",
    "appcenter": "^1.6.0",
    "enzyme-to-json": "^3.3.4",
    "fuse.js": "^3.2.1",
    "moment": "^2.22.2",
    "phone-formatter": "^0.0.2",
    "prop-types": "^15.6.1",
    "rc-form": "^2.2.0",
    "react": "16.3.1",
    "react-native": "0.55.4",
    "react-native-autogrow-textinput": "^5.1.1",
    "react-native-calendars": "^1.19.3",
    "react-native-circular-progress": "^0.2.0",
    "react-native-code-push": "^5.3.5",
    "react-native-elements": "^0.19.1",
    "react-native-keyboard-aware-scroll-view": "^0.5.0",
    "react-native-masked-text": "^1.7.2",
    "react-native-material-textfield": "^0.12.0",
    "react-native-modal": "^6.1.0",
    "react-native-offline": "^3.10.0",
    "react-native-splash-screen": "^3.0.9",
    "react-native-svg": "6.2.1",
    "react-native-svg-charts": "^5.2.0",
    "react-native-vector-icons": "^4.6.0",
    "react-navigation": "^2.3.1",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-saga": "^0.16.0"
  },
  "devDependencies": {
    "babel-jest": "23.0.1",
    "babel-plugin-transform-remove-console": "^6.8.5",
    "babel-preset-react-native": "4.0.0",
    "eslint": "^4.6.1",
    "eslint-plugin-react": "^7.7.0",
    "jest": "23.1.0",
    "prettier": "^1.6.1",
    "react-devtools": "^3.2.3",
    "react-native-debugger-open": "^0.3.17",
    "react-test-renderer": "16.3.1",
    "redux-devtools-extension": "^2.13.2",
    "redux-logger": "^3.0.6",
    "remote-redux-devtools": "^0.5.12"
  },
  "jest": {
    "preset": "react-native",
    "setupFiles": [
      "./node_modules/appcenter/test/AppCenterMock.js"
    ]
  }
Environment:
  OS: macOS Sierra 10.12.6
  Node: 9.7.1
  Yarn: 1.5.1
  npm: 5.6.0
  Watchman: 4.9.0
  Xcode: Xcode 9.2 Build version 9C40b
  Android Studio: 3.1 AI-173.4819257

Packages: (wanted => installed)
  react: 16.3.1 => 16.3.1
  react-native: 0.55.4 => 0.55.4

Further Reading:

acomito commented 6 years ago

So, this is related to the javascript dates I'm using on my X axis. It seems when debugging is on, new Date is working differently then when debugging is off. Specially, this works:

new Date("2018-05-01")

This does not work:

new Date("2018-05-01 00:00")

My Issue is that new Date("2018-05-01") is returning the wrong day because there is no time included... see this. So really I need to use new Date("2018-05-01 00:00") if I can-- or find an alternative.

UPDATE: it seems I can just use moment.js like moment("2018-05-01")

JesperLekland commented 6 years ago

yup, when debugging is on you use chromes V8 js engine which might treat some things differently