1. Go to this page and download the library: Download noehassiel/signature-pad library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
noehassiel / signature-pad example snippets
class InspectionScreen extends NativeComponent
{
public string $signature = '';
public int $clearToken = 0;
/** Fires on stroke end with the whole drawing so far. */
public function signatureChanged(string $dataUrl): void
{
$this->signature = $dataUrl;
}
public function clearSignature(): void
{
$this->clearToken++; // any change wipes the pad
$this->signature = '';
}
public function save(): void
{
// A plain base64 PNG — post it wherever your web signature pad posts.
Api::post("inspections/{$id}/items/{$itemId}/response", [
'value' => ['value' => 'signed'],
'signature' => $this->signature,
]);
}
}
use Noehassiel\SignaturePad\Facades\SignaturePad;
use Noehassiel\SignaturePad\Events\SignatureCaptured;
use Native\Mobile\Attributes\On;
SignaturePad::capture('inspection-item-9');
#[On(SignatureCaptured::class)]
public function signatureReady(string $ref, string $signature, bool $isEmpty): void
{
if ($isEmpty) {
return; // an untouched pad still exports a valid blank PNG
}
$this->signature = $signature;
}