Repository navigation
v1.15.0
Minor Changes
-
5890272: Add sharing: one button that opens the share sheet on phones and tablets and copies a titled link everywhere else.
useShare(fromreact-smart-copy) returnsshare,status(idle,sharing,shared,copiedorerror) andmethod.methodis"native"or"copy", so the button can say "Share…" or "Copy link". It is"copy"during server rendering, then follows the device.react-smart-copy/share(framework-agnostic):shareOrCopy(content, options)never rejects. It resolves toshared,copied(with its reason:preferred,unsupportedorfallback),cancelledorerrorwith a typedCopyError. Closing the share sheet iscancelled: never an error, and never a surprise copy. AlsoshareMethodanddescribeShareError.mode:"auto"(default) uses the share sheet on touch-first devices,"native"uses it wherever available, and"copy"always copies. When the share sheet fails, the link is copied instead (fallback: falsereports the error instead).- Links are checked like everything in
react-smart-copy/link: safe schemes only, credentials removed, tracking parameters removed withclean: true, titles cleaned. Files go only to a share sheet that accepts them. react-smart-copy/linkconstants are now marked pure, so bundles that don't use them drop them.