Skip to content
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

renderLine is manulipating the text #48

Closed
DocCaliban opened this issue Jun 13, 2017 · 3 comments
Closed

renderLine is manulipating the text #48

DocCaliban opened this issue Jun 13, 2017 · 3 comments

Comments

@DocCaliban
Copy link

DocCaliban commented Jun 13, 2017

Not sure why you are adding line breaks here, if my input text didn't contain any line breaks why add them at all? In my solution it makes for sloppy presentation. I pasted an example of what a 3 line text blob looks like.

I could fix this on a local branch, just wondering what the underlying reason was.

Lorem ipsum dolor sit amet, consectetur
adipiscing
elit, sed do eiusmod tempor incididunt ut
labore
et dolore magna aliqua. Ut enim ad
minim

    renderLine(line, i, arr) {
        if (i === arr.length - 1) {
            return <span key={i}>{line}</span>;
        } else {
            const br = <br key={i + 'br'} />;

            if (line) {
                return [
                    <span key={i}>{line}</span>,
                    br
                ];
            } else {
                return br;
            }
        }
    }
@juanezamudio
Copy link

I agree. Having issues with text just flowing from line to line. It seems every complete sentence for me that ends in a period causes a line break. Any way we could fix this to only line break when line length == container width?

@juanezamudio
Copy link

Feel like this issue is related to this one. @DocCaliban

@pablosichert
Copy link
Owner

Not sure why you are adding line breaks here, if my input text didn't contain any line breaks why add them at all?

The line breaks are set explicitly since this module is supposed to calculate the exact position where they should occur.

Did you look into the issue @juanezamudio linked? Do you use a custom font and made sure it is loaded before your first render?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants