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.

Inline `<a>` tag taking full horizontal width on Web.

See original GitHub issue

Decision Table

  • My issue does not look like “The HTML attribute ‘xxx’ is ignored” (unless we claim support for it)
  • My issue does not look like “The HTML element <yyy> is not rendered”

Good Faith Declaration

Description

In the Older version of RNRH the <code> element use to behave inline but now. it takes the full width of the screen.

I think this change has affected every tag. For example, if you add a link element, it is clickable from empty space on the web.

image In the above image click the far right and it goes to that link on the web.

WEB

Inline Tag expands to the full width of the parent.

React Native Information

System:
    OS: Linux 5.10 Manjaro Linux
    CPU: (16) x64 Intel(R) Core(TM) i7-10870H CPU @ 2.20GHz
    Memory: 363.11 MB / 15.47 GB
    Shell: 5.1.8 - /bin/bash
  Binaries:
    Node: 14.16.0 - /usr/bin/node
    Yarn: Not Found
    npm: 6.14.13 - ~/.npm-globals/bin/npm
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 29, 30
      Build Tools: 29.0.2, 29.0.3, 30.0.3
      System Images: android-29 | Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7351085
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: 4.13.1 => 4.13.1 
    react: ^17.0.2 => 17.0.2 
    react-native: 0.64.1 => 0.64.1 
  npmGlobalPackages:
    *react-native*: Not Found

RNRH Version

V6.0.0-beta.8

Tested Platforms

  • Android
  • iOS
  • Web
  • MacOS
  • Windows

Reproduction Platforms

  • Android
  • iOS
  • Web
  • MacOS
  • Windows

Minimal, Reproducible Example

https://snack.expo.dev/hGHmxvgL7

Additional Notes

I compared the older alpha version of the V6 to the Beta version. There is only one difference that there used to be a wrapping node in DOM around the main tag node but now it’s not there. So Body tags flex:column styling is causing it to expand to full-width.

The structure is like this

 <html-node>
   <body-node>
     <code-node>

previously

 <html-node>
   <body-node>
     <wrapper-node>
       <code-node>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18

github_iconTop GitHub Comments

1reaction
jsamrcommented, Aug 19, 2021

Here it is: https://github.com/meliorence/react-native-render-html/commit/dad450db8d79c85ba8ab4a8d585d889d033d2234 If you have any “lively” question, ping me in our Discord!

PS: a better name for the prop: preserveAnonymousTPhrasingNodes and a description:

/**
* When `true`,  preserve anonymous {@link TPhrasing} nodes parents of lonely {@link TText} nodes at render time instead of bypassing them and rendering their child directly.
*
* @defaultValue `false`
*/
1reaction
parasharrajatcommented, Aug 12, 2021

Another side-effect of that change. Check out the first Inline code block behaving like a code block on Web.

Screen Shot 2021-08-13 at 01 43 47

Read more comments on GitHub >

github_iconTop Results From Across the Web

inline-size - CSS: Cascading Style Sheets - MDN Web Docs
The inline-size CSS property defines the horizontal or vertical size of an element's block, depending on its writing mode.
Read more >
How to spread elements horizontally evenly? - Stack Overflow
Since you're dealing with inline-block, you can't have spaces between the tags (ugly, but it works), otherwise the space will be visible.
Read more >
How to Make Inline-Block Elements Add Up to 100% Width
You have two divs that are displayed inline-block. You set the width of each div to exactly 50%, but the second div falls...
Read more >
CSS Layout - display: inline-block - W3Schools
Compared to display: inline , the major difference is that display: inline-block allows to set a width and height on the element.
Read more >
Exploring the Complexities of Width and Height in CSS
An inline element is an element that's width and height are determined by the content it contains. Inline elements, such as a <span>...
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