Files
iNaturalistReactNative/src/sharedHooks/useLastScreen.ts
T
Johannes Klein 3d9f2c3040 Refactor lodash function imports (#3348)
* Change destructured imports to individual imports

* Change full lodash imports to individual function imports

* Remove unused imports

* One more
2026-02-03 18:12:48 +01:00

14 lines
406 B
TypeScript

import { useNavigationState } from "@react-navigation/native";
import last from "lodash/last";
const useLastScreen = ( ): string => {
const navState = useNavigationState( nav => nav );
const history = navState?.routes.map( r => r.name );
// remove current screen from navigation history
history?.pop( );
const lastScreen = last( history );
return lastScreen;
};
export default useLastScreen;