Skip to content

Question about image sizes #5

Open

Description

@DroneKid

Hi!

I'm trying to pan and zoom big image (1000x1000). So I set imageWidth & imageHeight to 1000 and imageContainer sizes to the Dimensions values. It pans ok, but pinch-zooming is funky. on iOs it just pans and does not zoom, on Android it crops the image to the container size.

Could you please advise if I'm doing anything wrong?

Thanks,
A.

Activity

  1. superandrew213 commented on Dec 9, 2016

    @superandrew213

    Post your code so we can see

  2. DroneKid commented on Dec 9, 2016

    @DroneKid
    Author
    import React, { Component } from 'react';
    import {
      View,
      Text,
      Image,
      Dimensions,
    } from 'react-native';
    import ViewEditor from 'react-native-view-editor';
    const { width, height } = Dimensions.get('window');
    
    const uri = 'https://res.cloudinary.com/dtihkk6cr/image/upload/'
      + 'v1481234249/permission_form_page_1_hqx6to.png';
    
    const imgWidth = 773;
    const imgHeight = 1000;
    
    console.log(width, height);
    
    export default class App extends Component {
      render() {
        return (
          <ViewEditor
            imageWidth={imgWidth}
            imageHeight={imgHeight}
            imageContainerWidth={width}
            imageContainerHeight={height}
          >
            {() => (
              <Image
                style={{ position: 'relative', width: imgWidth, height: imgHeight }}
                source={{ uri }}
              >
              </Image>
            )}
          </ViewEditor>
        );
      }
    }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions