Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

741 B
Raw Blame
import type { PasteEventPayload } from "expo-paste-input";
import { useCallback } from "react";

/**
 * Returns a stable `onPaste` handler for `TextInputWrapper` from
 * `expo-paste-input`.  When the user pastes images via the OS paste gesture,
 * `onImages` is called with the pasted URIs.  Text pastes are left to the
 * native TextInput — no extra handling is needed.
 *
 * Used by both the thread composer and the new-task draft screen.
 */
export function useNativePaste(onImages: (uris: ReadonlyArray<string>) => void) {
  return useCallback(
    (payload: PasteEventPayload) => {
      if (payload.type === "images" && payload.uris && payload.uris.length > 0) {
        onImages(payload.uris);
      }
    },
    [onImages],
  );
}