Skip to content

Conversation

@solaoi
Copy link

@solaoi solaoi commented Dec 16, 2025

Overview

I noticed that Clipboard.addListener does not fire on iOS.

The root cause is that RNCClipboard exports addListener / removeListeners as no-op methods, which prevents RCTEventEmitter from tracking the listener count and calling startObserving.

As a result, clipboard change events are not delivered to JavaScript even though UIPasteboardChangedNotification is observed natively.

This PR fixes the issue by delegating both exported methods to the superclass (RCTEventEmitter) implementation so that listener tracking and observation lifecycle work as intended.

Related issue: #231

Test Plan

  1. Build and run the example app (or any RN app using this library) on iOS.
  2. Add a listener:
Clipboard.addListener(() => console.log('clipboard changed'))
  1. Trigger a clipboard update (e.g. copy text via the iOS selection menu).
  2. Verify the callback is invoked on iOS.

RNCClipboard overrode addListener/removeListeners with no-op stubs,
which prevents RCTEventEmitter from tracking listener count and
starting observation. Delegate both methods to the superclass so
Clipboard.addListener works on iOS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant