question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

<Img/> don't show

See original GitHub issue

please: 标签不显示 don’t show

For example: <img style="display: block; margin-left: auto; margin-right: auto;" src="http://static-dev.zhinaer.cn/upload/2018/05/20180525160036112.jpeg?imageView2/2/w/100/h/100/q/75|imageslim" />

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10

github_iconTop GitHub Comments

5reactions
levidurfeecommented, Jun 22, 2018

少停

你的英语很好,比我的中文好得多。我不认识任何中国人。

我希望下面的代码有所帮助。我没有测试过,但请让我知道如果它不起作用,我会再试一次。

import React, { Component } from "react";
import { View, ListView, Image } from "react-native";
import HTMLView from "react-native-htmlview";

class MyComponent extends Component {
  constructor(props) {
    super(props);
    this.state = {
      content: "<img src='https://dummyimage.com/600x400/000/fff' />"
    };
  }

  renderNode(node, index, siblings, parent, defaultRenderer) {
    if (node.name == "img") {
      return (
        <View>
          <Image source={{ uri: node.attribs.src }} />
        </View>
      );
    }
  }

  render() {
    return (
      <View>
        <HTMLView value={this.state.content} renderNode={this.renderNode} />
      </View>
    );
  }
}

Edit: Updated render method to return the view.

Edit: Pass props to construct.

1reaction
pheromonecommented, Feb 19, 2019

@Thyiad 后来我公司没有使用富文本了.所以我就没试了.现在我已经转到flutter了.RN半年没弄了,不好意思.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image is not showing in browser? - html - Stack Overflow
I had a problem where the images would not show and it wasn't the relative path. I even hard coded the actual path...
Read more >
How to fix image not showing in an HTML page
How to fix image not showing in an HTML page · Check the src path to of the <img> tag · Check the...
Read more >
HTML Image Not Showing in Web Browser - FIXED - YouTube
How to fix HTML Image not showing up in the Web Browser using Notepad++. This tutorial will show five different issues that can...
Read more >
HTML Image Not Showing - Position Is Everything
One of the reasons why your HTML image not showing in browser is that its file is not located in the same folder...
Read more >
Why is an image not showing in HTML? - Quora
You do not code in HTML. · But to embedd an image in html you use the img tag · <img> · That...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found