-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix: Cannot paste magic code on mWeb iOS #23254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
6783d35
9007984
623de6a
137f9b6
0e77b18
fc7ac21
b5a35a1
642ddf6
9f171bc
87caa9a
b3c50af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,10 +300,7 @@ 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(); | ||
const isBrowser = Boolean(Browser.getBrowser()); | ||
|
||
return ( | ||
<> | ||
|
@@ -323,7 +320,7 @@ function MagicCodeInput(props) { | |
> | ||
<Text style={[styles.magicCodeInput, styles.textAlignCenter]}>{decomposeString(props.value, props.maxLength)[index] || ''}</Text> | ||
</View> | ||
<View style={[StyleSheet.absoluteFillObject, styles.w100, isMobileSafari ? styles.bgTransparent : styles.opacity0]}> | ||
<View style={[StyleSheet.absoluteFillObject, styles.w100, styles.bgTransparent]}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we always passing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a comment here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tienifr bump! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reading the comment made me wonder why would we need this now in the first place, what does it do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is that we're basically doing a "hidden input" trick here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm just curious. Because now we do the trick with styles and props on the |
||
<TextInput | ||
ref={(ref) => (inputRefs.current[index] = ref)} | ||
autoFocus={index === 0 && props.autoFocus && !props.shouldDelayFocus} | ||
|
@@ -348,8 +345,9 @@ function MagicCodeInput(props) { | |
onKeyPress={onKeyPress} | ||
onPress={(event) => onPress(event, index)} | ||
onFocus={onFocus} | ||
caretHidden={isMobileSafari} | ||
inputStyle={[isMobileSafari ? styles.magicCodeInputTransparent : undefined]} | ||
caretHidden | ||
textInputContainerStyles={[styles.borderNone]} | ||
tienifr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
inputStyle={[styles.magicCodeInputTransparent, isBrowser ? styles.magicCodeInputTransparentWebKit : undefined]} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's move the |
||
accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT} | ||
/> | ||
</View> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2536,6 +2536,9 @@ const styles = { | |
magicCodeInputTransparent: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok so my suggestion, is to take the inputTransparent: {
color: 'transparent',
...(Browser.getBrowser() ? {
caretColor: 'transparent',
...etc
} : {}),
}, Can we do something like this? |
||
color: 'transparent', | ||
caretColor: 'transparent', | ||
}, | ||
|
||
magicCodeInputTransparentWebKit: { | ||
WebkitTextFillColor: 'transparent', | ||
// After setting the input text color to transparent, it acquires the background-color. | ||
// However, it is not possible to override the background-color directly as explained in this resource: https://developer.mozilla.org/en-US/docs/Web/CSS/:autofill | ||
|
Uh oh!
There was an error while loading. Please reload this page.