Skip to content

Commit

Permalink
Decouple Proptypes from React
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanmidden committed Apr 24, 2017
1 parent a51eda7 commit a0b9ce4
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 32 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"url": "https://github.com/JedWatson/react-tappable.git"
},
"peerDependencies": {
"prop-types": "^15.5.8",
"react": "^0.14 || ^15.0.0-rc || ^15.0.0",
"react-dom": "^0.14 || ^15.0.0-rc || ^15.0.0"
},
Expand All @@ -18,11 +19,13 @@
"eslint": "^1.6.0",
"eslint-plugin-react": "^3.5.1",
"gulp": "^3.9.1",
"prop-types": "^15.5.8",
"react": "^0.14 || ^15.0.0-rc || ^15.0.0",
"react-component-gulp-tasks": "^0.7.7",
"react-dom": "^0.14 || ^15.0.0-rc || ^15.0.0"
},
"browserify-shim": {
"prop-types": "global:PropTypes",
"react": "global:React",
"react-dom": "global:ReactDOM"
},
Expand Down
11 changes: 6 additions & 5 deletions src/PinchableBaseMixin.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
var PropTypes = require('prop-types');
var React = require('react');

var Mixin = {
propTypes: {
preventDefault: React.PropTypes.bool, // whether to preventDefault on all events
stopPropagation: React.PropTypes.bool, // whether to stopPropagation on all events
preventDefault: PropTypes.bool, // whether to preventDefault on all events
stopPropagation: PropTypes.bool, // whether to stopPropagation on all events

onTouchStart: React.PropTypes.func, // pass-through touch event
onTouchMove: React.PropTypes.func, // pass-through touch event
onTouchEnd: React.PropTypes.func // pass-through touch event
onTouchStart: PropTypes.func, // pass-through touch event
onTouchMove: PropTypes.func, // pass-through touch event
onTouchEnd: PropTypes.func // pass-through touch event
},

getInitialState: function () {
Expand Down
7 changes: 4 additions & 3 deletions src/PinchableMixin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var PropTypes = require('prop-types');
var React = require('react');

function getPinchProps (touches) {
Expand All @@ -13,9 +14,9 @@ function getPinchProps (touches) {

var Mixin = {
propTypes: {
onPinchStart: React.PropTypes.func, // fires when a pinch gesture is started
onPinchMove: React.PropTypes.func, // fires on every touch-move when a pinch action is active
onPinchEnd: React.PropTypes.func // fires when a pinch action ends
onPinchStart: PropTypes.func, // fires when a pinch gesture is started
onPinchMove: PropTypes.func, // fires on every touch-move when a pinch action is active
onPinchEnd: PropTypes.func // fires when a pinch action ends
},

onPinchStart: function (event) {
Expand Down
37 changes: 19 additions & 18 deletions src/TappableMixin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var PropTypes = require('prop-types');
var React = require('react');
var ReactDOM = require('react-dom');

Expand All @@ -16,24 +17,24 @@ function getTouchProps (touch) {

var Mixin = {
propTypes: {
moveThreshold: React.PropTypes.number, // pixels to move before cancelling tap
activeDelay: React.PropTypes.number, // ms to wait before adding the `-active` class
pressDelay: React.PropTypes.number, // ms to wait before detecting a press
pressMoveThreshold: React.PropTypes.number, // pixels to move before cancelling press
preventDefault: React.PropTypes.bool, // whether to preventDefault on all events
stopPropagation: React.PropTypes.bool, // whether to stopPropagation on all events

onTap: React.PropTypes.func, // fires when a tap is detected
onPress: React.PropTypes.func, // fires when a press is detected
onTouchStart: React.PropTypes.func, // pass-through touch event
onTouchMove: React.PropTypes.func, // pass-through touch event
onTouchEnd: React.PropTypes.func, // pass-through touch event
onMouseDown: React.PropTypes.func, // pass-through mouse event
onMouseUp: React.PropTypes.func, // pass-through mouse event
onMouseMove: React.PropTypes.func, // pass-through mouse event
onMouseOut: React.PropTypes.func, // pass-through mouse event
onKeyDown: React.PropTypes.func, // pass-through key event
onKeyUp: React.PropTypes.func, // pass-through key event
moveThreshold: PropTypes.number, // pixels to move before cancelling tap
activeDelay: PropTypes.number, // ms to wait before adding the `-active` class
pressDelay: PropTypes.number, // ms to wait before detecting a press
pressMoveThreshold: PropTypes.number, // pixels to move before cancelling press
preventDefault: PropTypes.bool, // whether to preventDefault on all events
stopPropagation: PropTypes.bool, // whether to stopPropagation on all events

onTap: PropTypes.func, // fires when a tap is detected
onPress: PropTypes.func, // fires when a press is detected
onTouchStart: PropTypes.func, // pass-through touch event
onTouchMove: PropTypes.func, // pass-through touch event
onTouchEnd: PropTypes.func, // pass-through touch event
onMouseDown: PropTypes.func, // pass-through mouse event
onMouseUp: PropTypes.func, // pass-through mouse event
onMouseMove: PropTypes.func, // pass-through mouse event
onMouseOut: PropTypes.func, // pass-through mouse event
onKeyDown: PropTypes.func, // pass-through key event
onKeyUp: PropTypes.func, // pass-through key event
},

getDefaultProps: function () {
Expand Down
13 changes: 7 additions & 6 deletions src/getComponent.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var PropTypes = require('prop-types');
var React = require('react');
var touchStyles = require('./touchStyles');

Expand All @@ -12,12 +13,12 @@ module.exports = function (mixins) {
mixins: mixins,

propTypes: {
component: React.PropTypes.any, // component to create
className: React.PropTypes.string, // optional className
classBase: React.PropTypes.string, // base for generated classNames
classes: React.PropTypes.object, // object containing the active and inactive class names
style: React.PropTypes.object, // additional style properties for the component
disabled: React.PropTypes.bool // only applies to buttons
component: PropTypes.any, // component to create
className: PropTypes.string, // optional className
classBase: PropTypes.string, // base for generated classNames
classes: PropTypes.object, // object containing the active and inactive class names
style: PropTypes.object, // additional style properties for the component
disabled: PropTypes.bool // only applies to buttons
},

getDefaultProps: function () {
Expand Down

0 comments on commit a0b9ce4

Please sign in to comment.