GithubHelp home page GithubHelp logo

alwx / react-native-photo-view Goto Github PK

View Code? Open in Web Editor NEW
813.0 813.0 434.0 223 KB

Pinch-to-zoom view for React Native (both iOS and Android)

License: MIT License

Java 37.10% JavaScript 15.94% Objective-C 43.17% Ruby 0.97% Starlark 2.83%

react-native-photo-view's Introduction

react-native-photo-view

Provides custom Image view for React Native that allows to perform pinch-to-zoom on images. Works on both iOS and Android.

This component uses PhotoDraweeView for Android and MWPhotobrowser on iOS.

Usage

import PhotoView from 'react-native-photo-view';

Basics:

<PhotoView
  source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}}
  minimumZoomScale={0.5}
  maximumZoomScale={3}
  androidScaleType="center"
  onLoad={() => console.log("Image loaded!")}
  style={{width: 300, height: 300}} />

Properties

Property Type Description
source Object same as source for other React images
loadingIndicatorSource Object source for loading indicator
fadeDuration int duration of image fade (in ms)
minimumZoomScale float The minimum allowed zoom scale. The default value is 1.0
maximumZoomScale float The maximum allowed zoom scale. The default value is 3.0
showsHorizontalScrollIndicator bool iOS only: When true, shows a horizontal scroll indicator. The default value is true.
showsVerticalScrollIndicator bool iOS only: When true, shows a vertical scroll indicator. The default value is true.
scale float Set zoom scale programmatically
androidZoomTransitionDuration int Android only: Double-tap zoom transition duration
androidScaleType String Android only: One of the default Android scale types: "center", "centerCrop", "centerInside", "fitCenter", "fitStart", "fitEnd", "fitXY"
onLoadStart func Callback function
onLoad func Callback function
onLoadEnd func Callback function
onProgress func iOS only: Callback function, invoked on download progress with {nativeEvent: {loaded, total}}.
onTap func Callback function (called on image tap)
onViewTap func Callback function (called on tap outside of image)
onScale func Callback function

react-native-image-zoom functionality is similar, but there are several major differencies:

  • PhotoView is based on PhotoDraweeView which is the "PhotoView For Fresco". It works better, it supports several important callbacks out-of-box and it is, actually, recommended by Chris Banes, because his PhotoView (base for react-native-image-zoom) doesn't completely support Facebook Fresco;
  • PhotoView has more options like fadeDuration and minimumZoomScale/maximumZoomScale and more important callbacks;
  • PhotoView is written in the same manner as default React Image, and it supports most of the features Image has (the goal is to be fully compaitable with Image and support absolutely everything);
  • It is possible to use PhotoView as a container (currently iOS only)!

Automatic installation

Just two simple steps:

npm install --save react-native-photo-view
react-native link react-native-photo-view

Manual installation

Android

  1. Add these lines to android/settings.gradle
include ':react-native-photo-view'
project(':react-native-photo-view').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-photo-view/android')
  1. Add one more dependency to android/app/build.gradle
dependencies {
    compile project(':react-native-photo-view')
}
  1. Add it to your MainActivity.java for RN < 0.29 and to your MainApplication.java for RN >=0.29

To register PhotoViewPackage, you need to change the MainActivity or MainApplication depending on React Native version of your app:

import com.reactnative.photoview.PhotoViewPackage;

// ...

public class MainActivity extends ReactActivity {
    // ...

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new PhotoViewPackage() // add this manager
      );
    }

    // ...
}

IOS

  1. Add this line to your podfile
  pod 'react-native-photo-view', path: './node_modules/react-native-photo-view'
  1. Run pod install

react-native-photo-view's People

Contributors

alwx avatar cornedor avatar corymsmith avatar doochik avatar dxiao avatar edwardgalligan avatar enriquefynn avatar fschai89 avatar greedbell avatar itjesse avatar ivks avatar jadbox avatar jensdebergh avatar knowbody avatar laur3y avatar lisitaeugen avatar lprhodes avatar maraujop avatar matergi avatar moox avatar pkwak-sf avatar radko93 avatar sagexy avatar thanhcuong1990 avatar thorbenandresen avatar vandervidi avatar zeljkox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-photo-view's Issues

Doesn't work on android with [email protected]

On android simulator i have an error message : "Unable to resolve module react-native/Libraries/Components/View/ViewPropTypes"

I guess this is because of the following import in PhotoView.android.js.
import ViewPropTypes from 'react-native/Libraries/Components/View/ViewPropTypes';

Extract information from onTap

I want to get the x and y coordinates from the onTap. I see that with the callback I can have an object, but most of the fields are not useful.

In the java method there are some (x, y) PhotoView.java. Is there a way to get them? Can I get it through the event id that comes in the event from onTap?

Thanks a lot.

Feature Request: PhotoView as a container (currently works only on iOS)

I trying to put some components inside of the PhotoView.

      <PhotoView
        style={{ height: 300, width: 300 }}
        source={source}
        minimumZoomScale={1}
        maximumZoomScale={3}
      >
        <View>
          .......
        </View>
      </PhotoView>

It works fine on IOS but on Android I getting an error.
com.reactnative.photoview.PhotoView cannot be cast to android.view.ViewGroup

Image source bigger than screen

Hello,

On Android, using react-native 0.37. The pacage works great but I'm trying to display an image that is bigger than the screen. I want to resize the image for it to fit, so I can zoom/dezoom on the whole image ; now, we can only zoom on a part of the image.

I set display: flex on PhotoView, but I want to set width: SCREEN_WIDTH on the Image behind.

Android app crashes due to the exception: java.lang.IllegalArgumentException: pointerIndex out of range

Does anyone has the crash problem on Android. Here is my error log:

E/InputEventReceiver(25713): Exception dispatching input event.
E/MtaSDK  (25713): 
E/MtaSDK  (25713): java.lang.IllegalArgumentException: pointerIndex out of range pointerIndex=-1 pointerCount=1
E/MtaSDK  (25713):  at android.view.MotionEvent.nativeGetAxisValue(Native Method)
E/MtaSDK  (25713):  at android.view.MotionEvent.getX(MotionEvent.java:2023)
E/MtaSDK  (25713):  at android.support.v4.view.MotionEventCompatEclair.getX(MotionEventCompatEclair.java:32)
E/MtaSDK  (25713):  at android.support.v4.view.MotionEventCompat$EclairMotionEventVersionImpl.getX(MotionEventCompat.java:110)
E/MtaSDK  (25713):  at android.support.v4.view.MotionEventCompat.getX(MotionEventCompat.java:462)
E/MtaSDK  (25713):  at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:1987)
E/MtaSDK  (25713):  at com.facebook.react.views.viewpager.ReactViewPager.onInterceptTouchEvent(ReactViewPager.java:149)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1951)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2345)
E/MtaSDK  (25713):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1708)
E/MtaSDK  (25713):  at android.app.Dialog.dispatchTouchEvent(Dialog.java:807)
E/MtaSDK  (25713):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2306)
E/MtaSDK  (25713):  at android.view.View.dispatchPointerEvent(View.java:8483)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4291)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4157)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3662)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3715)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3681)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3791)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3689)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3848)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3662)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3715)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3681)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3689)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3662)
E/MtaSDK  (25713):  at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5978)
E/MtaSDK  (25713):  at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5952)
E/MtaSDK  (25713):  at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5923)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6081)
E/MtaSDK  (25713):  at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
E/MtaSDK  (25713):  at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
E/MtaSDK  (25713):  at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
E/MtaSDK  (25713):  at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6039)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6148)
E/MtaSDK  (25713):  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:793)
E/MtaSDK  (25713):  at android.view.Choreographer.doCallbacks(Choreographer.java:606)
E/MtaSDK  (25713):  at android.vi
E/AndroidRuntime(25713): FATAL EXCEPTION: main
E/AndroidRun

This could be the same Android ViewPager issue. The proposed way is to override onInterceptTouchEvent to catch the exception.

Unresolved Issue

I have this error message
"Unable to resolve module react from /Volumes/Working/Project/mobile/conversations/node_modules/react-native-photo-view/PhotoView.ios.js: Invalid directory /Volumes/node_modules/react"

It seems like it is looking for wrong node_modules directory.

Image pinch error.

when i pinch in , app gets crasched in android studio monitor error shows as:
java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1014)
at android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:1282)
at com.facebook.react.views.drawer.ReactDrawerLayout.onInterceptTouchEvent(ReactDrawerLayout.java:37)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2581)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
at a

[Android] crash on component render

09-04 00:59:07.843 15575-15575/com.evrone.pshpsh E/AndroidRuntime: FATAL EXCEPTION: main
                                                                   Process: com.evrone.pshpsh, PID: 15575
                                                                   java.lang.NoSuchMethodError: com.facebook.react.uimanager.events.Event.<init>
                                                                       at com.reactnative.photoview.ImageEvent.<init>(ImageEvent.java:37)
                                                                       at com.reactnative.photoview.PhotoView$1.onSubmit(PhotoView.java:93)
                                                                       at com.facebook.drawee.controller.AbstractDraweeController.submitRequest(AbstractDraweeController.java:395)
                                                                       at com.facebook.drawee.controller.AbstractDraweeController.onAttach(AbstractDraweeController.java:339)
                                                                       at com.facebook.drawee.view.DraweeHolder.attachController(DraweeHolder.java:297)
                                                                       at com.facebook.drawee.view.DraweeHolder.attachOrDetachController(DraweeHolder.java:314)
                                                                       at com.facebook.drawee.view.DraweeHolder.onAttach(DraweeHolder.java:121)
                                                                       at com.facebook.drawee.view.DraweeView.doAttach(DraweeView.java:165)
                                                                       at com.facebook.drawee.view.DraweeView.onAttach(DraweeView.java:151)
                                                                       at com.facebook.drawee.view.DraweeView.onAttachedToWindow(DraweeView.java:128)
                                                                       at me.relex.photodraweeview.PhotoDraweeView.onAttachedToWindow(PhotoDraweeView.java:56)
                                                                       at android.view.View.dispatchAttachedToWindow(View.java:12851)
                                                                       at android.view.ViewGroup.addViewInner(ViewGroup.java:3759)
                                                                       at android.view.ViewGroup.addView(ViewGroup.java:3566)
                                                                       at android.view.ViewGroup.addView(ViewGroup.java:3511)
                                                                       at com.facebook.react.views.view.ReactViewManager.addView(ReactViewManager.java:196)
                                                                       at com.facebook.react.views.view.ReactViewManager.addView(ReactViewManager.java:39)
                                                                       at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:387)
                                                                       at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:175)
                                                                       at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:782)
                                                                       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:829)
                                                                       at com.facebook.react.uimanager.UIViewOperationQueue.access$1500(UIViewOperationQueue.java:44)
                                                                       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:868)
                                                                       at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
                                                                       at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:131)
                                                                       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:814)
                                                                       at android.view.Choreographer.doCallbacks(Choreographer.java:619)
                                                                       at android.view.Choreographer.doFrame(Choreographer.java:587)
                                                                       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:802)
                                                                       at android.os.Handler.handleCallback(Handler.java:808)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:103)
                                                                       at android.os.Looper.loop(Looper.java:193)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5388)
                                                                       at java.lang.reflect.Method.invokeNative(Native Method)
                                                                       at java.lang.reflect.Method.invoke(Method.java:515)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:655)
                                                                       at dalvik.system.NativeStart.main(Native Method)

I am unable to set height in android

Unable to set height style for photo( rectangle in shape) in android.
I set the following property:

photo: {
width:Dimensions.get('window').width,
height:Dimensions.get('window').width,
flex:1
}

This works good in iOS i.e. height is same as width but in android, height is set to native image height and not the supplied height parameters.
Trying without flex resulted in PhotoView getting scaled improperly.
Using the latest version of react-native-photo-view.

RN Version:39.0

Scale property is Android only?

It seems that scale is only implemented for Android. If this for some reason is not doable on iOS side should probably be marked as android only in Readme.

Improving performance on very large jpg

Hi, I am displaying a 5000 x 3500 jpg (about 1 mb size) and resizing it to fit on the phone screen by setting a custom width. But especially on Android, performance is really slow when zooming and the app will often crash. Do you have any advice on how to enable subsampling or any more performant way of displaying such a large image?

Thank you, really enjoying the plugin otherwise.

NPM Install Fails on RN 0.39.2

Just as the title says, I can't install this on React Native 0.39.2 saying that it is an unmet peer dependency. Any help would be welcome, thanks!

scale to fit for initalizal size

I have checked the function and there is a lack of detection for size. The size of the image will be cropped if the initial loaded size is bigger than the screen and the size of the photoview is set to the size of the screen.
here is the source:

'use strict'
import React, {Component} from 'react'
import {
    Animated, ScrollView, StyleSheet,
    TouchableHighlight, Text, Dimensions, ListView, Image,
    StatusBar, AsyncStorage, View
} from 'react-native';
import PhotoView from 'react-native-photo-view';
import {CachedImage} from "react-native-img-cache";
import Toolbar from './../components/Toolbar'
export default class TestLayout extends Component {
    static dimen = Dimensions.get('window');

    render() {
        const full_size = {
            width: TestLayout.dimen.width,
            height: TestLayout.dimen.height,
        }
        return (
            <View style={styles.container_dot}>

                <View style={{
                    position: 'absolute',
                    top: 0, left: 0
                }}>
         
                    <PhotoView
                        style={[full_size, {
                            backgroundColor:"#DFBBAA",
                            borderColor:"#BBAACC",
                            borderWidth: 5,
                        }]}
                        source={{uri: "https://drscdn.500px.org/photo/34778098/q%3D80_m%3D1500/46f408135fd8e8bba2a588f73fecf693"}}
                        minimumZoomScale={0.5}
                        maximumZoomScale={6}
                        scale={0.5}
                        fadeDuration={5500}
                        showsHorizontalScrollIndicator={false}
                        showsVerticalScrollIndicator={false}
                        androidScaleType="center"
                        onLoadStart={()=>console.log("image loading start")}
                        onLoad={() => console.log("Image loaded!")}
                    />
                </View>
                <Toolbar style={{
                    position: 'absolute',
                    top: 0, left: 0
                }} barType={Toolbar.SINGLE_VIEWER}/>
            </View>)
    }
}
const styles = StyleSheet.create({
    centeringAnimationCircle: {
        alignItems: 'center'
    },
    container_dot: {
        flex: 1,
        width: TestLayout.dimen.width,
    },
    photostatic: {
        position: 'absolute',
        top: 0, left: 0
    }
});

Bump npm package version to 2.x

According to servem.org

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards-compatible manner, and
PATCH version when you make backwards-compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

This is recommended since v1.3.0 is incompatible with projects using RN version less than 0.44 after this commit af80c43.

showsHorizontalScrollIndicator and showsVerticalScrollIndicator have no effect

Hi,

I am using 1.2.0 on iPhone 7 - iOS 10.3 and my code is like this:

<PhotoView
  minimumZoomScale={1}
  maximumZoomScale={5}
  showsHorizontalScrollIndicator={false}
  showsVerticalScrollIndicator={false}
  source={{uri: 'https://i.imgur.com/BwdHaJr.jpg'}}
  style={{width: 300, height: 300, resizeMode: 'contain'}}
/>

Alhough if i set showsHorizontalScrollIndicator and showsVerticalScrollIndicator as false, scroll indicators are still visible.

Gif auto play support on Android

Hey there, thank you for this.

I am having difficulties on playing Gifs on RN android. RN Image plays the gifs correctly (I added the necessary fresco deps to my build.gradle ) but with PhotoView gifs shows as static images.

Is there anything you can recommend?

Build issue on Android

Hello,

After letting Android Studio update various things (SDK, SDK tools etc...), my app does not build anymore.

The error I get is

/Users/my-user/Reactnative/my-project/node_modules/react-native-photo-view/android/src/main/java/com/reactnative/photoview/ImageEvent.java:37: error: no suitable constructor found for Event(int)
    super(viewId);
    ^
    constructor Event.Event() is not applicable
      (actual and formal argument lists differ in length)
    constructor Event.Event(int,long) is not applicable
      (actual and formal argument lists differ in length)

Looks like the class constructor of the Event class extended by ImageEvent now expects two arguments.

As a workaround, I did this

public ImageEvent(int viewId, @ImageEventType int eventType) {
    super(viewId, eventType);
    mEventType = eventType;
    mMap = null;
  }

Of course, I have no idea about what I'm doing there but at least my app compiles :)

Problem using react-native-photo-view on IOS

Running npm link react-native-photo-view on android had no effect so I followed the manual steps in the documentation. The photo viewer works on android. On IOS there are no manual installation steps but does not work as is, with the following error:

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1532): UnableToResolveError: Unable to resolve module react-native-photo-view from <path>/ImageViewer.js: Module does not exist in the module map or in these directories:

Nothing gets render.

when i implemented photo view library as:

<Image style={{flex:1}}> <PhotoView source={{ uri: "http://c1.staticflickr.com/8/7412/27488731000_96ad0b9740_k.jpg" }} minimumZoomScale={0.5} maximumZoomScale={3} androidScaleType="center" onLoad={() => console.log("Image loaded!")}/> </Image>

Nothing gets render what had happened, or my syntax are wrong.

Lightbox style

hello, how to create image view on click like lightbox. thanks!

iOS Compatibility

Any plans on making this a little more iOS compatible? There are a few things that do not work with it including: scale, scaleType (only available for android currently), panning the image.

Here is an example code snippet that I have been having issues with:

<PhotoView
            source={map}
            scale={0.75}
            minimumZoomScale={0.5}
            maximumZoomScale={3}
            androidScaleType="fitCenter"
            onLoad={() => console.log("Image loaded!")}
            style={{flex: 1}}
          />

loadingIndicatorSource is android only?

I took a look in the source code after failing to set the loadingIndicatorSource for iOS, and found that in the ios code doesn't seem to use loadingIndicatorSource parameter. So I guess this is not supported for iOS?

just a suggestion, I have been using this to do image loading indicator, maybe it's a good idea to use their image view for this purpose?
https://github.com/oblador/react-native-image-progress

or it might be just I am doing wrongly in passing in the parameter...

Double-tap function is not working on iOS

First of all, I want to say thank you because of your nice library.

I've just realized that your library is not providing double-tap function for iOS.

I mean in Android if user double-tap the scale immediately becomes 1.

I want to make the function for myself but I cannot because the SCALE property is not working also in iOS.

Do you have any plan to implement the function for iOS?

Thank you very much.

http vs https

@alwx thanks for the pkg!!

It seems as though on iOS it only works with images from an https source and local images
and on android it only works with local images

is there a work around for this? Thank you!

Hides carrier info at top

Hi there, could you please update the repo to stop getting rid of the top native info (such as carrier, battery, etc..) as it sends my app's appearance haywire. Or could you please point me to where this happens in your code so I can get rid of that part of it? Thank you!!

Wrong import in react-native 0.42.3

In 0.42.3,
ViewPropTypes in 'react-native/Libraries/Components/View/' may change its name to ViewStylePropTypes
but int the file PhotoView.android.js in react-native-photo-view
the following import may cause error when npm start
import ViewPropTypes from 'react-native/Libraries/Components/View/ViewPropTypes'

Can't pan horizontally, resizeMode does not work iOS

For some reason I can only scroll the image vertically, if I try to scroll horizontally the image seems to be locked.

Is there some setting I need to change, I don't see anything:

My image size is 3000x2000, also resizeMode="contain" does not seem to do anything on iOS, I would also like to be able to show the full image when the image loads.

is ios pinch to zoom function not working ?

Hi there, thanks for providing this great module firstly. it is working on my android devices.
when I try on my ios 9.3, I found it is not zooming at all.
How can I zoom in fullscreen mode ? what is the trick for ios ?

Here is my code:
<PhotoView
source={{uri: uri}}
minimumZoomScale={0.5}
maximumZoomScale={3}
androidScaleType="center"
onTap={this.closeZoom}
style={{width: DEVICE_WIDTH, height: DEVICE_HEIGHT}}
/>

onLoad stops it from working

When I have the line onLoad={() => console.log("Image loaded!")} in my photoview (taken from the readme example) it does not respond to pinching anymore, when I remove the line it works. I do see the message in the console, and no error message in the chrome debugger.

I have to admit I've only tested this on android, and not in an empty app. Because I do not need the function at this point I will just remove the line and carry on, but I thought reporting it as an issue.

Android SDK Build Version

I am attempting to use buddybuild to build and deploy my app for testing. I run into the following issue when building from source on their end:

The SDK Build Tools revision (23.0.1) is too low for project ':react-native-photo-view'. Minimum required is 25.0.0

This is easily fixed locally by updating the buildToolsVersion to 25.0.0. in the build.gradle for the awesome react-native-photo-view project after it's created, but how would I do this without manual intervention? Thoughts?

Cheers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.