Giter Site home page Giter Site logo

Comments (21)

rwillemsandroid avatar rwillemsandroid commented on August 17, 2024 11

As suggested by @logileifs the problem is indeed related to the linking of the library, to fix this @ufon, you need to do the following:

In MainApplication.java

add import com.reactnative.photoview.PhotoViewPackage; to the imports and in function getPackages() add new PhotoViewPackage()

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

from react-native-photo-view.

esgudnason avatar esgudnason commented on August 17, 2024 3

Still getting red border in Android with React Native 0.34.1 and version 1.2.0

from react-native-photo-view.

logileifs avatar logileifs commented on August 17, 2024 1

@alwx I figured out that this error was due to it not being linked correctly. However after fixing the linking error I can run the example fine but I get an empty view when using uri with a local path.

from react-native-photo-view.

Obooman avatar Obooman commented on August 17, 2024 1

After I run react-native link it works well.[email protected] and [email protected]

from react-native-photo-view.

edolfuchs avatar edolfuchs commented on August 17, 2024

Same bug here

from react-native-photo-view.

tomershohet avatar tomershohet commented on August 17, 2024

same here

from react-native-photo-view.

alwx avatar alwx commented on August 17, 2024

@logileifs @edolfuchs @tomershohet how do you run it guys? when I run the example project on AVD I see the following:
screen shot 2016-09-25 at 22 53 44

from react-native-photo-view.

alwx avatar alwx commented on August 17, 2024

Also, please, check it with new 1.2.0 version.

from react-native-photo-view.

superandrew213 avatar superandrew213 commented on August 17, 2024

@logileifs what linking error did you have? Mine is linked correctly but still not working

from react-native-photo-view.

ufon avatar ufon commented on August 17, 2024

+1

from react-native-photo-view.

logileifs avatar logileifs commented on August 17, 2024

@superandrew213 I just looked at all the usual android files that need to be linked settings.gradle, build.gradle, MainApplication.java and MainActivity.java. It was missing in some of them so I added where was needed. But like I said, once I got that working it only worked for remote URI

from react-native-photo-view.

ufon avatar ufon commented on August 17, 2024

@logileifs tell pls what u added?

from react-native-photo-view.

logileifs avatar logileifs commented on August 17, 2024

@ufon I really don't remember anymore where the problem was exactly, if you post the content of the files I mentioned I can tell you where you are missing something

from react-native-photo-view.

affibox avatar affibox commented on August 17, 2024
<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}} />

This doesn't work at all

from react-native-photo-view.

vspedr avatar vspedr commented on August 17, 2024

TL;DR: check if rnpm link actually made all the necessary changes (indicated in Manual Installation) to MainActivity.java or MainApplication.java depending on your React Native Version.

I was having the same problem using React Native 0.32.0. I tried debugging and this is what I got:

screen shot 2016-11-17 at 10 40 37 am

So I noticed that even after linking the library with rnpm link, the app could not find the native component. Then I used diff to see the changes caused by rnpm link and noticed it had only added the following line to MainActivity.java (build.gradle was fine):

'import com.reactnative.photoview.PhotoViewPackage;'

Actually, that line should have been added to MainApplication.java along with other imports. It was also missing the following part, which should also go in MainApplication.java.

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

Fix'd ;)

from react-native-photo-view.

jr-k avatar jr-k commented on August 17, 2024

@everyone try to import libART.a

from react-native-photo-view.

jjdp avatar jjdp commented on August 17, 2024

did you all run react-native run-android again? and dont forget to add in build.gradle compile project(':react-native-photo-view')

from react-native-photo-view.

sudoaza avatar sudoaza commented on August 17, 2024

Same here, i had my getPackages function in MainActivity.java instead of MainApplication.java, moved the import there and added the new PhotoViewPackage() and worked. It works for local files too!

from react-native-photo-view.

kccheung avatar kccheung commented on August 17, 2024

I still suffer the same issue. I saw my ReactActivity.java does not have a member function getPackages to allow MainActivity.java to override.

from react-native-photo-view.

affibox avatar affibox commented on August 17, 2024

Guys.... Try to manually link the module.
Then put the inside a tag.

This actually helped me.
Ex:

<View>
 <PhotoView /* add the extra parameters and props*/ />
</View>

from react-native-photo-view.

nihp avatar nihp commented on August 17, 2024

I am getting a blank screen in Android. Works fine in iOS

I have linked correctly.
@alwx
Any workarounds

from react-native-photo-view.

Related Issues (20)

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.