你将如何在 react-native 中实现双指缩放? [英] How would you implement pinch-zoom in react-native?
本文介绍了你将如何在 react-native 中实现双指缩放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在研究 PanResponder.我目前的工作假设是,我会检测是否有两个向外移动的触摸,如果是,则增加 onPanResponderMove
函数中的元素大小.
I've been looking into PanResponder. My current working hypothesis is that I would detect if there are two touches that are moving outwards and if so, increase the element size in the onPanResponderMove
function.
这似乎是一种凌乱的方式.有没有更顺畅的方法?
This seems like a messy way to do it. Is there a smoother way?
推荐答案
如果您只需要简单的双指缩放功能,只需使用 ScrollView (文档在这里)
If you need only simple pinch zoom functionality just use ScrollView (doc here)
只需根据需要提供 maximumZoomScale(大于 1)和 minimumZoomScale.
Just give maximumZoomScale (greater than one) and minimumZoomScale as you wish.
这篇关于你将如何在 react-native 中实现双指缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文