react-native-fast-image icon indicating copy to clipboard operation
react-native-fast-image copied to clipboard

[Android] defaultSource not working

Open v-x2 opened this issue 3 years ago • 28 comments

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

  • React Native version: 0.70.4
  • React version: 18.2.0
  • React Native Fast Image version: 8.6.1 and 8.63

v-x2 avatar Nov 12 '22 22:11 v-x2

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

fukemy avatar Nov 17 '22 05:11 fukemy

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

I have the same issue in production. defaultSource not working

CostinBiserica avatar Nov 18 '22 10:11 CostinBiserica

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

firehand33 avatar Nov 22 '22 02:11 firehand33

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

fukemy avatar Nov 22 '22 02:11 fukemy

Any update on this? iOS working well but android

truong15 avatar Jan 11 '23 10:01 truong15

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)

truong15 avatar Jan 12 '23 07:01 truong15

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

prateek-somaiya avatar Apr 08 '23 04:04 prateek-somaiya

+1

anggaprytn avatar Apr 18 '23 05:04 anggaprytn

+1

devoutDisciple avatar Jun 29 '23 11:06 devoutDisciple

+1

devoutDisciple avatar Jul 26 '23 14:07 devoutDisciple

+1

devoutDisciple avatar Jul 26 '23 15:07 devoutDisciple

Not working!!!!!!!!

atultiwaree avatar Jul 29 '23 06:07 atultiwaree

Any update?

000xuandu avatar Aug 09 '23 03:08 000xuandu

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

000xuandu avatar Aug 09 '23 04:08 000xuandu

@000xuandu work normally to me

fukemy avatar Aug 09 '23 04:08 fukemy

@fukemy Can you share the code and version?

000xuandu avatar Aug 09 '23 04:08 000xuandu

Screenshot 2023-08-09 at 11 31 11

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

fukemy avatar Aug 09 '23 04:08 fukemy

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

000xuandu avatar Aug 09 '23 04:08 000xuandu

@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",

000xuandu avatar Aug 09 '23 04:08 000xuandu

if null set source = defaultsource

fukemy avatar Aug 09 '23 05:08 fukemy

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

000xuandu avatar Aug 09 '23 06:08 000xuandu

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

ponchautf avatar Sep 23 '23 18:09 ponchautf

this lib is DEAD

fukemy avatar Sep 24 '23 12:09 fukemy

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

ponchautf avatar Sep 24 '23 17:09 ponchautf