software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
9.09k stars 1.32k forks source link

fix: Empty array & null checks in handleTabNavigatorChange method fixes #6698 #6700

Open aymather opened 1 week ago

aymather commented 1 week ago

Fixes: Shared Element Transition (Solution provided) #6698

Add safety checks in handleTabNavigatorChange to prevent crash

This fixes a crash that occurs when _disappearingScreens array is empty or contains invalid objects by adding appropriate null checks and bounds checking.

The crash would occur when:

App was crashing during shared element transition because of invalid array access.

Fixes #6698

aymather commented 1 week ago

I fixed one of the errors, but I'm not quite sure how exactly to fix the other failing check? Can I get some guidance?