-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
BugComponent: ImageGood first issueInterested in collaborating? Take a stab at fixing one of these issues.Interested in collaborating? Take a stab at fixing one of these issues.Platform: iOSiOS applications.iOS applications.
Description
So I have this basic network image component. It will probably look similar to the one in the Image Component documents. The question is that when I switch the url, for the image, the image itself will not change to the new one, although it seems to be calling the render function again.
Device: iOS
Using: Mac
React-Native: 0.26.3
import React from 'react'
import {
View,
Image
} from 'react-native'
const NetworkImage = React.createClass({
getInitialState() {
return {
source: this.props.source
}
},
componentWillReceiveProps(newProps) {
if (newProps.source !== this.props.source) {
this.setState({
source: newProps.source
})
}
},
render() {
console.log('source: ', this.props)
return (
<Image
style={this.props.style}
source={this.state.source}
onLoad={() => {
console.log('loaded image!')
}}
onLoadStart={() => {
console.log('load starting')
}}/>)
}
})
module.exports = NetworkImage
npomfret, mikemonteith, MarvinSantos, Anu-Ujin, nisheetsun and 16 moretamsamani
Metadata
Metadata
Assignees
Labels
BugComponent: ImageGood first issueInterested in collaborating? Take a stab at fixing one of these issues.Interested in collaborating? Take a stab at fixing one of these issues.Platform: iOSiOS applications.iOS applications.