using onViewTransformed callback to setState() in the parent component causes infinite loop
I’m new in React Native so not sure if is it a bug or just my misunderstanding but there is an issue for me when I call the onViewTransformed callback like that
import Image from ‘react-native-transformable-image’;
class Parent extends Component {
constructor(props) { super(props); this.transform = this.transform.bind(this); this.state = { scale: 1, translateX: 0, translateY: 0 }; }
handleTransform(data) { this.setState({ scale: data.scale, translateX: data.translateX, translateY: data.translateY }); }
render() { return ( <Image ... onViewTransformed={this.transform} /> ); } }
it goes to an infinite loop. React Native error sheet says that can be because of componentDidUpdate or componentWillUpdate method.
So what am I missing ??
Thanks in advance.