-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
deps: update signature_pad
to v4
#98
Conversation
Also remove the @types dependency as it appears signature_pad declares it's own types now.
6241262
to
25920f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the PR, but unfortunately this does not address all the breaking changes in signature_pad
v4. This effectively duplicates #68 as a result. Please see the detailed comments there for how this is a breaking change and what additional changes would need to be made to make react-signature-canvas
compatible with it (which may require a major release).
So far, no contributor has made those changes, and actual feature requests for v4 have been very few and far in between.
signature_pad
to v4
@@ -7,5 +7,7 @@ | |||
"compilerOptions": { | |||
// output to dist/ dir | |||
"outDir": "dist/", | |||
"jsx": "react-jsx", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this is not compatible with older React versions, which is why I have yet to use it and why I still have import React
(among other things). you might notice that in the peerDeps
here, react-signature-canvas
is backward compatible with at least React v14.
this would require changing the peerDeps
version. it looks like the React team did backport this all the way to React v14, but the range would need to be changed to only those versions and above, i.e. ^16.14.0
, ^15.7.0
, ^0.14.10
(and 17+ ofc)
@@ -7,5 +7,7 @@ | |||
"compilerOptions": { | |||
// output to dist/ dir | |||
"outDir": "dist/", | |||
"jsx": "react-jsx", | |||
"importsNotUsedAsValues": "preserve" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed as all of the imports are still used even when the types are removed. Is there a reason you added this?
import { Options as SignaturePadOptions } from 'signature_pad' | ||
import SignaturePad from 'signature_pad' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { Options as SignaturePadOptions } from 'signature_pad' | |
import SignaturePad from 'signature_pad' | |
import SignaturePad, { Options as SignaturePadOptions } from 'signature_pad' |
I would prefer to keep imports of the same library on the same line (and generally avoid stylistic changes)
@@ -158,7 +159,7 @@ export class SignatureCanvas extends Component<SignatureCanvasProps> { | |||
} | |||
|
|||
toDataURL: SignaturePad['toDataURL'] = (type, encoderOptions) => { | |||
return this.getSignaturePad().toDataURL(type, encoderOptions) | |||
return this.getSignaturePad().toDataURL(type as string, encoderOptions as number) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this type-cast necessary? we should have the exact same types and not force any subset
Closing as stale with no response in 2 weeks. Can re-open if this is picked back up |
Also remove the @types dependency as it appears signature_pad declares it's own types now.