Skip to content

Commit

Permalink
make sure all decorators pass props through
Browse files Browse the repository at this point in the history
  • Loading branch information
souporserious committed Apr 20, 2016
1 parent f445dbf commit e1f9be5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/decorators/with-keyboard-controls.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component, PropTypes, createElement } from 'react'
import React, { Component } from 'react'
import withMediaProps from './with-media-props'

const MEDIA_KEYS = [0, 'f', 'j', 'k','l', ',', '.', ' ', 'Home', 'End', 'ArrowLeft', 'ArrowTop', 'ArrowRight', 'ArrowDown']
Expand Down Expand Up @@ -90,10 +90,12 @@ export default function withKeyboardControls(MediaPlayer) {
}

render() {
return createElement(MediaPlayer, {
...this.props,
keyboardControls: this._handlekeyboardControls
})
return (
<MediaPlayer
{...this.props}
keyboardControls={this._handlekeyboardControls}
/>
)
}
})
}
2 changes: 1 addition & 1 deletion src/decorators/with-media-player.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function withMediaPlayer(MediaPlayer, vendor) {
return (
<Media vendor={vendor} src={src}>
{ Player =>
<MediaPlayer Player={Player} vendor={vendor} src={src}/>
<MediaPlayer {...this.props} Player={Player}/>
}
</Media>
)
Expand Down
2 changes: 1 addition & 1 deletion src/decorators/with-media-props.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function withMediaProps(MediaComponent) {

render() {
return (
<MediaComponent media={{...this.context}} {...this.props}/>
<MediaComponent {...this.props} media={{...this.context}}/>
)
}
}
Expand Down

0 comments on commit e1f9be5

Please sign in to comment.