How to override third party default styles using Styled Components

UnluckyLAD

I'm currently using VideoPlayer from react-video-js-player and I'm trying to override the default height/width styles to have the video inherit the parents height/width.

Since VideoPlayer is simply React wrapper for VideoJS. I assume the styles and class names are the same. I tried doing something like this:

import VideoPlayer from "react-video-js-player"

export const VideoJS = styled(VideoPlayer)`
position: relative;
height: 100%;
`

Setting the height and width to be 100% in the props doesn't work

   <VideoPlayer
       controls="true"
       height={"100%}
       width={"100%"}
       src="examplevideo"
   />
. 

the parent container is set to 100% width and height. Any ideas?

سعيد

I would do something like this , first inspect the video player element in browser to know what is its wrapper, let's say its a div . you can do something like this :

export const VideoPlayerWrapper= styled.div`
   >div{
   //this will target the videoPlayerwrapper 
   position: relative;
   height: 100%;
   }
`

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to create shared styles using styled components?

Apply styled component style to a third party components

How to apply styles to multiple components using styled components

How to extend Link and NavLink with same styles using Styled Components

How to use third party components

Best way to override child styles in styled-components

Remove / Override default styles from materialui components

How to do overlapping styles with Styled Components React?

How to override MUI PaperProps with styled components?

How to override CSS class with Styled-Components

Styled components not applying styles

How to merge 2 third party components in VueJS

Override default_manager of third party app (Django)

How to add styles using styled-components to programatically created heading with dynamic level?

How to override scoped styles in Vue components?

Overwriting nested styles in React Bootstrap using Styled-Components

How to import Ant Design css styles in GlobalStyles of styled-components.?

How to add multiple styles based on property with styled-components?

styled-components - how to set styles on html or body tag?

Where to put styled components styles

Override JS in third party webpage using Selenium C#

How to reference third party library's attrs in styles.xml?

How can I override ExpansionPanelSummary deep elements with styled-components?

Style override in react styled components

I try to override materialUI inbuilt classes using CSS file, styles are applying all the components in React how to stop overriding styles globally?

React styled-components not applying styles to components

How to refer to other Styled Components when using MUI styled function and Styled Components?

How to create an Arrow using styled-components

How to style react styled components using classNames