mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-10-07 18:42:43 -04:00
* Change destructured imports to individual imports * Change full lodash imports to individual function imports * Remove unused imports * One more
14 lines
406 B
TypeScript
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;
|