Skip to content

Commit

Permalink
cleanup code and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
akinwale committed May 16, 2023
1 parent 7a7d3d6 commit d97a58e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/MagicCodeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ function MagicCodeInput(props) {
const [focusedIndex, setFocusedIndex] = useState(0);
const [editIndex, setEditIndex] = useState(0);

// For Safari on iOS, a transparent background will be used instead of opacity: 0, so that magic code pasting can work.
// Alternate styling will be applied based on this condition.
const isMobileSafari = Browser.isMobileSafari();

useImperativeHandle(props.innerRef, () => ({
focus() {
setFocusedIndex(0);
Expand Down Expand Up @@ -260,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 (
<>
<View style={[styles.magicCodeInputContainer]}>
Expand Down

0 comments on commit d97a58e

Please sign in to comment.