gpt4 book ai didi

android - 无论如何在 Chrome 版本的 react-native android WebViews 中显示带有标签(#)的 html。 > 72

转载 作者:行者123 更新时间:2023-11-30 05:06:12 25 4
gpt4 key购买 nike

我正在使用带有包含主题标签 (#) 的 html 字符串的 webview。这在 IOS 和 Android 中运行良好,其中 Chrome < version 72。但是,当使用 Chrome >= version 72 时,哈希标记将停止呈现 html。

我已经尝试了标准的 react-native 应用程序(react native 0.57.0)和 create-react-native expo 应用程序(react native 0.57.1​​),它们的行为相同。

import React from "react";
import { View, WebView } from "react-native";

export default class App extends React.Component {
render() {
return (
<View style={{ flex: 1 }}>
<WebView
source={{ html: "<html><body>123#456</body></html>" }}
style={{ width: 200, height: 200, marginTop: 50 }}
/>
</View>
);
}
}

预期结果:123#456

实际结果:123

最佳答案

将 # 替换为 %23 的解决方法似乎适用于我的情况。将跟踪 https://github.com/react-native-community/react-native-webview/issues/298更新。

关于android - 无论如何在 Chrome 版本的 react-native android WebViews 中显示带有标签(#)的 html。 > 72,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54549731/

25 4 0