Html标记与React Native中的内容一起呈现。尝试使用WebView,但出现错误

Html标记与React Native中的内容一起呈现。尝试使用WebView,但出现错误,html,react-native,render,Html,React Native,Render,我正在为我的react本机应用程序使用expo。在我的React本机应用程序中进行API调用后,我正在呈现内容。但是所有的HTML标记也会被呈现出来。以下是我在没有webview的情况下的初始代码: import React, { useState, useEffect } from 'react'; import { View, Text, StyleSheet, ScrollView } from 'react-native'; const App = () => { const

我正在为我的react本机应用程序使用expo。在我的React本机应用程序中进行API调用后,我正在呈现内容。但是所有的HTML标记也会被呈现出来。以下是我在没有webview的情况下的初始代码:

import React, { useState, useEffect } from 'react';
import { View, Text, StyleSheet, ScrollView } from 'react-native';

const App = () => {
  const [posts, setPosts] = useState([]);

  useEffect(() => {
    fetch("http://172.27.13.38/api/1?position=1.1")
      .then((response) => response.json())
      .then((json) => setPosts(json.field_gita_2_text.content))
      .catch((error) => console.log(error));
  });

  return (
    <View style={styles.container}>
      <ScrollView>{posts.length ? <Text>{posts}</Text> : null}</ScrollView>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    padding: 80,
    justifyContent: 'center',
    alignItems: 'center',
  },
});

export default App;
import React,{useState,useffect}来自“React”;
从“react native”导入{View,Text,StyleSheet,ScrollView};
常量应用=()=>{
const[posts,setPosts]=useState([]);
useffect(()=>{
取回(“http://172.27.13.38/api/1?position=1.1")
.then((response)=>response.json())
.then((json)=>setPosts(json.field\u gita\u 2\u text.content))
.catch((错误)=>console.log(错误));
});
返回(
{posts.length?{posts}:null}
);
};
const styles=StyleSheet.create({
容器:{
填充:80,
为内容辩护:“中心”,
对齐项目:“居中”,
},
});
导出默认应用程序;
这将使用html标记呈现我的内容

然后我尝试使用WebView呈现html:

{posts.length ? <WebView  source={{html : {posts}}} : null/>} 
{posts.length?}
但这会引发错误:无法将html的值从ReadableNativeMap转换为字符串