I am trying to generate a single line of text without wrapping text further down the page or breaking into a new line. My page width is dynamic as well, it is calculating the width of the element and then setting the generated PDF width. For example: "This is quite the long sentence", outputs into:
"This is
quite the
long sentence"
When it should just be one continuous line. It doesn't seem like whiteSpace: nowrap
is supported (documentation), so I'm not sure what a good work around could be.
//Calculate Element Width
const getElSize = () => {
const newWidth = ref.current.offsetWidth;
setWidth(newWidth);
console.log(width);
};
useEffect(() => {
getElSize();
}, [input]);
//PDF Output
const MyDoc = () => {
return (
<Document>
<Page
size={{ width: width + 200 }}
style={{
fontFamily: pdfFont,
fontSize: textSize,
}}
>
<View style={{ lineHeight: "0" }}>
<Text>{input}</Text>
</View>
</Page>
</Document>
);
};