Skip to content

Commit 8b219ff

Browse files
authored
Fix youtube black screen issue (#831)
1 parent 247830c commit 8b219ff

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

packages/core/src/components/YoutubePlayer/YoutubePlayer.native.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,20 @@ const YoutubePlayer: React.FC<YoutubePlayerProps> = ({
1919
play={autoplay}
2020
videoId={!videoId && !playlist ? defaultVideoId : videoId}
2121
playList={playlist}
22-
webViewStyle={viewStyles}
23-
webViewProps={{ androidLayerType: "software" }} //Addresses a webview bug causing crashes on android: https://stackoverflow.com/a/71642894/8805150
22+
webViewStyle={[
23+
viewStyles,
24+
{
25+
/**
26+
* Addresses a WebView and react-navigation bug that causes apps to crash
27+
* Alternate solution is set `androidLayerType` prop to `"software"`, but that leads to player playing without video
28+
* See:
29+
* https://lonelycpp.github.io/react-native-youtube-iframe/navigation-crash/#change-webview-opacity-to-099-issue-comment
30+
* https://github.com/LonelyCpp/react-native-youtube-iframe/issues/110#issuecomment-779848787
31+
* https://github.com/react-native-webview/react-native-webview/issues/811
32+
*/
33+
opacity: viewStyles.opacity < 0.99 ? viewStyles.opacity : 0.99,
34+
},
35+
]}
2436
/>
2537
);
2638
};

0 commit comments

Comments
 (0)