diegomura / diegomura/react-pdf

Forced hyphenation for `{expression}`

Open
#3,038 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
5h 6m
Merged PRs (30d)
52

Description

**Describe the bug**

The following (with and without the `hyphenationCallback` prop) leads to hyphenation:
```react


[word])}>
This tests that hyphenation doesn't work right in this case and now I need to report it ({word})



```

Result:
image

While with the word inline, this does not happen.

**To Reproduce**

```React
const word = "somelongword";

const Quixote = () => (


[word])}>
This tests that hyphenation doesn't work right in this case and now I need to report it ({word})



);

const styles = StyleSheet.create({
body: {
paddingTop: 35,
paddingBottom: 65,
paddingHorizontal: 35,
},
text: {
margin: 12,
fontSize: 14,
textAlign: 'justify',
fontFamily: 'Times-Roman'
},
});

ReactPDF.render();
```

**Expected behavior**
No hyphenation is happening, especially with the provided hyphenationCallback. Note that putting the `word` variable inline (`This tests that hyphenation doesn't work right in this case and now I need to report it (somelongword)`) has the correct behaviour.

**Screenshots**

image

**Desktop (please complete the following information):**

Windows, Chrome, React-PDF REPL 4.1.5

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.