terrylinla / react-native-sketch-canvas

A React Native component for drawing by touching on both iOS and Android.
MIT License
691 stars 450 forks source link

How to get base64? #221

Open PauloBragaDev opened 2 years ago

PauloBragaDev commented 2 years ago

Can someone please help me with some questions? How do I get the base64 of the image? how to use getBase64? Do you have an example ready?

Kouraman commented 2 years ago

You can use getBase64() function from the ref.

canvas.current.getBase64('png', false, false, true, false, (err, image) => {
      onChange({
          handWrittenObservation: { base64Image: image },
        },
      });
})
PauloBragaDev commented 2 years ago

You can use getBase64() function from the ref.

canvas.current.getBase64('png', false, false, true, false, (err, image) => {
      onChange({
          handWrittenObservation: { base64Image: image },
        },
      });
})

Do you have any practical example of using this function?