setFocus () no SearchBar Ionic4

async function focusElement(ref) {
  if (ref) {
    const el = await ref.getInputElement();
    el.focus();
  } else {
    console.log("focusElement got no ref");
  }
}

// Component:

function SomeComponent() {
const someRef = React.useRef()

return (
<button onClick={ () => {
    focusElement(someRef.current)
  }
>
   focus
</button>
<IonInput ref={someRef} />
)

}
Misty Moose