seekshiva / react-native-remote-svg

Adds support for loading svg images in React Native
MIT License
184 stars 71 forks source link

componentWillReceiveProps is deprecated and will be removed in the next major version of RN #48

Closed Bruno-Furtado closed 2 years ago

Bruno-Furtado commented 4 years ago

Feature Request

Use static getDerivedStateFromProps instead of componentWillReceiveProps.

Why it is needed

componentWillReceiveProps is deprecated and will be removed in the next major version of React Native.

mvinet commented 3 years ago

Any update ?

waqasxh commented 2 years ago

in SvgImage.js file replace componentWillReceiveProps(nextProps) { const prevUri = this.props.source && this.props.source.uri; const nextUri = nextProps.source && nextProps.source.uri;

with componentDidUpdate(prevProps) { const prevUri = prevProps.source && prevProps.source.uri; const nextUri = this.props.source && this.props.source.uri;

seekshiva commented 2 years ago

Sorry that this got missed out. I'll need to check on my email notification settings.

I've convert this to a functional component using Hooks and released this at 2.0.9. Please check this to see if it works without issues.