Skip to content

Commit c51e443

Browse files
committed
#24 Remove pure-render-mixin and use React 15 in demo
1 parent b5d09ed commit c51e443

File tree

7 files changed

+30
-23
lines changed

7 files changed

+30
-23
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ Include `dist/ReactHtml5Video.css` if you do not want to build your own CSS. Alt
1818
### Peer Dependencies
1919

2020
This component uses ES2015 and needs to be transpiled using something like [babel-loader](https://github.com/babel/babel-loader). You will also need to either [polyfill](https://babeljs.io/docs/usage/polyfill/) or use [babel-runtime](https://www.npmjs.com/package/babel-runtime). It depends on:
21-
22-
23-
21+
- `react@>=0.14.x`
2422
- `lodash.throttle@latest`.
2523

2624
### UMD

demo/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
"dependencies": {
1313
"css-reset": "git+https://github.com/60frames/css-reset.git",
1414
"lodash.throttle": "^3.0.4",
15-
"react": "^0.14.0",
16-
"react-addons-pure-render-mixin": "^0.14.0",
17-
"react-dom": "^0.14.0"
15+
"react": "^15.0.0",
16+
"react-dom": "^15.0.0"
1817
},
1918
"devDependencies": {
2019
"babel-core": "^5.8.25",

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
},
2222
"license": "MIT",
2323
"dependencies": {
24-
"lodash.throttle": "^3.0.4",
25-
"react-addons-pure-render-mixin": "^0.14.0"
24+
"lodash.throttle": "^3.0.4"
2625
},
2726
"devDependencies": {
2827
"babel-core": "^5.8.25",
@@ -45,8 +44,7 @@
4544
"react-dom": "^0.14.0"
4645
},
4746
"peerDependencies": {
48-
"react": ">=0.14.0",
49-
"react-dom": ">=0.14.0"
47+
"react": ">=0.14.0"
5048
},
5149
"keywords": [
5250
"react-component",

src/components/controls/seek/Seek.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
32
import ProgressBar from './../../progressbar/progressbar';
43

54
var Seek = React.createClass({
@@ -22,6 +21,19 @@ var Seek = React.createClass({
2221
};
2322
},
2423

24+
/**
25+
* As controls receive all props for extensibility, we do a quick
26+
* check and make sure only the props we care about have changed.
27+
* @param {object} nextProps The next props from parent
28+
* @return {boolean} Whether we re-render or not
29+
*/
30+
shouldComponentUpdate(nextProps) {
31+
return this.props.seek !== nextProps.seek ||
32+
this.props.percentageBuffered !== nextProps.percentageBuffered ||
33+
this.props.percentagePlayed !== nextProps.percentagePlayed ||
34+
this.props.duration !== nextProps.duration;
35+
},
36+
2537
/**
2638
* Calculates the seek time based on change of input.
2739
* @param {object} e Event object

src/components/controls/time/Time.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ var Time = React.createClass({
88
duration: React.PropTypes.number
99
},
1010

11+
/**
12+
* As controls receive all props for extensibility, we do a quick
13+
* check and make sure only the props we care about have changed.
14+
* @param {object} nextProps The next props from parent
15+
* @return {boolean} Whether we re-render or not
16+
*/
17+
shouldComponentUpdate(nextProps) {
18+
return this.props.currentTime !== nextProps.currentTime ||
19+
this.props.duration !== nextProps.duration;
20+
},
21+
1122
/**
1223
* Formats time into a friendlier format
1324
* @param {number} seconds Time in seconds

src/components/video/Video.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
32
import Overlay from './overlay/overlay';
43
import Controls from './../controls/controls';
54
import Seek from './../controls/seek/seek';
65
import Play from './../controls/play/play';
76
import Mute from './../controls/mute/mute';
87
import Fullscreen from './../controls/fullscreen/fullscreen';
98
import Time from './../controls/time/time';
10-
import PureRenderMixin from 'react-addons-pure-render-mixin';
119
import throttle from 'lodash.throttle';
1210
import copy from './../../assets/copy';
1311

@@ -50,8 +48,6 @@ var Video = React.createClass({
5048
controls: React.PropTypes.bool
5149
},
5250

53-
mixins: [PureRenderMixin],
54-
5551
getDefaultProps() {
5652
return {
5753
copyKeys: copy

webpack.config.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@ module.exports = {
1515
commonjs2: 'react',
1616
commonjs: 'react',
1717
amd: 'react'
18-
},
19-
'react-dom': {
20-
root: 'ReactDOM',
21-
commonjs2: 'react-dom',
22-
commonjs: 'react-dom',
23-
amd: 'react-dom'
24-
},
25-
'react-addons-pure-render-mixin': 'react-addons-pure-render-mixin'
18+
}
2619
}],
2720
output: {
2821
path: './dist',

0 commit comments

Comments
 (0)