Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-async-image-animated",
"version": "4.3.0",
"version": "4.3.1",
"description": "Asynchronous loading Image component for React Native.",
"main": "index.js",
"scripts": {
Expand Down
13 changes: 10 additions & 3 deletions src/AsyncImageAnimated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ interface Props {
placeholderSource?: ImageSource,
source: NetworkImage,
style: ViewStyle,
resizeMode?: string
}

interface State {
Expand Down Expand Up @@ -92,6 +93,10 @@ export default class AsyncImageAnimated extends Component<Props, State> {
style,
} = this.props

let {
resizeMode
} = this.props

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a default prop for this and then 🚀


const {
failed,
imageOpacity,
Expand All @@ -102,20 +107,22 @@ export default class AsyncImageAnimated extends Component<Props, State> {
placeholderScale,
} = this.state

resizeMode = resizeMode === "" ? 'contain' : resizeMode

return (
<View style={style}>

{!failed &&
<Animated.Image
key={imageKey}
source={source}
resizeMode={'contain'}
resizeMode={resizeMode}
style={[
style,
{
opacity: imageOpacity,
position: 'absolute',
resizeMode: 'contain',
resizeMode: resizeMode,
},
]}
onLoad={this.onLoad}
Expand All @@ -130,7 +137,7 @@ export default class AsyncImageAnimated extends Component<Props, State> {
{
opacity: placeholderOpacity,
position: 'absolute',
resizeMode: 'contain',
resizeMode: resizeMode,
},
]} />
}
Expand Down