From d8df671478105165ca396716a4c8328bc78a70c1 Mon Sep 17 00:00:00 2001 From: Pete Cook Date: Tue, 11 Apr 2017 18:26:37 +0100 Subject: [PATCH] Apply all non-valid props to the wrapper element Fixes https://github.com/CookPete/react-player/issues/167 --- README.md | 2 -- package.json | 1 + src/ReactPlayer.js | 6 ++++-- src/props.js | 2 -- yarn.lock | 4 ++++ 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f1a115aa..673357cb 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,6 @@ Prop | Description | Default `playbackRate` | Sets the playback rate of the appropriate player | `1` `width` | Sets the width of the player | `640` `height` | Sets the height of the player | `360` -`hidden` | Set to `true` to hide the player | `false` -`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` `playsinline` | Applies the `playsinline` attribute where supported | `false` diff --git a/package.json b/package.json index 55008537..5d9f11f3 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ "dependencies": { "fetch-jsonp": "^1.0.2", "load-script": "^1.0.0", + "lodash.omit": "^4.5.0", "prop-types": "^15.5.6", "query-string": "^4.2.3" }, diff --git a/src/ReactPlayer.js b/src/ReactPlayer.js index 7cbed6d4..14d9d41b 100644 --- a/src/ReactPlayer.js +++ b/src/ReactPlayer.js @@ -1,4 +1,5 @@ import React, { Component } from 'react' +import omit from 'lodash.omit' import { propTypes, defaultProps } from './props' import YouTube from './players/YouTube' @@ -123,10 +124,11 @@ export default class ReactPlayer extends Component { ) } render () { - const { style, width, height, className, hidden } = this.props + const { style, width, height } = this.props + const otherProps = omit(this.props, Object.keys(propTypes)) const players = this.renderPlayers() return ( -