r/reactnative • Android • Sep 20 '20

Programmatically Hide Bottom tab when keyboard open.

Post image
198 Upvotes

32 comments sorted by

View all comments

1

u/matt_hammond iOS & Android Sep 20 '20

I think you should destructure setOptions before using it in the useCallback function.

The reason is - when you navigate to another screen the navigation state changes, and with it the navigation object, in order not to mutate the navigation object.

This behavior could have changed since react navigation 5 came out, but I haven't checked.

Either way, using setOptions in the useCallback function and listing it as a dependency is the correct way to do it.