From 98039941943cb272247dc1e7133a40cdfc03b028 Mon Sep 17 00:00:00 2001 From: Tomek Zawadzki Date: Sun, 5 May 2024 15:09:04 +0200 Subject: [PATCH 1/2] Fix EXC_BAD_ACCESS crash on iOS in `[REAAnimationsManager clearSharedTransitionConfigForTag:]` --- apple/LayoutReanimation/REAAnimationsManager.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apple/LayoutReanimation/REAAnimationsManager.m b/apple/LayoutReanimation/REAAnimationsManager.m index a66e2f0e6d6b..f8e9ffab1e9b 100644 --- a/apple/LayoutReanimation/REAAnimationsManager.m +++ b/apple/LayoutReanimation/REAAnimationsManager.m @@ -619,6 +619,10 @@ - (void)clearAnimationConfigForTag:(NSNumber *)tag - (void)clearSharedTransitionConfigForTag:(NSNumber *)tag { + if (!_clearSharedTransitionConfigForTag) { + // TODO: find out why this method gets called but LayoutAnimationsManager is not initialized + return; + } _clearSharedTransitionConfigForTag(tag); } From 30039763fd3603347be6be7aad439b22f85fc02b Mon Sep 17 00:00:00 2001 From: Tomek Zawadzki Date: Sun, 5 May 2024 15:20:37 +0200 Subject: [PATCH 2/2] Better solution --- apple/LayoutReanimation/REAAnimationsManager.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apple/LayoutReanimation/REAAnimationsManager.m b/apple/LayoutReanimation/REAAnimationsManager.m index f8e9ffab1e9b..16288e5557b6 100644 --- a/apple/LayoutReanimation/REAAnimationsManager.m +++ b/apple/LayoutReanimation/REAAnimationsManager.m @@ -94,6 +94,9 @@ - (instancetype)initWithUIManager:(RCTUIManager *)uiManager _clearAnimationConfigForTag = ^(NSNumber *tag) { // default implementation, this block will be replaced by a setter }; + _clearSharedTransitionConfigForTag = ^(NSNumber *tag) { + // default implementation, this block will be replaced by a setter + }; #ifndef NDEBUG _checkDuplicateSharedTag = ^(REAUIView *view, NSNumber *viewTag) { // default implementation, this block will be replaced by a setter @@ -619,10 +622,6 @@ - (void)clearAnimationConfigForTag:(NSNumber *)tag - (void)clearSharedTransitionConfigForTag:(NSNumber *)tag { - if (!_clearSharedTransitionConfigForTag) { - // TODO: find out why this method gets called but LayoutAnimationsManager is not initialized - return; - } _clearSharedTransitionConfigForTag(tag); }