Repository: expo/expo
File: packages/expo-router/src/link/elements.tsx (TypeScript)

Code before:
   */
  displayInline?: boolean;
  /**
   * If true, the menu item will be displayed as destructive.
   *
   * https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/destructive
   */
  destructive?: boolean;
  children: ReactElement<LinkMenuActionProps> | ReactElement<LinkMenuActionProps>[];
}

/**
 * Groups context menu actions for a link.
 *
 * If multiple `Link.Menu` components are used within a single `Link`, only the first will be rendered.
 * Only `Link.MenuAction` and `LinkMenuAction` components are allowed as children.
 *
 * @example
 * ```tsx
 * <Link.Menu>
 *   <Link.MenuAction title="Action 1" onPress={() => {}} />
 *   <Link.MenuAction title="Action 2" onPress={() => {}} />
 * </Link.Menu>
 * ```
 *
 * **Note:** You can use the alias `Link.Menu` for this component.
 *
 * @platform ios
 */
export const LinkMenu: React.FC<LinkMenuProps> = (props) => {
  if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {
    return null;
  }
  const children = React.Children.toArray(props.children).filter(
    (child) => isValidElement(child) && (child.type === LinkMenuAction || child.type === LinkMenu)
  );
  return (
    <NativeLinkPreviewAction
      {...props}
      title={props.title ?? ''}
      onSelected={() => {}}
      children={children}
    />
  );
};

export interface LinkPreviewProps {
  /**
   * Sets the preferred width of the preview.
   * If not set, full width of the screen will be used.
   *

Review comment (suggestion):
```suggestion
 * > **Note**: You can use the alias `Link.Menu` for this component.
```

Let's use the default callout type for the note.

Code after:
   */
  displayInline?: boolean;
  /**
   * If `true`, the menu item will be displayed as destructive.
   *
   * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/destructive) for more information.
   */
  destructive?: boolean;
  children: ReactElement<LinkMenuActionProps> | ReactElement<LinkMenuActionProps>[];
}

/**
 * Groups context menu actions for a link.
 *
 * If multiple `Link.Menu` components are used within a single `Link`, only the first will be rendered.
 * Only `Link.MenuAction` and `LinkMenuAction` components are allowed as children.
 *
 * @example
 * ```tsx
 * <Link.Menu>
 *   <Link.MenuAction title="Action 1" onPress={() => {}} />
 *   <Link.MenuAction title="Action 2" onPress={() => {}} />
 * </Link.Menu>
 * ```
 *
 * > **Note**: You can use the alias `Link.Menu` for this component.
 *
 * @platform ios
 */
export const LinkMenu: React.FC<LinkMenuProps> = (props) => {
  if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {
    return null;
  }
  const children = React.Children.toArray(props.children).filter(
    (child) => isValidElement(child) && (child.type === LinkMenuAction || child.type === LinkMenu)
  );
  return (
    <NativeLinkPreviewAction
      {...props}
      title={props.title ?? ''}
      onSelected={() => {}}
      children={children}
    />
  );
};

export interface LinkPreviewProps {
  /**
   * Sets the preferred width of the preview.
   * If not set, full width of the screen will be used.
   *