-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shared Element Transition (Solution provided) #6698
Labels
Comments
Hey! 👋 The issue doesn't seem to contain a minimal reproduction. Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem? |
github-actions
bot
added
Missing repro
This issue need minimum repro scenario
Platform: iOS
This issue is specific to iOS
labels
Nov 12, 2024
I found the issue and implemented a fix. It's just some null/array checks. Lines 573-586: if (_isAsyncSharedTransitionConfigured) {
// this is a new screen, let wait until header will be attached to a screen to make a proper snapshots
_isTabNavigator = YES;
return;
}
REAUIView *navTabScreen = _disappearingScreens[0];
REAUIView *sourceScreen = _disappearingScreens[[_disappearingScreens count] - 1];
REAUIView *targetTabScreen = [REAScreensHelper getActiveTabForTabNavigator:navTabScreen.reactSuperview];
REAUIView *targetScreen = [REAScreensHelper findTopScreenInChildren:targetTabScreen];
if (!layoutedScreen && _isTabNavigator) {
// just wait for the next layout computation for your screen
return;
} Changes: if (_isAsyncSharedTransitionConfigured) {
// this is a new screen, let wait until header will be attached to a screen to make a proper snapshots
_isTabNavigator = YES;
return;
}
// Add safety check for disappearing screens
if ([_disappearingScreens count] == 0) {
return;
}
REAUIView *navTabScreen = _disappearingScreens[0];
REAUIView *sourceScreen = _disappearingScreens[[_disappearingScreens count] - 1];
// Add null checks
if (!navTabScreen || !navTabScreen.reactSuperview) {
return;
}
REAUIView *targetTabScreen = [REAScreensHelper getActiveTabForTabNavigator:navTabScreen.reactSuperview];
REAUIView *targetScreen = [REAScreensHelper findTopScreenInChildren:targetTabScreen];
if (!targetScreen) {
return;
}
if (!layoutedScreen && _isTabNavigator) {
// just wait for the next layout computation for your screen
return;
} Is there any documentation on how to do a pull request here? I don't mind doing it. |
aymather
changed the title
Shared Element Transition
Shared Element Transition (Solution provided)
Nov 13, 2024
aymather
added a commit
to aymather/react-native-reanimated
that referenced
this issue
Nov 13, 2024
…xes: Shared Element Transition (Solution provided) software-mansion#6698
Pull request open #6700 |
github-merge-queue bot
pushed a commit
that referenced
this issue
Dec 4, 2024
#6698 (#6700) 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: - The _disappearingScreens array is empty - navTabScreen or its reactSuperview is null - targetScreen is null App was crashing during shared element transition because of invalid array access. Fixes #6698 --------- Co-authored-by: Krzysztof Piaskowy <krzysztof.piaskowy@swmansion.com>
tomekzaw
pushed a commit
that referenced
this issue
Dec 9, 2024
#6698 (#6700) 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: - The _disappearingScreens array is empty - navTabScreen or its reactSuperview is null - targetScreen is null App was crashing during shared element transition because of invalid array access. Fixes #6698 --------- Co-authored-by: Krzysztof Piaskowy <krzysztof.piaskowy@swmansion.com>
tomekzaw
pushed a commit
that referenced
this issue
Dec 9, 2024
#6698 (#6700) 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: - The _disappearingScreens array is empty - navTabScreen or its reactSuperview is null - targetScreen is null App was crashing during shared element transition because of invalid array access. Fixes #6698 --------- Co-authored-by: Krzysztof Piaskowy <krzysztof.piaskowy@swmansion.com>
tjzel
pushed a commit
that referenced
this issue
Dec 13, 2024
#6698 (#6700) 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: - The _disappearingScreens array is empty - navTabScreen or its reactSuperview is null - targetScreen is null App was crashing during shared element transition because of invalid array access. Fixes #6698 --------- Co-authored-by: Krzysztof Piaskowy <krzysztof.piaskowy@swmansion.com>
tjzel
pushed a commit
that referenced
this issue
Dec 13, 2024
#6698 (#6700) 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: - The _disappearingScreens array is empty - navTabScreen or its reactSuperview is null - targetScreen is null App was crashing during shared element transition because of invalid array access. Fixes #6698 --------- Co-authored-by: Krzysztof Piaskowy <krzysztof.piaskowy@swmansion.com>
tjzel
pushed a commit
that referenced
this issue
Dec 13, 2024
#6698 (#6700) 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: - The _disappearingScreens array is empty - navTabScreen or its reactSuperview is null - targetScreen is null App was crashing during shared element transition because of invalid array access. Fixes #6698 --------- Co-authored-by: Krzysztof Piaskowy <krzysztof.piaskowy@swmansion.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Description
It's really hard for me to know what's going on here, but I can sometimes reproduce this error by pressing a button in my app which leads to a crash. I used Claude to interpret the crash logs for me and it's saying that the error has to do with the Shared Element package. I've also attached the full crash logs in
crash-logs.txt
.crash-logs.txt
Steps to reproduce
Snack or a link to a repository
unable to
Reanimated version
3.16.1
React Native version
0.74.3
Platforms
iOS
JavaScript runtime
None
Workflow
React Native
Architecture
Fabric (New Architecture)
Build type
Debug app & dev bundle
Device
iOS simulator
Device model
iPhone 15 Plus
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: