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 !== '') {
inviteButton = (
<Button
onClick={() => navigator.clipboard.writeText(copyString)}
onClick={() => navigator.clipboard?.writeText(copyString)}
flashChildren="Invite copied"
>
Copy invite

View File

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

View File

@ -58,7 +58,7 @@ const InviteTile: React.FC<IProps> = ({ children, client, link }: IProps) => {
case ClientKind.TEXT_CLIENT:
// TODO: copy to clipboard
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}.`;
break;
}