diff --git a/src/components/MagicCodeInput.js b/src/components/MagicCodeInput.js index b33e686001db..f9127c755f31 100644 --- a/src/components/MagicCodeInput.js +++ b/src/components/MagicCodeInput.js @@ -8,6 +8,7 @@ import CONST from '../CONST'; import Text from './Text'; import TextInput from './TextInput'; import FormHelpMessage from './FormHelpMessage'; +import * as Browser from '../libs/Browser'; const propTypes = { /** Name attribute for the input */ @@ -255,6 +256,11 @@ function MagicCodeInput(props) { } }; + // We need to check the browser because, in iOS Safari, an input in a container with its opacity set to + // 0 (completely transparent) cannot handle user interaction, hence the Paste option is never shown. + // Alternate styling will be applied based on this condition. + const isMobileSafari = Browser.isMobileSafari(); + return ( <> @@ -266,7 +272,7 @@ function MagicCodeInput(props) { {decomposeString(props.value)[index] || ''} - + (inputRefs.current[index] = ref)} autoFocus={index === 0 && props.autoFocus} @@ -291,6 +297,8 @@ function MagicCodeInput(props) { onKeyPress={onKeyPress} onPress={(event) => onPress(event, index)} onFocus={onFocus} + caretHidden={isMobileSafari} + inputStyle={[isMobileSafari ? styles.magicCodeInputTransparent : undefined]} /> diff --git a/src/styles/styles.js b/src/styles/styles.js index a8e86b220a03..7f49c50743cc 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -2332,6 +2332,10 @@ const styles = { lineHeight: variables.inputHeight, }, + magicCodeInputTransparent: { + color: 'transparent', + }, + iouAmountText: { ...headlineFont, fontSize: variables.iouAmountTextSize,