Ga naar hoofdinhoud
Logo Appt Light

Element focus change on React Native

Whenever an element receives focus, it should not automatically trigger an event which changes context. Example of changing context include, but are not limited to: automatically submitting data, opening a new screen or moving to another element. Focus should only be moved deliberately by the user.

In React Native, you can use the onFocus method to listen to focus changes. The method is called when the element receives focus.

Be careful when the onFocus callback: do not trigger any context change because they might confuse users.

<TextInput onFocus={() => {
    // Do not change context
}} />
Bijdragen

Feedback?

Laat 't ons weten!