Skip to content

iOS crash with NSInternalInconsistencyException, UITargetedPreview #103

@rrebase

Description

@rrebase

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 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions