Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch support onClick #1290

Closed
pingan1927 opened this issue May 9, 2017 · 9 comments
Closed

switch support onClick #1290

pingan1927 opened this issue May 9, 2017 · 9 comments
Assignees

Comments

@pingan1927
Copy link
Contributor

What problem does this feature solve?

need onClick

What does the proposed API look like?

onClick

@pingan1927
Copy link
Contributor Author

when switch's prop disabled be true,onClick also can be triggered.

@pingan1927
Copy link
Contributor Author

may be need support readonly.

@pingan1927 pingan1927 self-assigned this May 9, 2017
@himStone
Copy link

himStone commented May 9, 2017

除了实现上做限制外,propsType上可以考虑加上readonly

interface SwitchProps {
  readonly disabled?: boolean;
}

@paranoidjk
Copy link
Contributor

@pingan1927 这个需求背景是什么?Switch 为什么需要 onClick, 有 onChange 不就足够了么?

@silentcloud
Copy link
Contributor

同样不明白,为什么需要 onClick,另外 readonly 不就是受控模式么?

@pingan1927
Copy link
Contributor Author

当switch disabled时,用户点击switch时需要提示用户去做其它操作。disabled时无法触发onChange事件。

@pingan1927
Copy link
Contributor Author

readeOnly慢慢再考虑,react组件不需要完全跟web标准一样。

pingan1927 added a commit that referenced this issue May 10, 2017
@paranoidjk
Copy link
Contributor

@pingan1927 这个需求,业务在Switch外面再包一个div也能实现吧

@paranoidjk
Copy link
Contributor

lixiaoyang1992 pushed a commit to lixiaoyang1992/ant-design-mobile that referenced this issue Apr 26, 2018
* fix ant-design#1290

* update

* fix bug

* fix

* update API doc

* update switch PropsType
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants