bet panel: disable input focus on mobile

This commit is contained in:
mantikoros 2022-09-09 00:02:06 -05:00
parent eac56b1f4f
commit 2ebb83418c
2 changed files with 9 additions and 8 deletions

View File

@ -41,6 +41,7 @@ import { PillButton } from './buttons/pill-button'
import { YesNoSelector } from './yes-no-selector'
import { PlayMoneyDisclaimer } from './play-money-disclaimer'
import { AlertBox } from './alert-box'
import { isAndroid, isIOS } from 'web/lib/util/device'
export function BetPanel(props: {
contract: CPMMBinaryContract | PseudoNumericContract
@ -184,17 +185,13 @@ function BuyPanel(props: {
const [inputRef, focusAmountInput] = useFocus()
// useEffect(() => {
// if (selected) {
// if (isIOS()) window.scrollTo(0, window.scrollY + 200)
// focusAmountInput()
// }
// }, [selected, focusAmountInput])
function onBetChoice(choice: 'YES' | 'NO') {
setOutcome(choice)
setWasSubmitted(false)
focusAmountInput()
if (!isIOS() && !isAndroid()) {
focusAmountInput()
}
}
function onBetChange(newAmount: number | undefined) {

View File

@ -12,3 +12,7 @@ export function isIOS() {
(navigator.userAgent.includes('Mac') && 'ontouchend' in document)
)
}
export function isAndroid() {
return navigator.userAgent.includes('Android')
}