react-native-image-placeholder
Advanced tools
Comparing version
28
index.js
@@ -1,2 +0,3 @@ | ||
import React, { PropTypes } from 'react'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Image, ImageBackground, ActivityIndicator, View } from 'react-native'; | ||
@@ -34,2 +35,7 @@ | ||
render() { | ||
const { | ||
style, source, resizeMode, borderRadius, children, | ||
loadingStyle, placeholderSource, placeholderStyle, | ||
customImagePlaceholderDefaultStyle | ||
} = this.props; | ||
return( | ||
@@ -39,10 +45,10 @@ <ImageBackground | ||
onError={this.onError.bind(this)} | ||
style={[styles.backgroundImage, this.props.style]} | ||
source={this.props.source} | ||
resizeMode={this.props.resizeMode} | ||
borderRadius={this.props.borderRadius} | ||
style={[styles.backgroundImage, style]} | ||
source={source} | ||
resizeMode={resizeMode} | ||
borderRadius={borderRadius} | ||
> | ||
{ | ||
(this.state.isLoaded && !this.state.isError) ? this.props.children : | ||
<View style={styles.viewImageStyles}> | ||
(this.state.isLoaded && !this.state.isError) ? children : | ||
<View style={[styles.viewImageStyles, { borderRadius: borderRadius }]}> | ||
{ | ||
@@ -52,9 +58,9 @@ this.props.isShowActivity && | ||
style={styles.activityIndicator} | ||
size={this.props.loadingStyle ? this.props.loadingStyle.size : 'small'} | ||
color={this.props.loadingStyle ? this.props.loadingStyle.color : 'gray'} | ||
size={loadingStyle ? loadingStyle.size : 'small'} | ||
color={loadingStyle ? loadingStyle.color : 'gray'} | ||
/> | ||
} | ||
<Image | ||
style={this.props.placeholderStyle ? this.props.placeholderStyle : [styles.imagePlaceholderStyles, this.props.customImagePlaceholderDefaultStyle]} | ||
source={this.props.placeholderSource ? this.props.placeholderSource : require('./Images/empty-image.png')} | ||
style={placeholderStyle ? placeholderStyle : [styles.imagePlaceholderStyles, customImagePlaceholderDefaultStyle]} | ||
source={placeholderSource ? placeholderSource : require('./Images/empty-image.png')} | ||
> | ||
@@ -61,0 +67,0 @@ </Image> |
{ | ||
"name": "react-native-image-placeholder", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "react native image placeholder", | ||
@@ -13,2 +13,5 @@ "main": "index.js", | ||
}, | ||
"dependencies": { | ||
"prop-types": "^15.5.10" | ||
}, | ||
"keywords": [ | ||
@@ -15,0 +18,0 @@ "react native image placeholder", |
@@ -12,2 +12,5 @@ # react-native-image-placeholder [](https://badge.fury.io/js/react-native-image-placeholder) | ||
## Require | ||
React-native >= 0.46.x | ||
## What's new | ||
@@ -14,0 +17,0 @@ Fixed render inside <ImageLoad /> component |
610044
0.03%104
6.12%54
5.88%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added