Genpact Cora Knowledge Center

Support

Change the Behavior of the Close Tab Button

You use the Shared Code service to change the behavior of the close tab button.

Example of code added to the navigator-tabs component. 

import { SharedCodeService } from 'services/shared-code';
import { GetInjectedContext } from '../../../inject-context';
const NavigatorTabs = props => {
const MainComp = GetInjectedContext('Components.NavigatorTabs');
SharedCodeService().navigatorTabsRegularTabClose = ({
    event,
    id,
    dispatch,
    actions,
  }) => {
    event.stopPropagation();
    dispatch(actions.closeTab(id));
    //call your code
    console.log(`Tab with ID: ${id} was closed.`);
  };
return <MainComp props={props}></MainComp>;
};
export default NavigatorTabs;