chore: fix save image button opening keyboard on ios

This commit is contained in:
Aman Harwara
2023-05-12 20:42:32 +05:30
parent 5491e3137a
commit e1c5319965
2 changed files with 11 additions and 5 deletions

View File

@@ -637,7 +637,7 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"
SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234
boost: 57d2868c099736d80fcd648bf211b4431e51a558
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: 60195509584153283780abdac5569feffb8f08cc
@@ -658,7 +658,7 @@ SPEC CHECKSUMS:
MMKV: 9c4663aa7ca255d478ff10f2f5cb7d17c1651ccd
MMKVCore: 89f5c8a66bba2dcd551779dea4d412eeec8ff5bb
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCTRequired: bec48f07daf7bcdc2655a0cde84e07d24d2a9e2a
RCTTypeSafety: 171394eebacf71e1cfad79dbfae7ee8fc16ca80a
React: d7433ccb6a8c36e4cbed59a73c0700fc83c3e98a

View File

@@ -1,10 +1,10 @@
import { useApplication } from '@/Components/ApplicationProvider'
import Icon from '@/Components/Icon/Icon'
import Spinner from '@/Components/Spinner/Spinner'
import { isDesktopApplication } from '@/Utils'
import { isDesktopApplication, isIOS } from '@/Utils'
import { BlockWithAlignableContents } from '@lexical/react/LexicalBlockWithAlignableContents'
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
import { classNames } from '@standardnotes/snjs'
import { classNames, Platform } from '@standardnotes/snjs'
import { ElementFormatType, NodeKey } from 'lexical'
import { useCallback, useState } from 'react'
import { $createFileNode } from '../EncryptedFilePlugin/Nodes/FileUtils'
@@ -80,7 +80,13 @@ const RemoteImageComponent = ({ className, src, alt, node, format, nodeKey }: Pr
'flex items-center gap-2.5 rounded border border-border bg-default px-2.5 py-1.5',
!isSaving && 'hover:bg-info hover:text-info-contrast',
)}
onClick={fetchAndUploadImage}
onClick={() => {
const isIOSPlatform = application.platform === Platform.Ios || isIOS()
if (isIOSPlatform && document.activeElement) {
;(document.activeElement as HTMLElement).blur()
}
fetchAndUploadImage().catch(console.error)
}}
disabled={isSaving}
>
{isSaving ? (