fix ios scrolling in bet panel
This commit is contained in:
		
							parent
							
								
									86581a421a
								
							
						
					
					
						commit
						e28dfaaa80
					
				|  | @ -37,6 +37,7 @@ import { | |||
| import { SellRow } from './sell-row' | ||||
| import { useSaveShares } from './use-save-shares' | ||||
| import { SignUpPrompt } from './sign-up-prompt' | ||||
| import { isIOS } from 'web/lib/util/device' | ||||
| 
 | ||||
| export function BetPanel(props: { | ||||
|   contract: BinaryContract | ||||
|  | @ -203,7 +204,10 @@ function BuyPanel(props: { | |||
|   const [inputRef, focusAmountInput] = useFocus() | ||||
| 
 | ||||
|   useEffect(() => { | ||||
|     if (selected) focusAmountInput() | ||||
|     if (selected) { | ||||
|       if (isIOS()) window.scrollTo(0, window.scrollY + 200) | ||||
|       focusAmountInput() | ||||
|     } | ||||
|   }, [selected, focusAmountInput]) | ||||
| 
 | ||||
|   function onBetChoice(choice: 'YES' | 'NO') { | ||||
|  |  | |||
							
								
								
									
										14
									
								
								web/lib/util/device.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								web/lib/util/device.ts
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,14 @@ | |||
| export function isIOS() { | ||||
|   return ( | ||||
|     [ | ||||
|       'iPad Simulator', | ||||
|       'iPhone Simulator', | ||||
|       'iPod Simulator', | ||||
|       'iPad', | ||||
|       'iPhone', | ||||
|       'iPod', | ||||
|     ].includes(navigator.platform) || | ||||
|     // iPad on iOS 13 detection
 | ||||
|     (navigator.userAgent.includes('Mac') && 'ontouchend' in document) | ||||
|   ) | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user