Skip to content

Commit

Permalink
updated class for prop-types deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-digitalkarma committed May 13, 2017
1 parent 62a3e64 commit 9b860f9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
14 changes: 9 additions & 5 deletions dist/react-scroll-horizontal.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _reactDom = require('react-dom');

var _reactDom2 = _interopRequireDefault(_reactDom);
Expand Down Expand Up @@ -91,7 +95,7 @@ var HorizontalScroll = function (_Component) {
e.preventDefault();
// If scrolling on x axis, change to y axis
// Otherwise just get the y deltas
// Basically, this for Apple mice that allow
// Basically, this for Apple mice that allow
// horizontal scrolling by default
var rawData = e.deltaY ? e.deltaY : e.deltaX;
var mouseY = Math.floor(rawData);
Expand Down Expand Up @@ -178,10 +182,10 @@ exports.default = HorizontalScroll;


HorizontalScroll.proptypes = {
reverseScroll: _react.PropTypes.bool,
pageLock: _react.PropTypes.bool,
config: _react.PropTypes.object,
style: _react.PropTypes.object
reverseScroll: _propTypes2.default.bool,
pageLock: _propTypes2.default.bool,
config: _propTypes2.default.object,
style: _propTypes2.default.object
};

HorizontalScroll.defaultProps = {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"json-loader": "^0.5.4",
"normalize.css": "^7.0.0",
"postcss-loader": "^1.3.3",
"prop-types": "^15.5.10",
"raw-loader": "^0.5.1",
"react": "^15.5.4",
"react-dom": "^15.5.4",
Expand Down Expand Up @@ -60,6 +61,6 @@
},
"dependencies": {
"normalize.css": "^7.0.0",
"react-motion": "^0.5.0"
"prop-types": "^15.5.10"
}
}
19 changes: 10 additions & 9 deletions src/react-scroll-horizontal.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { Component, PropTypes } from 'react'
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import DOM from 'react-dom'
import { Motion, spring, presets } from 'react-motion'

export default class HorizontalScroll extends Component {
constructor(props) {
super(props)

this.state = { animValues: 0 }

this.onScrollStart = this.onScrollStart.bind(this)
Expand All @@ -19,7 +20,7 @@ export default class HorizontalScroll extends Component {
if (this.props.pageLock) {
const orig = document.firstElementChild.className;
document.firstElementChild.className = orig + (orig ? ' ' : '') + 'locked__';
} else return
} else return
}

componentWillUnmount() {
Expand Down Expand Up @@ -52,12 +53,12 @@ export default class HorizontalScroll extends Component {
}

}

onScrollStart(e) {
e.preventDefault()
// If scrolling on x axis, change to y axis
// Otherwise just get the y deltas
// Basically, this for Apple mice that allow
// Basically, this for Apple mice that allow
// horizontal scrolling by default
var rawData = e.deltaY ? e.deltaY : e.deltaX
var mouseY = Math.floor(rawData)
Expand All @@ -82,9 +83,9 @@ export default class HorizontalScroll extends Component {
resetMax(x) { this.setState({ animValues: x }) }

render() {

const { config, style } = this.props
const { width, height } = style
const { width, height } = style
const springConfig = config ? config : presets.noWobble

// Styles
Expand All @@ -97,7 +98,7 @@ export default class HorizontalScroll extends Component {
}

return (
<div
<div
onWheel={this.onScrollStart}
ref='hScrollParent'
style={ styles }
Expand All @@ -110,7 +111,7 @@ export default class HorizontalScroll extends Component {
display: `inline-flex`,
height: `100%`,
position: `absolute`,
willChange:`transform`
willChange:`transform`
}
return (
<div style={ scrollingElementStyles }>
Expand Down

0 comments on commit 9b860f9

Please sign in to comment.