博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
React Native可变换图像组件
阅读量:4084 次
发布时间:2019-05-25

本文共 1679 字,大约阅读时间需要 5 分钟。

一个纯JavaScript写的可变换图像组件,如PhotoView或ImageViewer,支持手势,如平移,捏,双标签和fling,适用于iOS和Android。

https://github.com/ldn0x7dc/react-native-transformable-image

react-native-transformable-image

A pure JavaScript written transformable image component, like PhotoView or ImageViewer, supports gestures like pan, pinch, double tab and fling, works with both iOS and Android.

Written in pure JS, this component should be one of the most easy to use component among all the zoomable, scrollable PhotoView alike views on react-native.

Install

npm install --save react-native-transformable-image@latest

Usage

Quite same as the official , as below shows:

import Image from 'react-native-transformable-image';...render() {    return (      ...              ...    );  }

You can provide enableTransformenableScale and enableTranslate props to control corresponding features.

Other props

  • onTransformGestureReleased and onViewTransformed:

​ inherited from 

Attention

  • If you are using react-native v0.27 and below, or if the image source is local (source={require('...')}), you should provide the pixels prop, like pixels={
    {width: 3607, height: 2400}}
     (ask your API server to provide the pixels info for remote images). This prop is used to align the edge of the image content with the view's boundry and to determine the max scale.
  • By default, the offical iOS Image component will downsample if the image is larger than the view size. react-native-transformable-image disables downsampling to keep more image details when zoomed in. This could cause memory issues if your image is too large.

Image Gallery

If you are looking for an image gallery component, please refer to , which is based on this component.

转载地址:http://nyeni.baihongyu.com/

你可能感兴趣的文章
WAV文件解析
查看>>
WPF中PATH使用AI导出SVG的方法
查看>>
QT打开项目提示no valid settings file could be found
查看>>
java LinkedList与ArrayList迭代器遍历和for遍历对比
查看>>
所谓的进步和提升,就是完成认知升级
查看>>
如何用好碎片化时间,让思维更有效率?
查看>>
No.182 - LeetCode1325 - C指针的魅力
查看>>
带WiringPi库的交叉笔译如何处理二之软链接概念
查看>>
Java8 HashMap集合解析
查看>>
自定义 select 下拉框 多选插件
查看>>
Linux常用统计命令之wc
查看>>
fastcgi_param 详解
查看>>
搞定Java面试中的数据结构问题
查看>>
React Native(一):搭建开发环境、出Hello World
查看>>
Winform多线程
查看>>
Spring AOP + Redis + 注解实现redis 分布式锁
查看>>
poj 1976 A Mini Locomotive (dp 二维01背包)
查看>>
《软件过程管理》 第九章 软件过程的评估和改进
查看>>
《数据库系统概论》 第三章 关系数据库标准语言SQL
查看>>
《计算机网络》第五章 运输层 ——TCP和UDP 可靠传输原理 TCP流量控制 拥塞控制 连接管理
查看>>