DylanVann / react-native-fast-image

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

[Android] defaultSource not working #945

Open v-x2 opened 1 year ago

v-x2 commented 1 year ago

Describe the bug The defaultSource is ignored on Android and the image is not displayed. It works perfect on iOS.

To Reproduce

<FastImage 
                    style={{width: '100%', height: 200, borderRadius: 24}}
                    source={{
                        uri: https://site.com/image.jpg,
                        priority: FastImage.priority.normal,
                    }}  
                    defaultSource={require('../../../assets/image-placeholder-light.png') }
                    resizeMode={FastImage.resizeMode.cover}
                />

Dependency versions

fukemy commented 1 year ago

that not bug, run in production mode then it's will show

CostinBiserica commented 1 year ago

that not bug, run in production mode then it's will show

I have the same issue in production. defaultSource not working

firehand33 commented 1 year ago

I have the same issue in both production and debug mode.

fukemy commented 1 year ago

how did u guy provide defaultSource? use defaultSource={require(...)}??? Did you checked url is matched? Did you update newer version?

truong15 commented 1 year ago

Any update on this? iOS working well but android

truong15 commented 1 year ago

I decided to work around myself. There are 2 cases that need to be handled: url is null and the wrong url

const [isLoadingImage, setLoadingImageState] = React.useState(false)
const [isError, setIsError] = React.useState(false)
<FastImage
        resizeMode={FastImage.resizeMode.cover}
        defaultSource={icons.avatarDefault}
        source={ url && !isError ? { uri: url } : icons.avatarDefault}
        onLoadStart={onLoadStart}
        onLoadEnd={onLoadEnd}
        onError={onError}
      />
const onLoadStart = () => setLoadingImageState(true)
const onLoadEnd = () => setLoadingImageState(false)
const onError = () => setIsError(true)
prateek-somaiya commented 1 year ago

This is a core problem with the lib! Anyone?? This is still not working in Android in production builds... Guess its time to switch to expo-image

anggaprytn commented 1 year ago

+1

devoutDisciple commented 1 year ago

+1

devoutDisciple commented 1 year ago

+1

devoutDisciple commented 1 year ago

+1

atultiwaree commented 1 year ago

Not working!!!!!!!!

000xuandu commented 1 year ago

Any update?

000xuandu commented 1 year ago

@fukemy Are you sure it works for you? Latest version?

fukemy commented 1 year ago

@000xuandu work normally to me

000xuandu commented 1 year ago

@fukemy Can you share the code and version?

fukemy commented 1 year ago
Screenshot 2023-08-09 at 11 31 11

"react-native-fast-image": "^8.6.0",

000xuandu commented 1 year ago

@fukemy The latest version is 8.6.3, and I'm using it! Let me try with your version right now

000xuandu commented 1 year ago

@fukemy It's still not working for me on Android. ride?.driver?.avatar is null

<FastImage
            source={{ uri: ride?.driver?.avatar }}
            defaultSource={require('../../assets/driver-default.png')}
            style={{
              width: 60,
              height: 60,
              borderRadius: 30,
              borderWidth: 4,
              borderColor: primaryColor,
            }}
          />

"react-native-fast-image": "^8.6.0",

fukemy commented 1 year ago

if null set source = defaultsource

000xuandu commented 1 year ago

I just want to confirm what is the root-cause of issue

ponchautf commented 1 year ago

having the same issue on android (working as expected on ios) any progress on this?

fukemy commented 1 year ago

this lib is DEAD

ponchautf commented 1 year ago

this lib is DEAD @fukemy Is there any alternative? (Still active of course)