+ 1

react-signature-canvas is not loading with fromDataURL function within UseEffect Hook

react-signature-canvas (npm) take time to load when calling it with the signature.current.FromDataURL function. I have used a set Timer within the react use effect Hook. Is there any other best practices I can use instead of set Timmer within useEffect? const sigCanvas = useRef<SignatureCanvas>({} as any); useEffect(() => { setTimeout (()=>{ if (Object.keys(sigCanvas) && props.isSignaturePadOpen) { sigCanvas.current.fromDataURL(props.attendeeSignature); } },1000) }, [sigCanvas,props.attendeeSignature,props.isSignaturePadOpen])

5th Dec 2020, 5:12 PM
Nishra Nasar
Nishra Nasar - avatar
2 Respuestas
+ 1
Can you share piece of code please?
5th Dec 2020, 5:31 PM
Raj Chhatrala
Raj Chhatrala - avatar
0
Added the code
6th Dec 2020, 12:30 AM
Nishra Nasar
Nishra Nasar - avatar