jsdf/react-native-htmlview

Only half width of an img is being clickable if placed under <a/> tag of html

Dheeeraj opened this issue · 5 comments

if i place an img tag inside a tag of my html only 50% of img width is being clickable i tried with different widths still no change only half of it is getting clickable

+1

if (node.name == "img") {
            return (
                <Image key={index} source={{uri: node.attribs.src}} style={{width: WinWidth,height:WinHeight}}/>
            );
        }

but half width of window

i use react-native-render-html last

it works for me

<Text
          key={index}
          onPress={() =>
            this.clickImage(node.attribs.src)
          }
        >
          <Image
            source={{ uri: node.attribs.src}}
            style={{ width: 100, height: 100, resizeMode: "cover" }}
          />
          &nbsp; // !!!!!!!
</Text>

like this,i have resolve
add a

`
<HTMLView
renderNode={(node: HTMLViewNode, idx) => {
if (node.name == 'img') {
const a = node.attribs;
return (

<Image
resizeMode="cover"
style={{
resizeMode: 'cover',
width: mpx(20),
height: mpx(20),
}}
source={{uri: a.src}}
/>

);
}
}}
value={messageBody?.text as string}
/>

`