react-native-render-html
react-native-render-html copied to clipboard
When <strong> tag parent is <a> tag - the render is only Bold text without it been a link as well
Decision Table
- [X] My issue does not look like “The HTML attribute 'xxx' is ignored” (unless we claim support for it)
- [X] My issue does not look like “The HTML element
<yyy>is not rendered”
Good Faith Declaration
- [X] I have read the HELP document here: https://git.io/JBi6R
- [X] I have read the CONTRIBUTING document here: https://git.io/JJ0Pg
- [X] I have confirmed that this bug has not been reported yet
Description
When trying to render tag with parent, I assuming the text inside will be bold link. Instead is just a bold text
code example:
<a href=\"https://google.co.il/" target=\"_blank\" rel=\"nofollow noopener noreferrer\">
<strong>Text</strong>
</a>
React Native Information
"react-native": "0.67.4"
RNRH Version
6.3.4
Tested Platforms
- [X] Android
- [X] iOS
- [ ] Web
- [ ] MacOS
- [ ] Windows
Reproduction Platforms
- [X] Android
- [X] iOS
- [ ] Web
- [ ] MacOS
- [ ] Windows
Minimal, Reproducible Example
code example:
<a href=\"https://google.co.il/" target=\"_blank\" rel=\"nofollow noopener noreferrer\">
<strong>Text</strong>
</a>
Additional Notes
No response
@obiwankenoobi Why are quotes escaped in your snippet?
Hi @jsamr, I work with @obiwankenoobi. That’s a good question regarding the escaping – not sure, we get it like this from the server. But is it relevant to the style issue? Because functionally-wise, the tag does work – the link is recognized
@oferRounds @obiwankenoobi You may try this snippet in AST explorer using htmlparser2 (used by this library) here: https://astexplorer.net/#/2AmVrGuGVJ
You will notice the attributes include quotes, so the URL is evaluated as the following literal: \"https://google.co.il/"; because this is an invalid URI, the renderer does not show the link as clickable. This is all expected.
Notice also that the functionality does work on this case: the text is clickable and the link gets opened correctly, just style is missing
OK, will have a second look at this when I find the time.
Thank you @jsamr!
hi @jsamr just checking if maybe got to have a look on this one? :)