bet panel: disable input focus on mobile
This commit is contained in:
		
							parent
							
								
									eac56b1f4f
								
							
						
					
					
						commit
						2ebb83418c
					
				|  | @ -41,6 +41,7 @@ import { PillButton } from './buttons/pill-button' | ||||||
| import { YesNoSelector } from './yes-no-selector' | import { YesNoSelector } from './yes-no-selector' | ||||||
| import { PlayMoneyDisclaimer } from './play-money-disclaimer' | import { PlayMoneyDisclaimer } from './play-money-disclaimer' | ||||||
| import { AlertBox } from './alert-box' | import { AlertBox } from './alert-box' | ||||||
|  | import { isAndroid, isIOS } from 'web/lib/util/device' | ||||||
| 
 | 
 | ||||||
| export function BetPanel(props: { | export function BetPanel(props: { | ||||||
|   contract: CPMMBinaryContract | PseudoNumericContract |   contract: CPMMBinaryContract | PseudoNumericContract | ||||||
|  | @ -184,18 +185,14 @@ function BuyPanel(props: { | ||||||
| 
 | 
 | ||||||
|   const [inputRef, focusAmountInput] = useFocus() |   const [inputRef, focusAmountInput] = useFocus() | ||||||
| 
 | 
 | ||||||
|   // useEffect(() => {
 |  | ||||||
|   //   if (selected) {
 |  | ||||||
|   //     if (isIOS()) window.scrollTo(0, window.scrollY + 200)
 |  | ||||||
|   //     focusAmountInput()
 |  | ||||||
|   //   }
 |  | ||||||
|   // }, [selected, focusAmountInput])
 |  | ||||||
| 
 |  | ||||||
|   function onBetChoice(choice: 'YES' | 'NO') { |   function onBetChoice(choice: 'YES' | 'NO') { | ||||||
|     setOutcome(choice) |     setOutcome(choice) | ||||||
|     setWasSubmitted(false) |     setWasSubmitted(false) | ||||||
|  | 
 | ||||||
|  |     if (!isIOS() && !isAndroid()) { | ||||||
|       focusAmountInput() |       focusAmountInput() | ||||||
|     } |     } | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|   function onBetChange(newAmount: number | undefined) { |   function onBetChange(newAmount: number | undefined) { | ||||||
|     setWasSubmitted(false) |     setWasSubmitted(false) | ||||||
|  |  | ||||||
|  | @ -12,3 +12,7 @@ export function isIOS() { | ||||||
|     (navigator.userAgent.includes('Mac') && 'ontouchend' in document) |     (navigator.userAgent.includes('Mac') && 'ontouchend' in document) | ||||||
|   ) |   ) | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | export function isAndroid() { | ||||||
|  |   return navigator.userAgent.includes('Android') | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user