-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StyleSheet: word-break property to wrap long continuous strings #760
Comments
You app doesn't load. Please can you create a simple test case from the glitch demo included in the issue template |
Going to close this if there's no update soon |
Please can you make a reduced test case on glitch |
In case its of help, as it seems related, I had problems with getting a deeply nested |
What's an example of code that produces the issue? |
@necolas it appears a single long string that doesn't have spaces causes this issue. |
I'm just asking for someone to provide a reduced test case on codesandbox, as is mentioned as being required in the issue template. Help me to help you. |
Hi @necolas, I'm seeing this issue now, though I could just be using Flexbox incorrectly. Here's a reduced case (I could reduce it a bit more, but this shows the Flexbox context I'm operating in): https://codesandbox.io/embed/7wlorrx3p1 |
Update: This SO question pointed me to the answer: Fixed reduced case: https://codesandbox.io/embed/7wlorrx3p1 |
@airandfingers that is not the issue. I think just by reading it is pretty easy to understand. It's the long words that does not break and goes off the screen. |
to replicate the issue put this component in render |
It's too easy to understand, our brains are just too complicated. |
So |
This issue should be reopen. There should be a way to specify Currently our workaround is a bit troublesome and goes like this:
[word-break="break-word"] {
word-break: break-word;
}
const viewRef = useRef<View>(null);
useEffect(() => {
if (Platform.OS !== "web" || !containerRef.current) return;
viewRef.current.setNativeProps({ ["word-break"]: "break-word" });
}, [viewRef]);
return (
<View ref={viewRef}>...</View>
); |
Or you can simply add |
1.Add global <style> to our index.html with the following:
|
Do you want to request a feature or report a bug?
Both.
What is the current behavior?
I have a very long string that I need to wrap to multiple lines, but it looks like this CSS property is not supported (
word-break: all
?).When this component is rendered on native, the text wraps as desired:
When rendered on web, the text will not wrap to multiple lines, which causes the component to break out of the layout and create scrollbars.
Demo: https://cheddur-rgsymrxmda.now.sh/story/7NcMectnqEW4QivYj -> the cryptocurrency address.
If you shrink your viewport, you see:
The text was updated successfully, but these errors were encountered: