Skip to content

Commit e8ba8c3

Browse files
committed
fix(android): crash while drawing in dispatchGetDisplayList
1 parent 629df83 commit e8ba8c3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

android/src/main/java/com/swmansion/rnscreens/stack/anim/ScreensAnimation.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ internal class ScreensAnimation(
1212
t: Transformation,
1313
) {
1414
super.applyTransformation(interpolatedTime, t)
15-
// interpolated time should be the progress of the current transition
16-
mFragment.dispatchTransitionProgressEvent(interpolatedTime, !mFragment.isResumed)
15+
// This is called while android is drawing. The event might be intercepted by reanimated
16+
// which could trigger a sync mount, which can alter the native view hierarchy, which
17+
// could lead to a crash, see: https://github.com/software-mansion/react-native-screens/issues/3321
18+
mFragment.view?.post {
19+
// interpolated time should be the progress of the current transition
20+
mFragment.dispatchTransitionProgressEvent(interpolatedTime, !mFragment.isResumed)
21+
}
1722
}
1823
}

0 commit comments

Comments
 (0)