YanYuanFE / react-native-signature-canvas

:black_nib: React Native Signature Component based WebView Canvas for Android && IOS && expo
MIT License
426 stars 151 forks source link

How can I set up the background color of the signature picture as a image file. #61

Closed BlerasKRT closed 4 years ago

BlerasKRT commented 4 years ago

I need to save the picture and I want to have a background pure white. I see that you can changeit in the signature pad where this is based. Any alternative diferent of change directly signature pad code?

YanYuanFE commented 4 years ago

background default is white, you can change props of WebStyle,

webStyle={`.m-signature-pad--body
    canvas {
      background-color: red;
    }`
  }
BlerasKRT commented 4 years ago

Thank you for the quick response, It works to change the background color of where you paint, but I need that the final image have a diferent background color, not just black... basically I just change the value of this: at signature_pad.js in function SignaturePad:

this.backgroundColor = options.backgroundColor || 'rgba(0,0,0,0)'; should be 'rgb(255,255,255)'

Thank you in advance.

YanYuanFE commented 4 years ago

@BlerasKRT ,v3.1.0 has release, add penColor and backgroundColor props.

BlerasKRT commented 4 years ago

Sorry but it does not work in any way...

<Signature // handle when you click save button onOK={(img) => { console.log("img", img); props.setTestDrop(img); }} onEmpty={() => { console.log("empty"); setTestType("empty"); }} // description text for signature descriptionText="Firma" // clear button text clearText="Borrar" // save button text confirmText="Salvar"

        webStyle={`.m-signature-pad--footer
          .button {
            background-color: rgba(255,117,2,1);
            color: #FFF;
        }`}
        autoClear={true}
        imageType={"image/jpeg"}
        backgroundColor="rgb(255,255,255)"
        penColor={"rgba(255,117,2,1)"}
      />
YanYuanFE commented 4 years ago

image Oh, work fine on ios.

YanYuanFE commented 4 years ago

https://github.com/YanYuanFE/react-native-signature-canvas/tree/master/example/expo-app, I use this example

BlerasKRT commented 4 years ago

yes working fine in both