Skip to content

[fix] Clipboard: align setString return type with React Native - #2900

Closed
KuroGeo wants to merge 2 commits into
necolas:masterfrom
KuroGeo:fix/clipboard-copy-result
Closed

KuroGeo wants to merge 2 commits into
necolas:masterfrom
KuroGeo:fix/clipboard-copy-result

Conversation

@KuroGeo

@KuroGeo KuroGeo commented Oct 9, 2026 •

Copy link
Copy Markdown

Align Clipboard.setString with React Native's void return contract, following the review feedback. React Native's NativeClipboard spec does not return a copy-success status.

Remove the Web-specific boolean return and update the API documentation and clipboard example accordingly. This changes the previous Web return contract: callers should no longer use the result as a copy-success indication. The extra tests from the initial revision have been removed as requested; copying, exception handling, and cleanup remain unchanged.

Validation on Node 24.13.0:

  • Complete existing DOM / Node suites: 721 tests passed, 6 existing skips, 220 snapshots passed.
  • Repository formatting, lint, and diff checks pass.
  • Isolated local checks confirm the method returns no value and cleans up its temporary node and selection whether the browser command succeeds, returns false, or throws.
  • Flow is not verified locally: the pinned 0.148.0 macOS binary exits with architecture error -86 on this arm64 host. Upstream CI runs the checker on Linux.

AI assistance: OpenAI Codex implemented the initial fix and this revision on behalf of @KuroGeo.

@codesandbox-ci

codesandbox-ci Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 891bfc6:

Sandbox Source
react-native-web-examples Configuration

@zoontek

zoontek commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

@KuroGeo KuroGeo changed the title [fix] Clipboard: return the actual copy command result [fix] Clipboard: align setString return type with React Native Oct 9, 2026
@KuroGeo

KuroGeo commented Oct 9, 2026

Copy link
Copy Markdown
Author

Updated in 891bfc6. Clipboard.setString now returns void, and the API docs and clipboard example have been updated to match. The additional tests from the initial revision have been removed.

The existing DOM and Node suites pass: 721 tests passed, 6 existing skips, and 220 snapshots passed. Formatting and lint checks also pass.

@zoontek

zoontek commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Closing this. The divergence from react-native is explained in the docs, and Clipboard is deprecated for a while and will be removed in React Native 0.89. It does not worth it to introduce a breaking change for such a short amount of time (as it will be removed from here too)

@zoontek zoontek closed this Oct 10, 2026
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.

2 participants