web-ridge / react-native-paper-tabs

Smooth and fast cross platform Material Design Tabs for React Native Paper
https://reactnativepapertabs.com
MIT License
200 stars 35 forks source link

Alternative GoTo Hook Usage #34

Closed iM-GeeKy closed 2 years ago

iM-GeeKy commented 2 years ago

Could you please enlighten me as to why this usage of the goTo hook does not work? While it is a slightly different approach from the example provided , the usage of the hook seems to work consistently across other repositories leveraging hooks.

Here is a snack demonstrating the approach I've used.

RichardLindhout commented 2 years ago

This will work: https://snack.expo.dev/btC7JUVhI

It's because the goTo props are using React.Context so they are expected to be used lower than the Tabs hierarchy. But in your case they are used higher than Tabs hierarchy so they can't control the context

iM-GeeKy commented 2 years ago

Thanks for the quick response and the insight as always.