From 6aabbde781d2a355d1d9eccf52ccb0bce211deb3 Mon Sep 17 00:00:00 2001 From: webmiraclepro Date: Wed, 3 Aug 2016 12:44:56 +0800 Subject: [PATCH] Add style prop Resolves https://github.com/CookPete/react-player/issues/92 --- README.md | 3 ++- src/ReactPlayer.js | 1 + src/props.js | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 89c5e6d..adcf672 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,8 @@ Prop | Description | Default `volume` | Sets the volume of the appropriate player | `0.8` `width` | Sets the width of the player | `640` `height` | Sets the height of the player | `360` -`className` | Pass in a `className` to set on the top level element +`className` | Pass in a `className` to set on the root element +`style` | Add [inline styles](https://facebook.github.io/react/tips/inline-styles.html) to the root element `progressFrequency` | The time between `onProgress` callbacks, in milliseconds | `1000` #### Callback props diff --git a/src/ReactPlayer.js b/src/ReactPlayer.js index 774ca66..e45ee21 100644 --- a/src/ReactPlayer.js +++ b/src/ReactPlayer.js @@ -89,6 +89,7 @@ export default class ReactPlayer extends Component { } render () { const style = { + ...this.props.style, width: this.props.width, height: this.props.height } diff --git a/src/props.js b/src/props.js index ab7041d..86b551f 100644 --- a/src/props.js +++ b/src/props.js @@ -9,6 +9,7 @@ export const propTypes = { width: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]), height: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]), className: PropTypes.string, + style: PropTypes.object, progressFrequency: PropTypes.number, soundcloudConfig: PropTypes.shape({ clientId: PropTypes.string