Git Product home page Git Product logo

Comments (2)

caiangums avatar caiangums commented on July 21, 2024 9

I don't know if you still have issues with it but what I discovered about this issue is that the Date library (Moment/date-fns/dayjs) is not properly imported. To solve that, just import from one of the existing ones and pass as a prop the generateConfig such as:

import Picker from 'rc-picker';
import 'rc-picker/assets/index.css';
import momentGenerateConfig from 'rc-picker/lib/generate/moment'; // here

const MyPicker = () => <Picker generateConfig={momentGenerateConfig} />

Turns out that this leads to another issue with locale, so I also needed to import that and the final code looks similar to:

import Picker from 'rc-picker';
import 'rc-picker/assets/index.css';
import momentGenerateConfig from 'rc-picker/lib/generate/moment';
import enUS from 'rc-picker/lib/locale/en_US';

const MyPicker = () => <Picker generateConfig={momentGenerateConfig} locale={enUS} />

You can also look at some examples inside the examples dir 😄

from picker.

Arrrrray avatar Arrrrray commented on July 21, 2024

当我在umi创建的react项目中,使用re-picker这个插件来添加时间选择器的时候,点击输入框,出现了以下问题:

PickerPanel.js:123 Uncaught TypeError: Cannot read property 'getNow' of undefined

devScripts.js:5931 The above error occurred in the component:

具体可以查看下面图片和视频

import styles from './index.less';
import Picker from 'rc-picker';
import 'rc-picker/assets/index.css';

export default function IndexPage() {
  return (
    <div>
      <h1 className={styles.title}>Page index</h1>
      <Picker />
    </div>
  );
}

image
image
image

iShot2021-04-13.22.04.49.mov

from picker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.