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

Word break with numeric sequence is ignored by react-pdf rendering #3039

Open
HallexCosta opened this issue Jan 16, 2025 · 0 comments
Open

Comments

@HallexCosta
Copy link

HallexCosta commented Jan 16, 2025

Describe the bug
I using the same component with the same styling, but when I use letters [a-zA-Z] it respects the break line due to lack of space, but when I use numbers [0-1] it does not respect the width of View

To Reproduce


  1. Create component and render
const styles = StyleSheet.create({
    body: {
        paddingTop: 35,
        paddingBottom: 65,
        paddingHorizontal: 35,
    },
    textContainer: { 
        width: 200, 
        height: 100, 
        border: '1px solid red' 
    },
    container: { 
        flex: 1, 
        display: 'flex', 
        gap: 10 
    }
});

const MyDocument = () => (
    <Document>
        <Page style={styles.body}>
            <View style={styles.container}>
                <View style={styles.textContainer}>
                    <Text>TestingTestingTestingTestingTestingTestingTestingTestingTesting</Text>
                </View>
                <View style={styles.textContainer}>
                    <Text>10101010101010101010101010101010101010</Text>
                </View>
            </View>
        </Page>
    </Document>
);


// To render the document
ReactPDF.render(<MyDocument />);

Snippet of code

Expected behavior
I hope that the word-break of the View width spacing is respected, as happens when I use letters instead of numbers.
Is there any way around this?

Screenshots
image
image

Example in CSS3

In CSS3 exist the property word-break to workaround this behavior
image

Desktop

  • OS: Ubuntu 22.04.5 LTS
  • Browser: chrome
  • React-pdf version: v4.1.6
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

1 participant