The indicator does not change when the selectedIndex is changed. The onChange event is fired with the correct tab index, but the indicator does not move. I've chased it down to this hook not re-running since selectedIndex isn't in the dependencies list.
Adding selectedIndex to the dependencies list fixes the issue. Might be better to just turn the selectTab function into an effect with selectedIndex as a dependency and remove it from the above hook so that the bar measurement doesn't have to re-run when the index changes. Happy to make a PR if needed.
The indicator does not change when the
selectedIndex
is changed. TheonChange
event is fired with the correct tab index, but the indicator does not move. I've chased it down to this hook not re-running sinceselectedIndex
isn't in the dependencies list.https://github.com/iRoachie/react-native-material-tabs/blob/7684195c95fbdc444310dc8e51dd52f368d5c79f/src/components/MaterialTabs.tsx#L60
Adding
selectedIndex
to the dependencies list fixes the issue. Might be better to just turn theselectTab
function into an effect withselectedIndex
as a dependency and remove it from the above hook so that the bar measurement doesn't have to re-run when the index changes. Happy to make a PR if needed.