malaman / react-image-zoom

React component for desktop browsers for image zoom on mouse hover
http://malaman.github.io/react-image-zoom/example/index.html
MIT License
188 stars 29 forks source link

Couldnt give height 'auto' to image? #7

Closed biplav11 closed 7 years ago

biplav11 commented 7 years ago

changed static propTypes of height to auto still give the passed height

malaman commented 7 years ago

Do you want to initialize ReactImageZoom with something like this ?

import React, { Component } from 'react';
import ReactImageZoom from 'react-image-zoom';
import image from './header-ships-general.jpg';

const props = {width: 400, , height: 'auto' zoomWidth: 500, img: image};

class App extends Component {
  render() {
    return <ReactImageZoom {...props } />;
  }
}
biplav11 commented 7 years ago

yes and define height and width in percentage as well

malaman commented 7 years ago

height: 'auto' feature requires changes in dependency package js-image-zoom. I will implement height: 'auto' feature within next release of js-image-zoom.

Regarding width/height values as percentage: No plans to implement this so far.

malaman commented 7 years ago

auto height is implemented in 0.6.0 (if height prop is omitted, browser calculated height is used)

rehan-sattar commented 4 years ago

Hi @malaman, percentages units implemented for height and width ?

malaman commented 4 years ago

hi, no only px. For a zoomed image scale param could be used.