import { MaterialTopTabBar , MaterialTopTabBarProps , } from "@react-navigation/material-top-tabs" ; import React , { FC , useEffect } from "react" ; type Props = MaterialTopTabBarProps & { onIndexChange ? : ( index : number ) => void ; } ; const TabBar = ( { onIndexChange , ... props } ) => { const { index } = props . state ; useEffect ( ( ) => { onIndexChange ?. ( index ) ; } , [ onIndexChange , index ] ) ; return < MaterialTopTabBar { ... props } / > ; } ; export default TabBar ;