Open andreirat opened 6 years ago
Hi there
I'm trying to figure it out how to handle this behavior.
I want to enable swiper only if there no zoom applied to the image. So I implemented something like this
__onScaleImage = (element) => { if (element.nativeEvent.scale <= 1){ this.setState({ blockLoadedNextPage : false }) } else { this.setState({ blockLoadedNextPage : true }) } };
So, if I open a small image (128x128) it is auto scaled to fill the full width and height.
Initially, I want to keep the element.nativeEvent.scale to 1 to enable swiper.
element.nativeEvent.scale
I have tried to pass the prop resizeMode={'contain'} but it has no effect.
resizeMode={'contain'}
_renderPage = ( data ) => { return ( <PhotoView resizeMode={'contain'} source={{uri: data}} minimumZoomScale={1.0} onTap={() => this.toggleHeader()} maximumZoomScale={3.0} fadeDuration={500} onLoad={() => console.log("Image loaded!")} onScale={(e) => this.__onScaleImage(e)} style={{width: this.state.window.width, height: this.state.window.height}} /> ); }
How can I stop the auto scaling for smaller images ?
Thanks
Hi there
I'm trying to figure it out how to handle this behavior.
I want to enable swiper only if there no zoom applied to the image. So I implemented something like this
So, if I open a small image (128x128) it is auto scaled to fill the full width and height.
Initially, I want to keep the
element.nativeEvent.scale
to 1 to enable swiper.I have tried to pass the prop
resizeMode={'contain'}
but it has no effect.How can I stop the auto scaling for smaller images ?
Thanks