如何在 React Native 中进行签名捕获? [英] How can I do Signature Capture in React Native?
问题描述
我正在尝试了解如何在 React Native 中进行签名捕获.我的应用程序是使用 create-react-native-app
和 Expo
创建的,我希望不必退出应用程序即可使此功能正常工作.
I'm trying to understand how I can do a signature capture in React Native. My App is created with create-react-native-app
and Expo
and I'd prefer to not have to eject the app to get this functionality to work.
是否可以将这样的内容包装在 webview 中?https://github.com/szimek/signature_pad
Would it be possible to wrap something like this in a webview? https://github.com/szimek/signature_pad
我也看过这个项目,https://github.com/RepairShopr/react-native-signature-capture 但它需要我弹出应用程序并使用 react-native 链接
.
I've also looked at this project, https://github.com/RepairShopr/react-native-signature-capture but it requires me to eject the app and use react-native link
.
寻找有关如何实现此功能的任何建议或建议,同时使我的项目尽可能简单(理想情况下,使用 create-react-native-app,但如果这不可能,有人可以向我解释为什么吗?)
Looking for any advice or suggestions on how to implement this feature while keeping my project as straightforward as possible (ideally, using create-react-native-app, but if this isn't possible could someone please explain to me why?)
推荐答案
我知道已经有一段时间了,但是这里有一篇有趣的文章:https://blog.expo.io/drawing-signatures-with-expo-25d1629ca1ac
I know it's been a while, but there is an interesting article here: https://blog.expo.io/drawing-signatures-with-expo-25d1629ca1ac
等等,但是怎么做?
使用expo-pixi",您可以添加一个组件,让您选择画笔的颜色、粗细和不透明度.然后,当您的用户抬起手指时,您会收到回调.从那里您可以截取透明视图的屏幕截图或获取原始点数据(如果您正在寻找).
Using "expo-pixi", you can add a component that lets you choose your brush’s color, thickness, and opacity. Then when your user lifts her finger, you get a callback. From there you can take a screenshot of the transparent view or get the raw point data if that’s what you’re looking for.
这篇关于如何在 React Native 中进行签名捕获?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!