Skip to content

Instantly share code, notes, and snippets.

@jportella93
Created September 25, 2020 21:57
Show Gist options
  • Save jportella93/fea3731a24970edb448bf1f073c26bb7 to your computer and use it in GitHub Desktop.
Save jportella93/fea3731a24970edb448bf1f073c26bb7 to your computer and use it in GitHub Desktop.
The magic wrapper to avoid CSS overflow.
const outerWrapperStyle = {
overflow: 'hidden' // Avoid breaking UI
}
const innerWrapperStyle = {
whiteSpace: 'nowrap', // Render text in one line
display: 'block',
overflow: 'auto', // Scroll overflow if needed
}
const OneLineScroller = ({ children }) => (
<span style={outerWrapperStyle}>
<span style={innerWrapperStyle}>
{children}
</span>
</span>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment