Skip to content

Commit

Permalink
docs: add allowCross false Range demo
Browse files Browse the repository at this point in the history
  • Loading branch information
paranoidjk committed Oct 26, 2017
1 parent e54feed commit 3165047
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions examples/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,25 @@ class ControlledRange extends React.Component {
}
}

class ControlledRangeDisableAcross extends React.Component {
constructor(props) {
super(props);
this.state = {
value: [20, 40, 60, 80],
};
}
handleChange = (value) => {
this.setState({
value,
});
}
render() {
return (
<Range value={this.state.value} onChange={this.handleChange} allowCross={false} />
);
}
}

// https://github.com/react-component/slider/issues/226
class PureRenderRange extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -154,6 +173,10 @@ ReactDOM.render(
<p>Controlled Range</p>
<ControlledRange />
</div>
<div style={style}>
<p>Controlled Range, not allow across</p>
<ControlledRangeDisableAcross />
</div>
<div style={style}>
<p>Multi Range</p>
<Range count={3} defaultValue={[20, 40, 60, 80]} pushable />
Expand Down
2 changes: 1 addition & 1 deletion tests/setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
global.requestAnimationFrame = global.requestAnimationFrame || function (cb) {
global.requestAnimationFrame = global.requestAnimationFrame || function _raf(cb) {
return setTimeout(cb, 0);
};

Expand Down

0 comments on commit 3165047

Please sign in to comment.