Calling function after animation ended in react-native-maps

Viewed 1514
region: new MapView.AnimatedRegion({
        longitude: 4.70821527747714,
        latitudeDelta: 1.384276459048536,
        latitude: 43.31340937725116,
        longitudeDelta: 2.066803805399701,
      });
....................
....................
this.state.region
    .timing({
      latitude: region.latitude._value,
      longitude: region.longitude._value,
      latitudeDelta: 0.5,
      longitudeDelta: 0.5,
    })
    .start();

this.setState({
  zoomLevel: 8,
  regionUpdated: true,
});

This is what I used in react-native.

I want to call the setState function after animation ended. But now, it's called during the animation.

I think it will be great if animation function is promise function. But I am not sure.

How can I solve this problem?

1 Answers
Related