Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
pass down id in switchButton
Browse files Browse the repository at this point in the history
-
closes #23
this allows onChange events to see components' id
  • Loading branch information
cezaraugusto committed Apr 26, 2018
1 parent 6651c3b commit 54a4d82
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion components/switchButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ class SwitchButton extends React.PureComponent<SwitchButtonProps, SwitchButtonSt
}
// add non-null assertion operator
// in case onChange is not defined i.e. used in a prototype
props.onChange!({ target: { checked: e.target.checked } })
props.onChange!({
target: {
checked: e.target.checked,
id: e.target.id
}
})
}

render () {
Expand Down
7 changes: 6 additions & 1 deletion package/switchButton/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package/switchButton/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 54a4d82

Please sign in to comment.