标签: react-native-render-html

react-native-render-html:“你似乎在短时间内更新了 Y 组件的 X 属性......”

备注:我是 的作者react-native-render-html。此问题出于教育目的,符合 StackOverflow 政策

我在组件RenderHtml中渲染组件,WebDisplay如下所示:

import * as React from 'react';
import {ScrollView, StyleSheet, Text, useWindowDimensions} from 'react-native';
import RenderHtml from 'react-native-render-html';

const html = '<div>Hello world!</div>';

function WebDisplay({html}) {
  const {width: contentWidth} = useWindowDimensions();
  const tagsStyles = {
    a: {
      textDecorationLine: 'none',
    },
  };
  return (
    <RenderHtml
      contentWidth={contentWidth}
      source={{html}}
      tagsStyles={tagsStyles}
    />
  );
}

export default function App() {
  const [isToastVisible, setIsToastVisible] = React.useState(false);
  React.useEffect(function flipToast() {
    const timeout = setTimeout(() => …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-render-html

32
推荐指数
1
解决办法
2万
查看次数

react-native-render-html FontFamily 属性不起作用

今天我尝试使用这个库在我的 React Native 应用程序中渲染原始 html。这是我的代码:

\n
import HTML from "react-native-render-html";\nconst htmlContent = `\n<div class="page" title="Page 5">\n<div class="layoutArea">\n<div class="column">\n<p><span style="font-size: 11.000000pt; font-family: 'TimesNewRomanPSMT';">Ch&acirc;\xcc\x81t X (C</span><span style="font-size: 7.000000pt; font-family: 'TimesNewRomanPSMT'; vertical-align: -1.000000pt;">x</span><span style="font-size: 11.000000pt; font-family: 'TimesNewRomanPSMT';">H</span><span style="font-size: 7.000000pt; font-family: 'TimesNewRomanPSMT'; vertical-align: -1.000000pt;">y</span><span style="font-size: 11.000000pt; font-family: 'TimesNewRomanPSMT';">O</span><span style="font-size: 7.000000pt; font-family: 'TimesNewRomanPSMT'; vertical-align: -1.000000pt;">4</span><span style="font-size: 11.000000pt; font-family: 'TimesNewRomanPSMT';">N</span><span style="font-size: 7.000000pt; font-family: 'TimesNewRomanPSMT'; vertical-align: -1.000000pt;">2</span><span style="font-size: 11.000000pt; font-family: 'TimesNewRomanPSMT';">) la\xcc\x80 mu&ocirc;\xcc\x81i amoni cu\xcc\x89a axit cacboxylic \xc4\x91a ch\xc6\xb0\xcc\x81c; ch&acirc;\xcc\x81t Y (C</span><span style="font-size: 7.000000pt; font-family: 'TimesNewRomanPSMT'; vertical-align: …
Run Code Online (Sandbox Code Playgroud)

html fonts react-native react-native-render-html

8
推荐指数
2
解决办法
1万
查看次数

使用 &lt;HTML /&gt; 渲染 iframe 时,Android 在导航回堆栈屏幕时崩溃

当在 中启用屏幕react-native-screens,并且有一个屏幕呈现一个<HTML />通过iframeHTML 元素传递的组件时,应用程序会在按下后退按钮返回主屏幕时崩溃。完整再现这里

环境

  • 反应本机:0.61.5
  • 反应原生渲染 html:4.2.2
  • react-native-webview: 10.3.2
  • 反应原生屏幕:2.8.0
  • react-native-render-html-table-bridge: 0.6.1

崩溃日志

07-29 17:41:49.173  6901  6901 F crashpad: dlopen: dlopen failed: library "libandroidicu.so" not found: needed by /system/lib/libharfbuzz_ng.so in namespace (default)
--------- beginning of crash
07-29 17:41:49.176  6410  6441 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x1c in tid 6441 (RenderThread), pid 6410 (com.newmednav)
07-29 17:41:49.340  6904  6904 F DEBUG   : *** *** *** *** …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-render-html

5
推荐指数
3
解决办法
2016
查看次数

如何在按下链接时打开浏览器?

我正在使用 4.2.2 版本react-native-render-html。鉴于以下片段:

# App.js
import React from 'react';
import HTML from 'react-native-render-html';

export default function App() {
    return (
        <HTML html='<a href="https://duckduckgo.com/">A Link To Press</a>' />
    );
}
Run Code Online (Sandbox Code Playgroud)

我希望当我按下链接时网络浏览器会打开,但什么也没有发生。

react-native-render-html

3
推荐指数
1
解决办法
3190
查看次数

在react-native-render-html自定义渲染器中提取原始HTML

我正在使用react-native-render-html 来渲染html。该renderers方法允许我提供自定义函数来呈现特定标签。不过,我想使用源代码中的原始内部 HTML 将子组件替换为我的自定义组件。

考虑。我向组件提供了以下 html 片段<HTML />

<a> <b> <c meta="xyz"> Some text </c> <b> </a>
Run Code Online (Sandbox Code Playgroud)

我有一个自定义渲染器,它返回一个接受 html 字符串的组件,并用它做了一些魔法:

const renderers = {
  c: () => (
    <Custom html={/** how do I get "<c meta="xyz"> Some text </c>"? */} />
  )
}
Run Code Online (Sandbox Code Playgroud)

react-native-render-html

2
推荐指数
1
解决办法
5920
查看次数