kfiroo / react-native-cached-image

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

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

Closed ZeroCho closed 7 years ago

ZeroCho commented 7 years ago

After upgrading to 1.4.0 I got this error

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

Check your code at FlipView.js:427.

And FlipView.js:427 is CachedImage. My component is like below

<TouchableOpacity key={image.path} onPress={this.handlePressCardImage}>
  <CachedImage
    style={styles.cardSwiperImage}
    source={{ uri: image.path }}
    resizeMethod="resize"
    resizeMode="cover"
  />
</TouchableOpacity>
ptelad commented 7 years ago

Change your import line to this:

import { CachedImage } from 'react-native-cached-image';
ZeroCho commented 7 years ago

@ptelad That works. Thank you.