Only half width of an img is being clickable if placed under <a/> tag of html
Dheeeraj opened this issue · 5 comments
Dheeeraj commented
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
banli17 commented
+1
banli17 commented
if (node.name == "img") {
return (
<Image key={index} source={{uri: node.attribs.src}} style={{width: WinWidth,height:WinHeight}}/>
);
}
but half width of window
banli17 commented
i use react-native-render-html last
nikita-khrustalev commented
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" }}
/>
// !!!!!!!
</Text>
withwz commented
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}
/>
`