Fix keyboard support on the dropdown (#1073)
* Fix: dropdown now supports accessibility labels and keyboard controls * Fix event propagation around the post dropdown
This commit is contained in:
parent
45da8a86c9
commit
1195f28992
3 changed files with 109 additions and 39 deletions
22
src/view/com/util/EventStopper.tsx
Normal file
22
src/view/com/util/EventStopper.tsx
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import React from 'react'
|
||||
import {View} from 'react-native'
|
||||
|
||||
/**
|
||||
* This utility function captures events and stops
|
||||
* them from propagating upwards.
|
||||
*/
|
||||
export function EventStopper({children}: React.PropsWithChildren<{}>) {
|
||||
const stop = (e: any) => {
|
||||
e.stopPropagation()
|
||||
}
|
||||
return (
|
||||
<View
|
||||
onStartShouldSetResponder={_ => true}
|
||||
onTouchEnd={stop}
|
||||
// @ts-ignore web only -prf
|
||||
onClick={stop}
|
||||
onKeyDown={stop}>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue