Test focus of element

How do I check that this TextInput component is focused? I know how to do it on the web:

const input = getByPlaceholderText("placeholder");
expect(document.activeElement).toEqual(input);

But how to do the same in react native?

  it('should have focus', () => {
    const { getByTestId } = render(<TextInput autoFocus testID={ 'alpha' }/>);
    const textInput = getByTestId('alpha');

    // and then ..?
  });

Thanks in advance for your time!

评论