Skip to content

Commit d43c5a9

Browse files
authored
Add support to control the style of <View> outside of <WebView> (#237)
1 parent fbe58f4 commit d43c5a9

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

docs/props.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,12 @@ changing these parameters might cause the player to restart or not change at all
273273

274274
---
275275

276+
### `viewContainerStyle`
277+
278+
A style prop that will be given to the webview container
279+
280+
---
281+
276282
### `webViewStyle`
277283

278284
A style prop that will be given to the webview

index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ export interface YoutubeIframeProps {
8888
* Sets the volume. Accepts an integer between `0` and `100`.
8989
*/
9090
volume?: number;
91+
/**
92+
* A style prop that will be given to the webview container
93+
*/
94+
viewContainerStyle?: StyleProp<ViewStyle>;
9195
/**
9296
* A style prop that will be given to the webview
9397
*/

src/YoutubeIframe.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const YoutubeIframe = (props, ref) => {
3333
play = false,
3434
mute = false,
3535
volume = 100,
36+
viewContainerStyle,
3637
webViewStyle,
3738
webViewProps,
3839
useLocalHTML,
@@ -258,7 +259,7 @@ const YoutubeIframe = (props, ref) => {
258259
}, [useLocalHTML, contentScale, baseUrlOverride, allowWebViewZoom]);
259260

260261
return (
261-
<View style={{height, width}}>
262+
<View style={[{height, width}, viewContainerStyle]}>
262263
<WebView
263264
bounces={false}
264265
originWhitelist={['*']}

0 commit comments

Comments
 (0)