Docz: Unable to use PropsTable

Created on 13 Jun 2018  路  7Comments  路  Source: doczjs/docz

Bug Report

getValue this function in <PropsTable> causing error

Describe the bug
Once include PropsTable component in my mdx file it throw error

To Reproduce

  1. Go to Button.mdx
  2. Include PropsTable as describe
  3. See error
Uncaught TypeError: Cannot read property 'replace' of undefined at getValue 

Expected behavior
To see the <PropsTable> with correct props defined in ../lib/Button/index.js

Enviroment

{
  "engines": {
    "node": "8.11.1",
    "npm": "5.7.1",
    "yarn": "1.6.0"
  }
}

Additional context/Screenshots
screen shot 2018-06-13 at 3 32 49 pm
screen shot 2018-06-13 at 3 33 27 pm

bug

Most helpful comment

I didn't try <PropsTable> using oneOfType in prop types, I will see what's happening. Thanks guys 鉁岋笍

All 7 comments

Hey @louis-pvs I'm having the same problem.

I belive that problem is PropTypes.oneOfType. If you stop use it, the error not is shown.

I didn't try <PropsTable> using oneOfType in prop types, I will see what's happening. Thanks guys 鉁岋笍

Similar issue with .instanceOf:

propTypes = {
  date: PropTypes.instanceOf(Date),
}

Should I open another issue for this?

@albinekb the problem is similar, so i believe we can keep it here.

these also have the same problem:

propTypes = {
  optionalMessage: PropTypes.instanceOf(Message),
  optionalEnum: PropTypes.oneOf(['News', 'Photos']),
  optionalUnion: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number,
    PropTypes.instanceOf(Message)
  ]),
  optionalArrayOf: PropTypes.arrayOf(PropTypes.number),
  optionalObjectOf: PropTypes.objectOf(PropTypes.number),
  optionalObjectWithShape: PropTypes.shape({
    color: PropTypes.string,
    fontSize: PropTypes.number
  }),
}

I started work on that bug.

@renatorib I made my own, if you want to have a look: https://gist.github.com/albinekb/f59feb84273279d1d45f603aee8eb496

Looks great @albinekb

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nicholasess picture nicholasess  路  3Comments

kachkaev picture kachkaev  路  3Comments

bichotll picture bichotll  路  3Comments

regrettably picture regrettably  路  3Comments

albinekb picture albinekb  路  3Comments