Avoid clipboard error on Safari for iOS

This commit is contained in:
J. Ryan Stinnett 2020-09-29 16:26:38 +01:00
parent 684a4cb19a
commit e18ff8debb
3 changed files with 3 additions and 3 deletions

View file

@ -47,7 +47,7 @@ const ClientTile: React.FC<IProps> = ({ client, link }: IProps) => {
if (copyString !== '') { if (copyString !== '') {
inviteButton = ( inviteButton = (
<Button <Button
onClick={() => navigator.clipboard.writeText(copyString)} onClick={() => navigator.clipboard?.writeText(copyString)}
flashChildren="Invite copied" flashChildren="Invite copied"
> >
Copy invite Copy invite

View file

@ -134,7 +134,7 @@ const LinkCreatedTile: React.FC<ILinkCreatedTileProps> = (props) => {
icon={copyIcon} icon={copyIcon}
flashIcon={tickIcon} flashIcon={tickIcon}
onClick={(): void => { onClick={(): void => {
navigator.clipboard.writeText(props.link); navigator.clipboard?.writeText(props.link);
}} }}
ref={buttonRef} ref={buttonRef}
> >

View file

@ -58,7 +58,7 @@ const InviteTile: React.FC<IProps> = ({ children, client, link }: IProps) => {
case ClientKind.TEXT_CLIENT: case ClientKind.TEXT_CLIENT:
// TODO: copy to clipboard // TODO: copy to clipboard
invite = <p>{client.toInviteString(link)}</p>; invite = <p>{client.toInviteString(link)}</p>;
navigator.clipboard.writeText(client.copyString(link)); navigator.clipboard?.writeText(client.copyString(link));
inviteUseString = `These are instructions for ${client.name}.`; inviteUseString = `These are instructions for ${client.name}.`;
break; break;
} }