kfiroo / react-native-cached-image

CachedImage component for react-native
MIT License
940 stars 468 forks source link

Upgrading to 0.48 breaks #88

Open abeltje1 opened 7 years ago

abeltje1 commented 7 years ago

After I've upgraded to 0.48.4 (latest RN atm) sadly this library broke, it's giving me the following error message:

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

When I remove all CachedImage tags for regular RN Image tags, everything works again. I'm running on the latest react-native-cached-image (0.4). Anyone an idea how to solve?

Cheers

kfiroo commented 7 years ago

@abeltje1 Hey, thanks for this! I can't investigate right now, can you provide some more info?

Thanks

alxvallejo commented 7 years ago

I'm also hitting this issue after upgrading to the latest React Native. I had to replace all instances of with just to resolve this error.

kfiroo commented 7 years ago

@abeltje1 @alxvallejo Can you make sure you are requiring the component correctly please.

// Should be something like this:
import {
    CachedImage
} from 'react-native-cached-image';
// Or this
const CachedImage = require('react-native-cached-image').CachedImage;
abeltje1 commented 7 years ago

@kfiroo yes I'm doing it exactly that way. Precisely what extra info are you looking for? I can't really figure out what there is more to show, sorry :p

kfiroo commented 7 years ago

@abeltje1 I'm trying to find what's different about your setup, where it looks like one of the components is resolved to an object, from mine and others where everything seems to work fine :)

Anything you can give me could be helpful.

Can you run the CachedImageExample? Are you getting the same errors?

haipengz commented 6 years ago

@kfiroo I think the library should export the default CachedImage component, so as to keep compatibility and make the upgrading path smooth.

abeltje1 commented 6 years ago

@kfiroo I will look into it tomorrow, hope to give you some more info!

maria-kravtsova commented 6 years ago

Having the same issue.

ChristianTucker commented 6 years ago

Same issue, don't have any update information available though.

If it helps any, installing version 1.3.5 works fine So something has changed since then to cause this issue.

chrusart commented 6 years ago

I'm using RN 0.49.3, works for me, could you share how you import and use CachedImage?

kfiroo commented 6 years ago

Please make sure you are requiring the component as suggested in this comment https://github.com/kfiroo/react-native-cached-image/issues/88#issuecomment-332667016

jbolter commented 6 years ago

To be specific... make sure you are adding the {} around CachedImage.

Old way: import CachedImage from 'react-native-cached-image';

New way: import {CachedImage} from 'react-native-cached-image';

Although now that I just changed all mine I am running into a new error...

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.

Check the render method of CachedImage.