React native iframe未在React Native WebView中显示

React native iframe未在React Native WebView中显示,react-native,React Native,我对React Native很陌生,第一次学习WebView时,我的iframe只是显示为一个空白屏幕。我试着删除iframe html,然后把Hello放进去,它就工作了。我肯定我错过了一些明显的东西 import { StatusBar } from "expo-status-bar"; import React from "react"; import { View, StyleSheet } from "react-native"

我对React Native很陌生,第一次学习WebView时,我的iframe只是显示为一个空白屏幕。我试着删除iframe html,然后把
Hello
放进去,它就工作了。我肯定我错过了一些明显的东西

import { StatusBar } from "expo-status-bar";
import React from "react";
import { View, StyleSheet } from "react-native";
import { WebView } from "react-native-webview";

export default function App() {
  return (
    <WebView
      originWhitelist={["*"]}
      source={{
        html: `<iframe style="width:120px;height:240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ss&ref=as_ss_li_til&ad_type=product_link&tracking_id=lilbocheap0a-20&language=en_US&marketplace=amazon&region=US&placement=B0157T1ZK2&asins=B0157T1ZK2&linkId=6cc99550e828f584b5cb20a067edf5f8&show_border=true&link_opens_in_new_window=true"></iframe>`,
      }}
    />
  );
}

从“世博会状态栏”导入{StatusBar};
从“React”导入React;
从“react native”导入{View,StyleSheet};
从“react native WebView”导入{WebView};
导出默认函数App(){
返回(
);
}

您缺少
https
请将其添加到uri中,如下所示:

import { StatusBar } from "expo-status-bar";
import React from "react";
import { View, StyleSheet } from "react-native";
import { WebView } from "react-native-webview";

export default function App() {
  return (
    <WebView
      originWhitelist={["*"]}
      source={{
      html: `<iframe style="width:120px;height:240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" 
      src="https://ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ss&ref=as_ss_li_til&ad_type=product_link&tracking_id=lilbocheap0a-20&language=en_US&marketplace=amazon&region=US&placement=B0157T1ZK2&asins=B0157T1ZK2&linkId=6cc99550e828f584b5cb20a067edf5f8&show_border=true&link_opens_in_new_window=true"></iframe>`,
   }}
  />
 );
}
从“世博会状态栏”导入{StatusBar};
从“React”导入React;
从“react native”导入{View,StyleSheet};
从“react native WebView”导入{WebView};
导出默认函数App(){
返回(
);
}

您缺少
https
请将其添加到uri中,如下所示:

import { StatusBar } from "expo-status-bar";
import React from "react";
import { View, StyleSheet } from "react-native";
import { WebView } from "react-native-webview";

export default function App() {
  return (
    <WebView
      originWhitelist={["*"]}
      source={{
      html: `<iframe style="width:120px;height:240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" 
      src="https://ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ss&ref=as_ss_li_til&ad_type=product_link&tracking_id=lilbocheap0a-20&language=en_US&marketplace=amazon&region=US&placement=B0157T1ZK2&asins=B0157T1ZK2&linkId=6cc99550e828f584b5cb20a067edf5f8&show_border=true&link_opens_in_new_window=true"></iframe>`,
   }}
  />
 );
}
从“世博会状态栏”导入{StatusBar};
从“React”导入React;
从“react native”导入{View,StyleSheet};
从“react native WebView”导入{WebView};
导出默认函数App(){
返回(
);
}

您缺少
https:
src属性。哦,我的天哪,这很有效。我觉得自己很愚蠢,但很高兴我掌握了这些概念,只是错过了一些简单的东西。万分感谢!您缺少
https:
src属性。哦,我的天哪,这很有效。我觉得自己很愚蠢,但很高兴我掌握了这些概念,只是错过了一些简单的东西。万分感谢!