tooot/src/utils/getCurrentTab.ts

9 lines
303 B
TypeScript

const getCurrentTab = (navigation: any) => {
const { length, [length - 1]: last } =
navigation.dangerouslyGetState().history ||
navigation.dangerouslyGetParent()?.dangerouslyGetState().history
return `Screen-${last.key.split(new RegExp(/Screen-(.*?)-/))[1]}`
}
export default getCurrentTab