Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type for wrapper in base.d.ts #1234

Merged
merged 1 commit into from
Oct 26, 2021
Merged

Add type for wrapper in base.d.ts #1234

merged 1 commit into from
Oct 26, 2021

Conversation

Sky161
Copy link
Contributor

@Sky161 Sky161 commented May 19, 2021

No description provided.

@cookpete cookpete merged commit cef2e75 into cookpete:master Oct 26, 2021
@cookpete
Copy link
Owner

Published in 2.10.0

@alessandroliveri
Copy link

@cookpete does this mean that wrapper is not supposed to support string anymore?

@rhwinter
Copy link

rhwinter commented Jun 8, 2024

Hi there @cookpete,
isn't the wrapper prop missing some stuff:
https://github.com/cookpete/react-player/blob/master/src/ReactPlayer.js#L175
?

As an example when I do something like

import ReactPlayer from "react-player";
...
<ReactPlayer
    ...
    wrapper={({ children, style }) => <div style={style}>{children}</div>}
/>

I get a Typescript error:

Property 'style' does not exist on type '{ children: ReactNode; }'.ts(2339)

In the code I see that <Wrapper> is:

<Wrapper ref={wrapperRef} style={{ ...style, width, height }} {...attributes}>

I don't know about the other things (ref and {...attributes}), but style should be CSSProperties, right?

So in types/base.d.ts there could be something like:

@@ -39,7 +39,7 @@ export interface BaseReactPlayerProps {
  stopOnUnmount?: boolean
  light?: boolean | string | ReactElement
  fallback?: ReactElement
- wrapper?: ComponentType<{children: ReactNode>
+ wrapper?: ComponentType<{children: ReactNode, style: CSSProperties}>
  onReady?: (player: ReactPlayer) => void
  onStart?: () => void
  onPlay?: () => void

Should I make a pull request for this?

Thanks a lot for the amazing component!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants