picker
picker copied to clipboard
GenerateConfig is not undefined
Is there anyone find that, Generateconfig is passed in through props, but there is no API description. As a result, the value of generateconfig is undefined and an error will be reported when using it.
Use according to novice guidelines
`export default function IndexPage() {
return (
<Picker />
); }`
there will be a error,because Generateconfig is undefined `TypeError: Cannot read property 'locale' of undefined formatValue ./node_modules/rc-picker/es/utils/dateUtil.js:126 123 | var generateConfig = _ref.generateConfig, 124 | locale = _ref.locale, 125 | format = _ref.format;
126 | return typeof format === 'function' ? format(value) : generateConfig.locale.format(locale.locale, value, format); 127 | } 128 | export function parseValue(value, _ref2) { 129 | var generateConfig = _ref2.generateConfig, View compiled`
Is that mean we should give Generateconfig a default value from generate
Try this:
import generateConfig from "rc-picker/lib/generate/(lib)"
lib can be dayjs
dateFn
or moment
, depends and the date library you prefer use
I made a reply to an issue similar to this one. If you want, it is possible to check it here.
Also, as this is the second issue with the same question maybe could be a good thing to make a reference to it inside the docs/readme. I could open a PR of it! 😄