From 9b860f97f3be342d1570cb20016aeff2bd081bc1 Mon Sep 17 00:00:00 2001 From: Felix Montanez Date: Fri, 12 May 2017 22:17:39 -0700 Subject: [PATCH] updated class for prop-types deprecation --- dist/react-scroll-horizontal.js | 14 +++++++++----- package.json | 3 ++- src/react-scroll-horizontal.js | 19 ++++++++++--------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/dist/react-scroll-horizontal.js b/dist/react-scroll-horizontal.js index 4e31f52..2d28193 100644 --- a/dist/react-scroll-horizontal.js +++ b/dist/react-scroll-horizontal.js @@ -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); @@ -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); @@ -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 = { diff --git a/package.json b/package.json index daebaac..2500e01 100644 --- a/package.json +++ b/package.json @@ -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", @@ -60,6 +61,6 @@ }, "dependencies": { "normalize.css": "^7.0.0", - "react-motion": "^0.5.0" + "prop-types": "^15.5.10" } } diff --git a/src/react-scroll-horizontal.js b/src/react-scroll-horizontal.js index 98683fd..bd4c8fe 100644 --- a/src/react-scroll-horizontal.js +++ b/src/react-scroll-horizontal.js @@ -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) @@ -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() { @@ -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) @@ -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 @@ -97,7 +98,7 @@ export default class HorizontalScroll extends Component { } return ( -