Skip to content
This repository was archived by the owner on Dec 23, 2022. It is now read-only.

Commit 6c831fa

Browse files
TimoHanischleMaik
authored andcommitted
Upgrading material-ui to 0.20.0 (#168)
* Upgrading material ui to 0.2.0 * Ensuring backwards compatibility for material-ui 0.19 * Adding small comment for why an if expr is used
1 parent 5db6b72 commit 6c831fa

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@
4545
"babel-preset-react": "^6.11.1",
4646
"babel-preset-stage-0": "^6.5.0",
4747
"gh-pages": "^1.0.0",
48-
"material-ui": "^0.19.1",
48+
"material-ui": "^0.20.0",
4949
"react": "^16.0.0",
5050
"react-dom": "^16.0.0",
5151
"standard": "^10.0.2"
5252
},
5353
"peerDependencies": {
54-
"material-ui": ">= 0.19.0 < 1.0.0",
54+
"material-ui": ">= 0.19.1 < 1.0.0",
5555
"react": "^15.3.2 || ^16.0.0",
5656
"react-dom": "^15.3.2 || ^16.0.0"
5757
},

src/ChipInput.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class ChipInput extends React.Component {
158158
}
159159
}
160160

161-
this.autoComplete.handleItemTouchTap = (event, child) => {
161+
const onAutocompleteItemClick = (event, child) => {
162162
const dataSource = this.autoComplete.props.dataSource
163163

164164
const index = parseInt(child.key, 10)
@@ -170,6 +170,13 @@ class ChipInput extends React.Component {
170170
setTimeout(() => this.focus(), 1)
171171
}
172172

173+
// Ensuring that ChipInput works with with Material-UI 0.19.1 and 0.20.0
174+
if (this.autoComplete.handleItemClick) {
175+
this.autoComplete.handleItemClick = onAutocompleteItemClick;
176+
} else {
177+
this.autoComplete.handleItemTouchTap = onAutocompleteItemClick
178+
}
179+
173180
// force update autocomplete to ensure that it uses the new handlers
174181
this.autoComplete.forceUpdate()
175182
}

0 commit comments

Comments
 (0)