Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/PasteInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ import React, {
forwardRef,
useImperativeHandle,
} from 'react';
import { Platform, TextInput, NativeEventEmitter } from 'react-native';
import {
Platform,
TextInput,
NativeEventEmitter,
findNodeHandle,
} from 'react-native';
import type {
PastedFile,
PasteInputProps,
Expand Down Expand Up @@ -78,9 +83,14 @@ function PasteInputIOSComponent(

// Register/unregister with native module on mount/unmount
useEffect(() => {
// Get the native tag from the ref's internal __nativeTag property
// @ts-ignore - __nativeTag is an internal property
const nativeTag = textInputRef.current?.__nativeTag;
// Use findNodeHandle so we work across both legacy and Fabric. Reading
// `__nativeTag` directly returns undefined on RN 0.76+/Fabric — the
// renderer exposes the tag as `_nativeTag` (single underscore) on the
// Fabric instance — which silently breaks paste interception because
// the input is never registered with the native module. See #54.
const nativeTag = textInputRef.current
? findNodeHandle(textInputRef.current)
: null;

if (!nativeTag) {
if (__DEV__) {
Expand Down
Loading