Scrollable image with pinch-to-zoom in react-native

前端 未结 6 1897
野的像风
野的像风 2020-12-23 12:33

I\'m trying to display an image in my React Native app (Android) and I want to give users an ability to zoom that image in and out. This also requires the image to be scroll

6条回答
  •  春和景丽
    2020-12-23 12:45

    Don't go deep if you are working with react-native because things will go more and more complex as deep you go.

    Give it a try...

    npm i react-native-image-zoom-viewer --save
    

    or

    yarn add react-native-image-zoom-viewer
    

    copy this code and put it in app.js and hit Run button.

    import React from 'react';
    import {View} from 'react-native';
    import ImageViewer from 'react-native-image-zoom-viewer';
    const image = [
      {
        url:
          'https://static8.depositphotos.com/1020341/896/i/950/depositphotos_8969502-stock-photo-human-face-with-cracked-texture.jpg',
      },
    ];
    
    const App = () => {
      return (
        
          
        
      );
    };
    export default App;
    

提交回复
热议问题