Skip to content

Commit 820ff46

Browse files
committed
Upgrade to 0.14.x syntax
1 parent 9ae3390 commit 820ff46

File tree

12 files changed

+57
-57
lines changed

12 files changed

+57
-57
lines changed

.eslintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ rules:
1111
semi:
1212
- 2
1313
- always
14+
react/no-did-update-set-state:
15+
- 0
1416
react/sort-comp:
1517
- 2
1618
- order

example/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
<body>
1010
<div id="app"></div>
1111

12-
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js"></script>
12+
<script src="https://fb.me/react-0.14.3.js"></script>
13+
<script src="https://fb.me/react-dom-0.14.3.js"></script>
1314
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.25/browser-polyfill.js"></script>
1415
<script src="./build/example.js"></script>
1516
</body>

example/js/example.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React from 'react';
1+
import ReactDOM from 'react-dom';
22
import App from 'App';
33

4-
React.render(
4+
ReactDOM.render(
55
<App />,
66
document.getElementById('app')
77
);

karma.conf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = function(config) {
66

77
files: [
88
'node_modules/react/dist/react.js',
9+
'node_modules/react-dom/dist/react-dom.js',
910
'node_modules/lodash/index.js',
1011
'node_modules/babelify/polyfill.js',
1112
'src/**/*.js',

package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
"browserify": "^11.0.0",
2828
"browserify-shim": "^3.8.10",
2929
"del": "^1.2.0",
30-
"eslint": "^1.0.0",
31-
"eslint-config-airbnb": "0.0.7",
32-
"eslint-plugin-react": "^3.1.0",
30+
"eslint": "^1.10.2",
31+
"eslint-config-airbnb": "^1.0.2",
32+
"eslint-plugin-react": "^3.10.0",
3333
"gulp": "^3.9.0",
3434
"gulp-babel": "^5.2.1",
3535
"gulp-bump": "^1.0.0",
3636
"gulp-concat": "^2.6.0",
3737
"gulp-connect": "^2.2.0",
38-
"gulp-eslint": "^0.15.0",
38+
"gulp-eslint": "^1.1.1",
3939
"gulp-git": "^1.4.0",
4040
"gulp-minify-css": "^1.2.0",
4141
"gulp-postcss": "^6.0.0",
@@ -55,22 +55,25 @@
5555
"karma-phantomjs2-launcher": "^0.3.2",
5656
"lodash": "^3.10.0",
5757
"phantomjs": "^1.9.17",
58+
"react": "^0.14.0",
59+
"react-dom": "^0.14.0",
5860
"run-sequence": "^1.1.4",
5961
"semver": "^5.0.3",
6062
"vinyl-buffer": "^1.0.0",
6163
"vinyl-source-stream": "^1.1.0",
6264
"watchify": "^3.3.0"
6365
},
6466
"peerDependencies": {
65-
"react": "^0.13.3"
67+
"react": "^0.14.0"
6668
},
6769
"browserify": {
6870
"transform": [
6971
"browserify-shim"
7072
]
7173
},
7274
"browserify-shim": {
73-
"react": "global:React"
75+
"react": "global:React",
76+
"react-dom": "global:ReactDOM"
7477
},
7578
"scripts": {
7679
"build": "gulp build",

src/InputRange/Slider.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ class Slider extends React.Component {
88
// Initial state
99
this.state = {};
1010

11-
// Enable touch
12-
React.initializeTouchEvents(true);
13-
1411
// Auto-bind
1512
autobind([
1613
'handleClick',
@@ -35,8 +32,8 @@ class Slider extends React.Component {
3532

3633
// Getters / Setters
3734
get document() {
38-
const element = React.findDOMNode(this);
39-
const document = element.ownerDocument;
35+
const { slider } = this.refs;
36+
const document = slider.ownerDocument;
4037

4138
return document;
4239
}
@@ -111,7 +108,10 @@ class Slider extends React.Component {
111108
const style = this.state.style || {};
112109

113110
return (
114-
<span className={ classNames.sliderContainer } style={ style }>
111+
<span
112+
className={ classNames.sliderContainer }
113+
ref="slider"
114+
style={ style }>
115115
<span className={ classNames.labelValue }>
116116
<span className={ classNames.labelContainer }>
117117
{ this.props.value }

src/InputRange/Track.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ class Track extends React.Component {
88
// Initial state
99
this.state = {};
1010

11-
// Enable touch
12-
React.initializeTouchEvents(true);
13-
1411
// Auto-bind
1512
autobind([
1613
'handleMouseDown',
@@ -29,7 +26,7 @@ class Track extends React.Component {
2926

3027
// Getters / Setters
3128
get clientRect() {
32-
const track = React.findDOMNode(this);
29+
const { track } = this.refs;
3330
const clientRect = track.getClientRects()[0];
3431

3532
return clientRect;
@@ -75,9 +72,10 @@ class Track extends React.Component {
7572

7673
return (
7774
<div
75+
className={ classNames.trackContainer }
7876
onMouseDown={ this.handleMouseDown }
7977
onTouchStart={ this.handleTouchStart }
80-
className={ classNames.trackContainer }>
78+
ref="track">
8179
<div
8280
style={ activeTrackStyle }
8381
className={ classNames.trackActive }>

src/InputRange/propTypes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { objectOf } from './util';
1+
import { isNumber, objectOf } from './util';
22

33
function numberPredicate(value) {
44
return typeof value === 'number';
@@ -19,8 +19,8 @@ export function maxMinValuePropType(props) {
1919
return new Error('`value` or `defaultValue` must be a number');
2020
}
2121

22-
if (!value &&
23-
!defaultValue &&
22+
if (!isNumber(value) &&
23+
!isNumber(defaultValue) &&
2424
!objectOf(values, numberPredicate) &&
2525
!objectOf(defaultValues, numberPredicate)) {
2626
return new Error('`values` or `defaultValues` must be an object of numbers');

tasks/run.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import gulp from 'gulp';
2+
import runSequence from 'run-sequence';
23

3-
gulp.task('run', [
4-
'build',
5-
'watch',
6-
'connect',
7-
]);
4+
gulp.task('run', (callback) => {
5+
runSequence(
6+
'build',
7+
['watch', 'connect'],
8+
callback
9+
);
10+
});

tasks/watch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ gulp.task('watch', [
1010
]);
1111

1212
gulp.task('watch:script', () => {
13-
compileScript(true, config.watch.script.example);
1413
compileScript(true, config.watch.script.build, () => {
1514
gulp.start('lint:script');
1615
});
16+
compileScript(true, config.watch.script.example);
1717
});
1818

1919
gulp.task('watch:style', () => {

0 commit comments

Comments
 (0)