Skip to content

Commit

Permalink
Add support to control the style of <View> outside of <WebView> (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
maydna authored Oct 9, 2023
1 parent fbe58f4 commit d43c5a9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/props.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@ changing these parameters might cause the player to restart or not change at all

---

### `viewContainerStyle`

A style prop that will be given to the webview container

---

### `webViewStyle`

A style prop that will be given to the webview
Expand Down
4 changes: 4 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ export interface YoutubeIframeProps {
* Sets the volume. Accepts an integer between `0` and `100`.
*/
volume?: number;
/**
* A style prop that will be given to the webview container
*/
viewContainerStyle?: StyleProp<ViewStyle>;
/**
* A style prop that will be given to the webview
*/
Expand Down
3 changes: 2 additions & 1 deletion src/YoutubeIframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const YoutubeIframe = (props, ref) => {
play = false,
mute = false,
volume = 100,
viewContainerStyle,
webViewStyle,
webViewProps,
useLocalHTML,
Expand Down Expand Up @@ -258,7 +259,7 @@ const YoutubeIframe = (props, ref) => {
}, [useLocalHTML, contentScale, baseUrlOverride, allowWebViewZoom]);

return (
<View style={{height, width}}>
<View style={[{height, width}, viewContainerStyle]}>
<WebView
bounces={false}
originWhitelist={['*']}
Expand Down

0 comments on commit d43c5a9

Please sign in to comment.