如何在TextField中转换HTML?

时间:2019-04-04 12:20:47

标签: react-native

为了显示数据,我将使用“ react-native-render-html”, 但是为了编辑记录,在我的React Native应用程序中,我要提取具有原始HTML元素(例如thishello)的JSON数据。 所以有什么办法可以在文本框内转换HTML文本?
屏幕截图: https://prnt.sc/n7ejbw

1 个答案:

答案 0 :(得分:0)

使用React-native-htmlView 该插件的用法非常简单,即使我已经实现了与下面示例相同的方式

  

此示例来自文档

#!/sbin/sh

OUTFD=1
readlink /proc/$$/fd/$OUTFD 2>/dev/null | grep /tmp >/dev/null
if [ "$?" -eq "0" ]; then
  # rerouted to log file, we don't want our ui_print commands going there
  OUTFD=0

  # we are probably running in embedded mode, see if we can find the right fd
  # we know the fd is a pipe and that the parent updater may have been started as
  # 'update-binary 3 fd zipfile'
  for FD in `ls /proc/$$/fd`; do
    readlink /proc/$$/fd/$FD 2>/dev/null | grep pipe >/dev/null
    if [ "$?" -eq "0" ]; then
      ps | grep " 3 $FD " | grep -v grep >/dev/null
      if [ "$?" -eq "0" ]; then
        OUTFD=$FD
        break
      fi
    fi
  done
fi

ui_print() {
  echo -n -e "ui_print $1\n" >> /proc/self/fd/$OUTFD
  echo -n -e "ui_print\n" >> /proc/self/fd/$OUTFD
}