Comments (21)
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.
Still getting red border in Android with React Native 0.34.1 and version 1.2.0
from react-native-photo-view.
@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.
After I run react-native link
it works well.[email protected]
and [email protected]
from react-native-photo-view.
Same bug here
from react-native-photo-view.
same here
from react-native-photo-view.
@logileifs @edolfuchs @tomershohet how do you run it guys? when I run the example project on AVD I see the following:
from react-native-photo-view.
Also, please, check it with new 1.2.0 version.
from react-native-photo-view.
@logileifs what linking error did you have? Mine is linked correctly but still not working
from react-native-photo-view.
+1
from react-native-photo-view.
@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.
@logileifs tell pls what u added?
from react-native-photo-view.
@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.
<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.
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:
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.
@everyone try to import libART.a
from react-native-photo-view.
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.
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.
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.
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.
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)
- BLANK SCREEN IF IMAGE IS 5MB
- onTap event used as onScale
- react-native-photo-view:compileDebugJavaWithJavac FAILED HOT 4
- Default image is rotating before actual image loads completely
- react-native-photo-view in ios image is not open proper width of the image. HOT 1
- Android how can I insert a component in <PhotoView><MyComponent></PhotoView>
- Podspec file not beings installed causing issues on iOS HOT 5
- 'React/RCTImageLoader.h' file not found HOT 2
- WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. HOT 1
- Calling bridge.imageLoader is deprecated and will not work in newer versions of RN. Please update to themoduleForClass API or turboModuleLookupDelegate API. HOT 2
- Image caching HOT 2
- Gif isn't shown on iOS
- Failed build for Android HOT 4
- Android build is failing with - Could not find me.relex:photodraweeview:1.1.3. HOT 3
- How to open an image already scaled?
- Bug report: Double tap on image in ios triggers onTap event. HOT 2
- Support for mutliple images HOT 1
- react-native-photo-view is causing APK build failure HOT 1
- Not compatible with reanimated 2
- Wie kann ich alles abstellen um meinen privaten raus und alles zu haben?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-photo-view.