目录:
安装中间件 react-native-image-zoom-viewer
封装放大图片弹窗组件
调用弹窗组件
具体步骤
1. 安装中间件 react-native-image-zoom-viewer,参考官网 和 官网
版本:
"react": "16.8.3",
"react-native": "0.59.9",
"react-native-image-zoom-viewer": "^3.0.1",
安装方式:
npm install react-native-image-zoom-viewer --save
复制代码
2. 封装放大图片弹窗组件
新建 ZoomPictureModel.js 文件:
import React, { Component } from 'react';
import {
View,
StyleSheet,
Modal,
ActivityIndicator,
Dimensions
} from 'react-native';
import ImageViewer from 'react-native-image-zoom-viewer';
const { width, height } = Dimensions.get('window');
const Width = () => { return width };
const H