RepairShopr / react-native-signature-capture

A simple modular component for react native (iOS) to capture a signature as an image
MIT License
962 stars 514 forks source link

Change stroke width #40

Open agrass opened 7 years ago

agrass commented 7 years ago

Hi!

There is a prop to change the stroke width??

Thanks!

Antonio

thomaslecoeur commented 7 years ago

+1

kylebebak commented 7 years ago

+1

moaxaca commented 7 years ago

+1

hanspagel commented 7 years ago

👍

Drustus commented 7 years ago

+1

Drustus commented 7 years ago

Hi here! I've found a "partial solution".

If you go to this directory:

./node_modules/react-native-signature-capture/android/src/main/java/com/rssignaturecapture/RSSignatureCaptureView.java

you will see the next two properties:

These are the two stroke width properties. You can change it and relaunch the project.

A notation: if you download the project and you install "node_modules", the width properties will change to the default value. You can avoid this doing a "postinstall" command in "package.json" and running a script that changes these values. Here my solution:

- package.json:

"postinstall": "cd scripts && node signatureStrokeWidth" - scripts / signatureStrokeWidth.js: const fs = require('fs'); ` fs.readFile(__dirname + '/../node_modules/react-native-signature-capture/android/src/main/java/com/rssignaturecapture/RSSignatureCaptureView.java', 'utf8', function (err, data) { if (err) { return console.error(err); } let result = data.replace('mMinWidth = convertDpToPx(8);', 'mMinWidth = convertDpToPx(4);'); result = result.replace('mMaxWidth = convertDpToPx(16);', 'mMaxWidth = convertDpToPx(8);');

fs.writeFile(__dirname + '/../node_modules/react-native-signature-capture/android/src/main/java/com/rssignaturecapture/RSSignatureCaptureView.java', result, 'utf8', function (err) { if (err) return console.error(err); }); });

agrass commented 7 years ago

Hi @Drustus, Thanks! do you already do the change in IOS also? I'm going to work in my own fork as temporal solution and change this fixed values

agrass commented 7 years ago

Here is my fork if someone want less stoke width in Android:

npm i --save https://github.com/agrass/react-native-signature-capture

Drustus commented 7 years ago

Hi @agrass, sorry, but I'm not working with IOS at the moment, so I haven't done this change on IOS.

thomaslecoeur commented 7 years ago

I added this feature for Android on a forked repo : https://github.com/EllipApp/react-native-signature-capture

You can use the props minStrokeWidth={100} and maxStrokeWidth={150} (Those are sample values !)

dave-irvine commented 7 years ago

@Thomeuxe could you make a PR to this repo? It would be great to get your feature merged into this npm package.

robbporto commented 6 years ago

+1.

This would be a VERY good feature!

NgKhanh commented 6 years ago

@Thomeuxe is it work on iOS ?

vivekshah-zymr commented 5 years ago

I added this feature for Android on a forked repo : https://github.com/EllipApp/react-native-signature-capture

You can use the props minStrokeWidth={100} and maxStrokeWidth={150} (Those are sample values !)

This didn't work for me. Can you please elaborate more?

jughoor commented 5 years ago

here you my fork for both Android and IOS. npm i --save https://github.com/jughoor/react-native-signature-capture.git react-native link https://github.com/jughoor/react-native-signature-capture.git

LaGregance commented 2 years ago

I take the liberty of restarting this thread, because it is always an issue. I've fixed this in this fork https://www.npmjs.com/package/@lagregance/react-native-signature-capture