Skip to content

Preview always visible instead of only in context menuΒ #166

@nicecatch

Description

@nicecatch

When using the preview prop on BaseContextMenu, the preview element is rendered directly in the UI and is always visible. Based on the docs and iOS behavior, it should only appear when the context menu is opened (on long press).

Example Code (from repo examples/ folder):

<BaseContextMenu
  title={"Custom Preview"}
  actions={[
    {
      title: "Test Item",
    },
  ]}
  previewBackgroundColor="transparent"
  preview={
    <View style={[styles.rectangle, { backgroundColor: "green" }]} nativeID="WORKAROUND" />
  }
  onPreviewPress={() => Alert.alert("Preview Tapped")}
>
  <View nativeID="WORKAROUND" style={[styles.rectangle, { backgroundColor: "red" }]} />
</BaseContextMenu>

Expected Behavior

Only the red rectangle should be visible in the normal UI.

The green rectangle (preview) should only appear inside the context menu when long pressing the red rectangle.

Actual Behavior

The green rectangles is rendered directly on screen.

Environment
[email protected]
[email protected]
expo@54

Platform: iOS (tested on simulator and device on ios 26)

Screenshots

Image

Additional Notes
Might be related to how preview is mounted internally. In my case, the preview component renders directly instead of only being used by the context menu interaction.

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