Skip to content

Commit c678118

Browse files
authored
Prevent multiple results being submitted by viewport transition completion on Android (#813)
1 parent d887f9e commit c678118

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

android/src/main/kotlin/com/mapbox/maps/mapbox_maps/ViewportController.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ class ViewportController(
5454
return
5555
}
5656
val transition = viewportPlugin.transitionFromFLTTransition(transitionStorage, cameraPlugin)
57+
var callbackCopy: ((Result<Boolean>) -> Unit)? = callback
5758
viewportPlugin.transitionTo(state, transition) { success ->
58-
callback(Result.success(success))
59+
callbackCopy?.invoke(Result.success(success))
60+
callbackCopy = null
5961
}
6062
} catch (error: Exception) {
6163
logE("Viewport", "Could not create viewport state ouf of options: $stateStorage")

0 commit comments

Comments
 (0)