Skip to content

Commit 7964088

Browse files
committed
update to React 16
1 parent c376987 commit 7964088

File tree

8 files changed

+73
-57
lines changed

8 files changed

+73
-57
lines changed

.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"presets": ["es2015", "stage-0", "react"]
2+
"presets": ["env", "stage-0", "react"]
33
}

example/components/CustomWidget.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from 'react';
2+
import PropTypes from 'prop-types';
23
import SoundCloud from '../../';
34

45
export default class CustomWidget extends React.Component {
56
static propTypes = {
6-
url: React.PropTypes.string.isRequired,
7-
id: React.PropTypes.string.isRequired,
8-
opts: React.PropTypes.array.isRequired,
7+
url: PropTypes.string.isRequired,
8+
id: PropTypes.string.isRequired,
9+
opts: PropTypes.array.isRequired,
910
};
1011

1112
componentDidUpdate() {

example/components/OptionsInput.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import React from 'react';
2+
import PropTypes from 'prop-types';
23
import {
34
TextField,
45
} from 'material-ui';
56

67
export default class OptionsInput extends React.Component {
78
static propTypes = {
8-
default: React.PropTypes.string.isRequired,
9-
type: React.PropTypes.string.isRequired,
10-
onChange: React.PropTypes.func.isRequired,
9+
default: PropTypes.string.isRequired,
10+
type: PropTypes.string.isRequired,
11+
onChange: PropTypes.func.isRequired,
1112
};
1213

1314
onSubmit(event) {

example/components/OptionsTable.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import PropTypes from 'prop-types';
23
import {
34
Table,
45
TableHeader,
@@ -10,8 +11,8 @@ import {
1011

1112
export default class OptionsTable extends React.Component {
1213
static propTypes = {
13-
opts: React.PropTypes.array.isRequired,
14-
onChange: React.PropTypes.func.isRequired,
14+
opts: PropTypes.array.isRequired,
15+
onChange: PropTypes.func.isRequired,
1516
};
1617

1718
onRowSelection(selectedIndices) {

package.json

+30-20
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "react-soundcloud-widget",
3-
"version": "2.0.4",
3+
"version": "2.1.1",
44
"description": "react.js powered SoundCloud player component",
55
"main": "dist/SoundCloud.js",
66
"repository": {
77
"type": "git",
8-
"url": "https://github.com/troybetz/react-soundcloud-widget.git"
8+
"url": "https://github.com/nthall/react-soundcloud-widget.git"
99
},
1010
"keywords": [
1111
"soundcloud",
@@ -15,38 +15,48 @@
1515
"react-component"
1616
],
1717
"author": "troy betz",
18+
"contributors": [
19+
{
20+
"name": "Noah Hall",
21+
"email": "[email protected]"
22+
}
23+
],
1824
"license": "MIT",
1925
"bugs": {
20-
"url": "https://github.com/troybetz/react-soundcloud-widget/issues"
26+
"url": "https://github.com/nthall/react-soundcloud-widget/issues"
2127
},
22-
"homepage": "https://github.com/troybetz/react-soundcloud-widget",
28+
"homepage": "https://github.com/nthall/react-soundcloud-widget",
2329
"dependencies": {
2430
"load-script": "^1.0.0"
2531
},
2632
"devDependencies": {
2733
"babel-cli": "^6.2.0",
2834
"babel-core": "^6.2.1",
29-
"babel-eslint": "^4.1.3",
30-
"babel-loader": "^6.2.0",
31-
"babel-preset-es2015": "^6.1.18",
35+
"babel-eslint": "^8.2.0",
36+
"babel-loader": "^7.1.0",
37+
"babel-preset-env": "^1.6.0",
3238
"babel-preset-react": "^6.1.18",
3339
"babel-preset-stage-0": "^6.1.18",
34-
"eslint": "^1.7.3",
35-
"eslint-config-airbnb": "^0.1.0",
36-
"eslint-plugin-react": "^3.6.3",
37-
"expect": "^1.12.2",
38-
"jsdom": "^7.0.2",
39-
"material-ui": "^0.13.3",
40-
"mocha": "^2.3.3",
40+
"eslint": "^4.16.0",
41+
"eslint-config-airbnb": "^16.1.0",
42+
"eslint-plugin-import": "^2.8.0",
43+
"eslint-plugin-jsx-a11y": "^6.0.3",
44+
"eslint-plugin-react": "^7.0.0",
45+
"expect": "^1.2.0",
46+
"jsdom": "^11.6.0",
47+
"material-ui": "^0.20.0",
48+
"mocha": "^5.0.0",
49+
"prop-types": "^15.6.0",
4150
"proxyquire": "^1.7.3",
42-
"react": "^0.14.0",
43-
"react-addons-test-utils": "^0.14.0",
44-
"react-dom": "^0.14.0",
45-
"react-tap-event-plugin": "^0.2.1",
46-
"webpack": "^1.12.8"
51+
"raf": "^3.4.0",
52+
"react": "^16.2.0",
53+
"react-dom": "^16.2.0",
54+
"react-tap-event-plugin": "^3.0.0",
55+
"react-test-renderer": "^16.2.0",
56+
"webpack": "^3.10.0"
4757
},
4858
"peerDependencies": {
49-
"react": ">=0.13.0"
59+
"react": ">=15.5.0"
5060
},
5161
"scripts": {
5262
"test": "mocha",

src/SoundCloud.js

+23-22
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44

55
import React from 'react';
6+
import PropTypes from 'prop-types';
67
import createWidget from './lib/createWidget';
78

89
/**
@@ -125,37 +126,37 @@ class SoundCloud extends React.Component {
125126
SoundCloud.propTypes = {
126127
// url to play. It's kept in sync, changing it will
127128
// cause the widget to refresh and play the new url.
128-
url: React.PropTypes.string.isRequired,
129+
url: PropTypes.string.isRequired,
129130

130131
// custom ID for widget iframe element
131-
id: React.PropTypes.string,
132+
id: PropTypes.string,
132133

133-
height: React.PropTypes.oneOfType([
134-
React.PropTypes.string,
135-
React.PropTypes.number,
134+
height: PropTypes.oneOfType([
135+
PropTypes.string,
136+
PropTypes.number,
136137
]),
137138

138139
// widget parameters: appearance, auto play, and callback for SC.Widget.load()
139-
opts: React.PropTypes.shape({
140-
auto_play: React.PropTypes.bool,
141-
visual: React.PropTypes.bool,
142-
buying: React.PropTypes.bool,
143-
liking: React.PropTypes.bool,
144-
download: React.PropTypes.bool,
145-
sharing: React.PropTypes.bool,
146-
show_artwork: React.PropTypes.bool,
147-
show_comments: React.PropTypes.bool,
148-
show_playcount: React.PropTypes.bool,
149-
show_user: React.PropTypes.bool,
150-
show_reposts: React.PropTypes.bool,
151-
hide_related: React.PropTypes.bool,
152-
callback: React.PropTypes.func
140+
opts: PropTypes.shape({
141+
auto_play: PropTypes.bool,
142+
visual: PropTypes.bool,
143+
buying: PropTypes.bool,
144+
liking: PropTypes.bool,
145+
download: PropTypes.bool,
146+
sharing: PropTypes.bool,
147+
show_artwork: PropTypes.bool,
148+
show_comments: PropTypes.bool,
149+
show_playcount: PropTypes.bool,
150+
show_user: PropTypes.bool,
151+
show_reposts: PropTypes.bool,
152+
hide_related: PropTypes.bool,
153+
callback: PropTypes.func
153154
}),
154155

155156
// event subscriptions
156-
onPlay: React.PropTypes.func,
157-
onPause: React.PropTypes.func,
158-
onEnd: React.PropTypes.func,
157+
onPlay: PropTypes.func,
158+
onPause: PropTypes.func,
159+
onEnd: PropTypes.func,
159160
};
160161

161162
SoundCloud.defaultProps = {

test/helpers/render.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import expect from 'expect';
66
import proxyquire from 'proxyquire';
77
import React from 'react';
88
import ReactDOM from 'react-dom';
9-
import TestUtils from 'react-addons-test-utils';
9+
import ReactTestUtils from 'react-dom/test-utils';
10+
import ShallowRenderer from 'react-test-renderer/shallow';
1011

1112
/**
1213
* Stub out SoundCloud
@@ -38,7 +39,7 @@ function setup() {
3839
export function render(props) {
3940
const { SoundCloud } = setup();
4041

41-
const renderer = TestUtils.createRenderer();
42+
const renderer = new ShallowRenderer();
4243
renderer.render(React.createElement(SoundCloud, props));
4344

4445
const output = renderer.getRenderOutput();
@@ -82,9 +83,9 @@ export function renderDOM(props) {
8283
}
8384
}
8485

85-
const div = document.createElement('div');
86+
const div = window.document.createElement('div');
8687
const container = ReactDOM.render(<Container { ...props } />, div);
87-
const output = TestUtils.findRenderedComponentWithType(container, SoundCloud);
88+
const output = ReactTestUtils.findRenderedComponentWithType(container, SoundCloud);
8889

8990
function rerender(newProps = {}) {
9091
container.setState(newProps);

test/helpers/setup.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
* Module dependencies
33
*/
44

5-
import { jsdom } from 'jsdom';
5+
import jsdom from 'jsdom/lib/old-api.js';
6+
import 'raf/polyfill';
67

7-
global.document = jsdom('<!doctype html><html><body></body></html>');
8+
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
89
global.window = document.defaultView;
910
global.navigator = global.window.navigator;

0 commit comments

Comments
 (0)