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

fix: toggle support valueLink #2237

Closed
wants to merge 1 commit into from
Closed

Conversation

yutin1987
Copy link

2015-11-22 1 29 53

when Toggle add valueLink props

@@ -172,7 +173,7 @@ const Toggle = React.createClass({
switched: this.state.switched,
onSwitch: this._handleToggle,
onParentShouldUpdate: this._handleStateChange,
defaultSwitched: this.props.defaultToggled,
defaultSwitched: this.props.defaultToggled || (this.props.valueLink && this.props.valueLink.value) || false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you use the getDefaultProps instead for the false value?

@oliviertassinari
Copy link
Member

Soulds like a good feature since it's documented by facebook here https://facebook.github.io/react/docs/two-way-binding-helpers.html.
Could you add an example in the documentation, the propery in the documentation, and a PropType following (https://github.com/facebook/react/blob/401e6f10587b09d4e725763984957cf309dfdc30/src/addons/link/ReactLink.js#L57)?

@oliviertassinari
Copy link
Member

Actually, the valueLink is now deprecated by facebook. See facebook/react#2302 and facebook/react#5032
Thanks for you effort anyway.

@zannager zannager added the component: toggle button This is the name of the generic UI component, not the React module! label Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: toggle button This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants