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

前端 未结 6 1936
野的像风
野的像风 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:57

    There's a much easier way now. Just make a ScollView with minimumZoomScale and maximumZoomScale:

    import React, { Component } from 'react';
    import { AppRegistry, ScrollView, Text } from 'react-native';
    
    export default class IScrolledDownAndWhatHappenedNextShockedMe extends Component {
      render() {
          return (
            
              Scroll me plz
              If you like
              Scrolling down
              What's the best
              Framework around?
              React Native
            
        );
      }
    }
    
    // skip these lines if using Create React Native App
    AppRegistry.registerComponent(
      'AwesomeProject',
      () => IScrolledDownAndWhatHappenedNextShockedMe);
    

提交回复
热议问题