createMaterialTopTabNavigator how to add swipe listner so i can call a function on swipe

Viewed 123

Here i am using

import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';

I want to listen swipe when i change the tab by swipping the tab so i can handle a function which will determine current Tab screen name. I cannot found any Event listner for this purpose. Please Help

function swipeListner(tabName){
  setCurrentTab(tabName)
}
1 Answers

createMaterialTopTabNavigator doesn't provide the onSwipe prop, try out other top tab components.

Related