From fcf23d2e283e4031767864f6360051d9326c2475 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Tue, 1 Sep 2020 11:22:01 +0200 Subject: [PATCH] Fix crash if Shared Element ID is invalid (#6511) Fixes a hard-crash on iOS if the specified Shared Element ID could not be found/invalid nativeID has been set Co-authored-by: Yogev Ben David --- lib/ios/SharedElementTransitionsCreator.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ios/SharedElementTransitionsCreator.m b/lib/ios/SharedElementTransitionsCreator.m index 7fc381e1c8b..4a5f0c65f0a 100644 --- a/lib/ios/SharedElementTransitionsCreator.m +++ b/lib/ios/SharedElementTransitionsCreator.m @@ -16,6 +16,10 @@ @implementation SharedElementTransitionsCreator for (SharedElementTransitionOptions* transitionOptions in sharedElementTransitions) { UIView *fromView = [RNNElementFinder findElementForId:transitionOptions.fromId inView:fromVC.reactView]; UIView *toView = [RNNElementFinder findElementForId:transitionOptions.toId inView:toVC.reactView]; + if (fromView == nil || toView == nil) { + break; + } + SharedElementAnimator* sharedElementAnimator = [[SharedElementAnimator alloc] initWithTransitionOptions:transitionOptions fromView:fromView toView:toView