diff --git a/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java b/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java index e98c7706ca1..98d1d61f807 100644 --- a/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +++ b/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java @@ -189,6 +189,16 @@ public void deleteView(final View view, final LayoutAnimationListener listener) } public boolean isLayoutAnimationEnabled() { + // In case the user rapidly reloads the app, there is a possibility that the active instance may + // not be available. + // However, the code will still attempt to trigger the layout animation of views that are going + // to be dropped. + // This is required as without it, the `mAnimationsManager.isLayoutAnimationEnabled` + // would crash when trying to get the uiManager from the context. + if (!mContext.hasActiveReactInstance()) { + return false; + } + maybeInit(); return mAnimationsManager.isLayoutAnimationEnabled(); }