React native 嵌入youtube url时如何在上设置全屏?

React native 嵌入youtube url时如何在上设置全屏?,react-native,React Native,平台是Android。我经常嵌入youtube视频 <View style={{ height: 240 }}> <WebView style={{ alignSelf: 'stretch' }} scalesPageToFit={true} source={{uri: `https://www.youtube.com/embed/${videoId[0]}?rel=0&autoplay=0&controls=1&am

平台是Android。我经常嵌入youtube视频

  <View style={{ height: 240 }}>
    <WebView
    style={{ alignSelf: 'stretch' }}
    scalesPageToFit={true}
        source={{uri: `https://www.youtube.com/embed/${videoId[0]}?rel=0&autoplay=0&controls=1&showinfo=0`}}
    />
  </View>
我可以看到“放大”按钮,但无法单击

我尝试添加scalesPageToFit={true}on仍然不起作用

使用嵌入youtube url时是否可以放大


任何帮助都将不胜感激。

您可以使用。

您必须将视频嵌入带有属性的iFrame中

allowfullscreen=allowfullscreen
为iFrame提供上述属性,请注意allowfullscreen=true是一个错误的输入。

我已经搜索并找到了AllowFullScreenVideo={true}将其设置为true,以便在WebView中启用全屏

请检查最后的代码

<WebView
    source={{uri: `https://www.youtube.com/embed/${videoId[0]}?rel=0&autoplay=0&controls=1&showinfo=0`}}
    style={{ alignSelf: 'stretch' }}
    allowsFullscreenVideo={true}
    scalesPageToFit={true}
 />

我知道,但我现在明白了问题所在,所以我尝试使用Android。然后你可以使用并将组件设置为横向。然后使用将web视图的高度和宽度设置为屏幕大小。希望它能帮助你。