import {NavigationService} from "./types";
/**
* NavigateToTabCallback
*/
type NavigateToTabCallback = {
/**
* Function to call to navigate to the next default screen
*/
defaultNavigation: Function,
/**
* Current tab
*/
currentTab: string,
/**
* Next tab
*/
nextTab: string,
/**
* Group object
*/
group: Record<any, any>,
navigation: NavigationService
};
/**
* @class
* Add Group Screen Hooks.
* Instance name: addGroupScreenHooksApi
The AddGroupScreenHooksApi() can be used to modify the "Add Group" screen options.
* @example
* externalCodeSetup.addGroupScreenHooksApi.METHOD_NAME
*/
export class AddGroupScreenApi {
navigateToTab:
| ((
defaultNavigation: string,
currentTab: string,
nextTab: string,
group: Record<any, any>,
navigation: NavigationService
) => void)
| null = null;
/**
* You can use this hook to modify how each screens in the group creation process is navigating.
* For example, you can use this to navigate to a custom screen after the group creation process instead of the default behavior of navigating to the Groups screen.
* @method
* @param {NavigateToTabCallback} NavigateToTabCallback
* @example <caption>Navigate to a custom screen after the Invites screen</caption>
*
* externalCodeSetup.addGroupScreenApi.setNavigateToTab((props) => {
*
* const {
* defaultNavigation,
* currentTab,
* nextTab,
* group,
* navigation
* } = props;
*
*
* if (nextTab === 'Invites'){
* return navigation.navigate(
* CommonActions.navigate({
* name: "CustomScreen",
* })
* );
* }
*
* defaultNavigation();
* });
*/
setNavigateToTab = (
navigateToTab:
| ((
defaultNavigation: string,
currentTab: string,
nextTab: string,
group: Record<any, any>,
navigation: NavigationService
) => void)
| null
) => {
this.navigateToTab = navigateToTab;
};
}
Source