react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

NextJS textAlign doesn't work on React 18

Open makyinmars opened this issue 2 years ago • 3 comments

Describe the bug Using styles to align the text but it doesn't align. However, padding and some others styles work. Using React 18 as well so I don't know if this might be the cause.

To Reproduce https://codesandbox.io/s/awesome-blackwell-h5j07w?file=/src/pages/index.tsx

Steps to reproduce the behavior including code snippet (if applies):

  1. Go to home
  2. Click on 'PDF Page'
  3. See error -> Using textAlign: "center"

You can make use of react-pdf REPL to share the snippet

Expected behavior Align text based on the style provided: "center", "left", or "right".

Desktop (please complete the following information):

  • OS: Mac OS
  • Browser: Brave
  • React-pdf version [e.g. v2.3.0]

makyinmars avatar Aug 06 '22 17:08 makyinmars

Not sure on the issue, just had a question. Since you're using React 18 and not 16 or 17 like it is looking for, did you get this error? And did you just force install it?

$ npm i @react-pdf/renderer
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"18.1.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.6 || ^17.0.0" from @react-pdf/[email protected]
npm ERR! node_modules/@react-pdf/renderer
npm ERR!   @react-pdf/renderer@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

jwentling78 avatar Aug 09 '22 12:08 jwentling78

@jwentling78 I used yarn to install my dependencies and I didn't get any error like that. I haven't tried a install with npm. Perhaps check you node version. I'm using the node lts version.

makyinmars avatar Aug 09 '22 22:08 makyinmars

@makyfj I am using LTS as well for node (on 16.15.0, not the most current, 16.16.0). Anyway, thanks for the response! I'll try to figure it out or just wait it out. Just looking for something I can use to export my screen/data to a PDF report.

jwentling78 avatar Aug 10 '22 16:08 jwentling78

Not sure on the issue, just had a question. Since you're using React 18 and not 16 or 17 like it is looking for, did you get this error? And did you just force install it?

$ npm i @react-pdf/renderer
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"18.1.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.6 || ^17.0.0" from @react-pdf/[email protected]
npm ERR! node_modules/@react-pdf/renderer
npm ERR!   @react-pdf/renderer@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

I ended up installing with yarn as well, but I got the same error with npm.

alexbraga avatar Nov 04 '22 01:11 alexbraga