DylanVann / react-native-fast-image

🚩 FastImage, performant React Native image component.
MIT License
8.22k stars 1.51k forks source link

Question about loading images on Android devices #665

Open ddallagnese opened 4 years ago

ddallagnese commented 4 years ago

Hi there, I'm developing an app that is supposed to show avatars. I'm having trouble loading the avatars in some Android devices, and I can't figure out why. The problem is that the space where the images should be is empty. I tried to use the onError prop, but it wasn't useful. It fires, but I can't get the error. Weird thing is that on some devices, and also all the emulators I could test, the images are shown without any problems. And iOS simulator and devices also load images correctly.

Here is an example of the image I'm trying to load: http://www.amigosdokart.com.br/images/membros/658/avatar.jpg

And here is the list of devices I have access to: Working => Samsung A5, Galaxy Note 5 Not working => Moto One, Samsung S9+, Samsung Galaxy M30

I can't see any errors or messages, and I don't know how I could use the onError to show the actual error. Can someone assist on this issue, please?

Thanks!

naxel commented 4 years ago

try to add android:usesCleartextTraffic="true" to ./adnroid/app/src/main/AndroidManifest:

     <application
       ...
      android:usesCleartextTraffic="true"
     ...>
ddallagnese commented 4 years ago

@naxel I did, same results... I also tried setting networkSecurityConfig, but it didn't work. This is my main/AndroidManifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.AmigosDoKart">

<uses-permission android:name="android.permission.INTERNET" />

<application
  android:name="com.AmigosDoKart.MainApplication"
  android:label="@string/app_name"
  android:screenOrientation="portrait"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:networkSecurityConfig="@xml/network_security_config"
  android:usesCleartextTraffic="true"
  android:theme="@style/AppTheme">
  <activity
    android:name="com.AmigosDoKart.MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

And this is the networkSecurityConfig (wasn't able to paste the text...):

image

Any ideas?

ddallagnese commented 4 years ago

I was able to determine that the issue is regarding the http server where the images are stored. As I wasn't able to find a solution for that, I had to move the images to an https location. I created a folder on AWS S3, and I access them using AWS CloudFormation. Using the https server, all the devices are now able to show the images.