Skip to content

React Native Signature InkChữ ký vẽ bằng chính engine mực của nền tảng

PencilKit trên iOS, renderer velocity-Bezier tinh chỉnh kỹ trên Android. Một Fabric component với toolbar native, ref API có type đầy đủ và xuất PNG, JPEG, SVG, stroke data. Không Skia, không WebView.

Cài đặt ​

sh
npm install react-native-signature-ink
sh
yarn add react-native-signature-ink
sh
npx expo install react-native-signature-ink
npx expo prebuild

Sau đó chạy pod install trong ios/. Component cần New Architecture. Xem Cài đặt để biết về quyền truy cập và Expo.

Ký và xuất ảnh chỉ với vài dòng ​

tsx
import { useRef } from 'react';
import { SignatureInk, type SignatureInkHandle } from 'react-native-signature-ink';

const ref = useRef<SignatureInkHandle>(null);

<SignatureInk ref={ref} style={{ height: 240 }} showBaseline showToolbar />;

const png = await ref.current?.toBase64({ trim: true }); // base64 thuần, không có tiền tố data:

Xem trên thiết bị thật ​

iOS
Android

Phát hành theo giấy phép MIT.