Skip to content
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

iOS crash with NSInternalInconsistencyException, UITargetedPreview #103

Open
rrebase opened this issue May 14, 2024 · 9 comments
Open

iOS crash with NSInternalInconsistencyException, UITargetedPreview #103

rrebase opened this issue May 14, 2024 · 9 comments

Comments

@rrebase
Copy link

rrebase commented May 14, 2024

Description

First of all, amazing work on this library 🙌

I've ran into an issue with unmounting the component that causes a crash on iOS. This can be reproduced by having the context menu open while navigating to a different screen. It should close unmount and close gracefully, but instead it crashes.

At first glance, it seems different from the other reported issues.

Crash

ERROR  Your app just crashed. See the error below.
NSInternalInconsistencyException: This UITargetedPreview initializer requires that the view is in a window, but it is not. Either fix that, or use the other initializer that takes a target. (view: <ReactNativeIosContextMenu.RNIContextMenuView: 0x10d85de00> => <RCTView: 0x10b913ff0> => <RCTView: 0x31f75c510> => <RCTView: 0x31f75b910> => <RCTScrollContentView: 0x31f750f90> => <RCTCustomScrollView: 0x10e286a00> => <RCTScrollView: 0x10e286400> => <RCTView: 0x31f764f60> => <RCTView: 0x31f7652e0> => <RCTView: 0x31f7694a0> => <RNSScreenView: 0x10e13e000> => <UIViewControllerWrapperView: 0x10b913d40> => <UINavigationTransitionView: 0x10b0b12e0> => <UILayoutContainerView: 0x10b0b0f30> => <RNSScreenNavigationContainerView: 0x10b0ad5b0> => <RCTView: 0x10b0c17f0> => <RCTView: 0x10b0c1b70> => <RCTView: 0x10b0c1ef0> => <RNSScreenView: 0x10d235000>)
ios-context-menu-crash.mp4

Minimal repro: https://github.com/rrebase/ios-context-menu-crash-demo

Note: have to precise with the tap + long press timing to cause the crash 😄

@rrebase rrebase changed the title iOS crash with NSInternalInconsistencyException: This UITargetedPreview initializer requires that the view is in a window iOS crash with NSInternalInconsistencyException, UITargetedPreview May 14, 2024
@rrebase
Copy link
Author

rrebase commented May 15, 2024

The helpful workaround mentioned here works, but not in all cases

@JustJoostNL
Copy link

@dominicstop is there any update on this? many people have this issue, and the workaround mentioned doesn't work always or is sometimes not possible to use.

@dominicstop
Copy link
Owner

dominicstop commented Dec 20, 2024

hello, i apologize but i do not have the resources to maintain multiple versions of this library; so i can't really support 2.x anymore

i recommend upgrading to 3.x (and submitting a PR in the examples to reproduce the error so i can debug the issue)

if the fix is simple enough, i will backport the patch to 2.x.

thank you for understanding.

@JustJoostNL
Copy link

I can try the3.x version if you want, but is there any chance that the problem doesn’t occur there? And do you want me to create an issue or PR for the reproducible example?

Is 3.x stable already, to use in production?

@JustJoostNL
Copy link

@dominicstop I've created a new build with the following versions:

I got the following error: Unable to resolve "./native_components/RNIDetachedView" from "node_modules\react-native-ios-utilities\src\index.ts"

So I guess not stable yet? 😄

@JustJoostNL
Copy link

@dominicstop Anything I can do to try and help figure this out?

@iykazrji
Copy link

iykazrji commented Jan 3, 2025

Running into the same issue as @JustJoostNL when trying to use 3.x version of this library.
I guess we'd have to wait for v3.x to be stable, had to pull this package out of a production project for the time being

@VGerris
Copy link

VGerris commented Jan 15, 2025

I had a crash too with these deps :
"react": "18.3.1",
"react-dom": "18.3.1",
"react-native": "0.76.6",
"react-native-gesture-handler": "~2.20.2",
"react-native-ios-context-menu": "^3.1.0",
"react-native-ios-utilities": "^5.1.0",
"react-native-reanimated": "^3.16.7",

Latest as of now I think ? It crashes occassionally using one build but on another it crashes every time but I don's get this stack trace. Happy to help testing if required, thank you.
seems to happen mostly when moving between visible screen and context menu

@dominicstop
Copy link
Owner

hello, i'll take a look again (i'm not really actively doing OSS anymore, so the fix might take a while)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants